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