Merge "Use lineinfile to add missing user secrets"

This commit is contained in:
Jenkins 2016-09-27 06:43:01 +00:00 committed by Gerrit Code Review
commit 50990597ac

View File

@ -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: