66 lines
2.2 KiB
YAML
66 lines
2.2 KiB
YAML
---
|
|
#
|
|
# Tasks to get facts
|
|
#
|
|
|
|
- name: Check for the config - container
|
|
become: true
|
|
stat: path="container_config_paths[item].config"
|
|
register: config_containers
|
|
when: hostvars[inventory_hostname]['containers'] is defined
|
|
with_items: "{{ container_config_paths }}"
|
|
|
|
- name: Check for the config
|
|
become: true
|
|
stat: path="{{hostvars[inventory_hostname]['config_path']}}nova/nova.conf"
|
|
register: config
|
|
when: hostvars[inventory_hostname]['containers'] is not defined
|
|
|
|
- name: Create tmp dir
|
|
become: true
|
|
shell: mktemp -d -p /tmp -t XXX-metadata
|
|
register: tmp
|
|
|
|
- name: Parse config - containers
|
|
become: true
|
|
shell: "python /tmp/openstack-config-parser.py {{item}} {{container_config_paths[item].config}} {{tmp.stdout}}/{{item}}.yml"
|
|
when: hostvars[inventory_hostname]['containers'] is defined
|
|
ignore_errors: true
|
|
with_items: "{{ container_config_paths }}"
|
|
|
|
- name: Parse config
|
|
become: true
|
|
shell: python /tmp/openstack-config-parser.py {{config_paths[item]}} {{hostvars[inventory_hostname]['config_path']}}/nova/nova.conf /tmp/out.yml
|
|
when: config.stat.exists and hostvars[inventory_hostname]['containers'] is not defined
|
|
ignore_errors: true
|
|
|
|
- name: Create local tmp dir
|
|
become: false
|
|
local_action: shell mktemp -d -p /tmp -t XXX-metadata
|
|
register: localtmp
|
|
|
|
- name: Fetch output - containers
|
|
fetch: src={{tmp.stdout}}/{{item}}.yml dest={{localtmp.stdout}}/{{item}}.yml flat=yes
|
|
when: hostvars[inventory_hostname]['containers'] is defined
|
|
ignore_errors: true
|
|
with_items: "{{ container_config_paths }}"
|
|
|
|
- name: Assemble metadata - containers
|
|
local_action: assemble src="{{localtmp.stdout}}" dest="{{localtmp.stdout}}/out.yml"
|
|
|
|
- name: Load configuration variables - containers
|
|
include_vars: "{{localtmp.stdout}}/out.yml"
|
|
when: hostvars[inventory_hostname]['containers'] is defined
|
|
ignore_errors: true
|
|
|
|
- name: Fetch output
|
|
fetch: src=/tmp/out.yml dest=/tmp/out-{{ inventory_hostname }}.yml flat=yes
|
|
when: hostvars[inventory_hostname]['containers'] is not defined
|
|
ignore_errors: true
|
|
|
|
- name: Load configuration variables
|
|
include_vars: /tmp/out-{{ inventory_hostname }}.yml
|
|
when: hostvars[inventory_hostname]['containers'] is not defined
|
|
ignore_errors: true
|
|
|