Merge "Use lineinfile to add missing user secrets"
This commit is contained in:
commit
50990597ac
@ -22,12 +22,15 @@
|
|||||||
- name: Read example user secrets file
|
- name: Read example user secrets file
|
||||||
shell: "grep '^[a-zA-Z]' {{ playbook_dir }}/../../../etc/openstack_deploy/user_secrets.yml"
|
shell: "grep '^[a-zA-Z]' {{ playbook_dir }}/../../../etc/openstack_deploy/user_secrets.yml"
|
||||||
register: secrets
|
register: secrets
|
||||||
- name: Add missing secret
|
- name: Read user secrets file
|
||||||
shell: |
|
shell: "grep '^[a-zA-Z]' /etc/openstack_deploy/{{ _osa_secrets_file_name }}"
|
||||||
if ! grep '^{{ item }}' /etc/openstack_deploy/{{ _osa_secrets_file_name }}; then
|
register: user_secrets
|
||||||
echo {{ item }} | tee -a /etc/openstack_deploy/{{ _osa_secrets_file_name }}
|
- name: Add missing secrets
|
||||||
fi
|
lineinfile:
|
||||||
with_items: secrets.stdout_lines
|
dest: "/etc/openstack_deploy/{{ _osa_secrets_file_name }}"
|
||||||
|
line: "{{ item }}"
|
||||||
|
with_items: "{{ secrets.stdout_lines }}"
|
||||||
|
when: user_secrets.stdout.find("{{ item }}") == -1
|
||||||
- name: Generate new secrets
|
- name: Generate new secrets
|
||||||
shell: "{{ playbook_dir }}/../../../scripts/pw-token-gen.py --file /etc/openstack_deploy/{{ _osa_secrets_file_name }}"
|
shell: "{{ playbook_dir }}/../../../scripts/pw-token-gen.py --file /etc/openstack_deploy/{{ _osa_secrets_file_name }}"
|
||||||
vars:
|
vars:
|
||||||
|
Loading…
Reference in New Issue
Block a user