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
|
||||
shell: "grep '^[a-zA-Z]' {{ playbook_dir }}/../../../etc/openstack_deploy/user_secrets.yml"
|
||||
register: secrets
|
||||
- name: Add missing secret
|
||||
shell: |
|
||||
if ! grep '^{{ item }}' /etc/openstack_deploy/{{ _osa_secrets_file_name }}; then
|
||||
echo {{ item }} | tee -a /etc/openstack_deploy/{{ _osa_secrets_file_name }}
|
||||
fi
|
||||
with_items: secrets.stdout_lines
|
||||
- name: Read user secrets file
|
||||
shell: "grep '^[a-zA-Z]' /etc/openstack_deploy/{{ _osa_secrets_file_name }}"
|
||||
register: user_secrets
|
||||
- name: Add missing secrets
|
||||
lineinfile:
|
||||
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
|
||||
shell: "{{ playbook_dir }}/../../../scripts/pw-token-gen.py --file /etc/openstack_deploy/{{ _osa_secrets_file_name }}"
|
||||
vars:
|
||||
|
Loading…
Reference in New Issue
Block a user