52 lines
1.8 KiB
YAML
52 lines
1.8 KiB
YAML
---
|
|
- name: Ensure the Kolla Ansible configuration directores exist
|
|
file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
owner: "{{ ansible_user }}"
|
|
group: "{{ ansible_user }}"
|
|
mode: 0750
|
|
become: True
|
|
with_items:
|
|
- "{{ kolla_config_path }}"
|
|
- "{{ kolla_config_path }}/inventory"
|
|
- "{{ kolla_node_custom_config_path }}"
|
|
|
|
- name: Ensure the Kolla configuration files exist
|
|
template:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ kolla_config_path }}/{{ item.dest }}"
|
|
mode: 0640
|
|
with_items:
|
|
- { src: seed.j2, dest: inventory/seed }
|
|
- { src: overcloud.j2, dest: inventory/overcloud }
|
|
- { src: globals.yml.j2, dest: globals.yml }
|
|
|
|
- name: Check whether the Kolla passwords file exists
|
|
stat:
|
|
path: "{{ kolla_config_path }}/passwords.yml"
|
|
get_checksum: False
|
|
get_md5: False
|
|
mime: False
|
|
register: kolla_passwords_stat
|
|
|
|
- name: Generate Kolla passwords
|
|
shell: >
|
|
cp {{ kolla_ansible_install_dir }}/etc_examples/kolla/passwords.yml {{ kolla_config_path }}/passwords.yml.generated
|
|
&& chmod 640 {{ kolla_config_path }}/passwords.yml.generated
|
|
&& {{ kolla_venv }}/bin/kolla-genpwd -p {{ kolla_config_path }}/passwords.yml.generated
|
|
&& mv {{ kolla_config_path }}/passwords.yml.generated {{ kolla_config_path }}/passwords.yml
|
|
when: not kolla_passwords_stat.stat.exists
|
|
|
|
- name: Read the Kolla passwords file
|
|
slurp:
|
|
src: "{{ kolla_config_path }}/passwords.yml"
|
|
register: passwords_result
|
|
when: "{{ kolla_ansible_custom_passwords }}"
|
|
|
|
- name: Ensure the Kolla passwords file contains the required custom passwords
|
|
copy:
|
|
content: "{{ passwords_result.content | b64decode | from_yaml | combine(kolla_ansible_custom_passwords) | to_nice_yaml }}"
|
|
dest: "{{ kolla_config_path }}/passwords.yml"
|
|
when: "{{ kolla_ansible_custom_passwords }}"
|