Make metadata robust to missing services

So currently if some optional openstack service is not installed
metadata will fail when it tires to work on its config file.

This commit adds in a check for the existance of each service config
before running the gathering tasks.

What might be a useful addition to this commit would be some logic
for determining which services should never be missing and alerting
the user.

Change-Id: Ie360f062646cb5431de9ed21bd0dd193b84ddcda
This commit is contained in:
jkilpatr 2016-09-22 15:28:13 -04:00
parent 1d8f900c4f
commit cddac5f1e9
10 changed files with 75 additions and 12 deletions

View File

@ -2,13 +2,20 @@
#
# Tasks to get ceilometer facts
#
- name: Check that Ceilometer is installed
become: true
stat: path=/etc/ceilometer/ceilometer.conf
register: ceilometer_config
- name: Parse Ceilometer config
become: true
shell: python /tmp/openstack-config-parser.py ceilometer /etc/ceilometer/ceilometer.conf /tmp/out.yml
when: ceilometer_config.stat.exists
- name: Fetch output
fetch: src=/tmp/out.yml dest=/tmp/out.yml flat=yes
when: ceilometer_config.stat.exists
- name: Load configuration variables
include_vars: /tmp/out.yml
when: ceilometer_config.stat.exists

View File

@ -2,13 +2,20 @@
#
# Tasks to get cinder facts
#
- name: Check that Ceilometer is installed
become: true
stat: path=/etc/cinder/cinder.conf
register: cinder_config
- name: Parse Cinder config
become: true
shell: python /tmp/openstack-config-parser.py cinder /etc/cinder/cinder.conf /tmp/out.yml
when: cinder_config.stat.exists
- name: Fetch output
fetch: src=/tmp/out.yml dest=/tmp/out.yml flat=yes
when: cinder_config.stat.exists
- name: Load configuration variables
include_vars: /tmp/out.yml
when: cinder_config.stat.exists

View File

@ -3,18 +3,19 @@
# Tasks to get Glance facts
#
- name: Parse Glance config
- name: Get config files for Glance
shell: "ls /etc/glance/*.conf"
register: glance_config
- name: Parse Glance config files
become: true
shell: python /tmp/openstack-config-parser.py glance {{ item }} /tmp/{{ item | basename }}.yml
with_fileglob:
- /etc/glance/*.conf
shell: "python /tmp/openstack-config-parser.py glance {{ item }} /tmp/{{ item | basename }}.yml"
with_items: "{{ glance_config.stdout_lines }}"
- name: Fetch output
fetch: src=/tmp/{{ item | basename }}.yml dest=/tmp/{{ item | basename }}.yml flat=yes
with_fileglob:
- /etc/glance/*.conf
fetch: "src=/tmp/{{ item | basename }}.yml dest=/tmp/{{ item | basename }}.yml flat=yes"
with_items: "{{ glance_config.stdout_lines }}"
- name: Load configuration variables
include_vars: /tmp/{{ item | basename }}.yml
with_fileglob:
- /etc/glance/*.conf
include_vars: "/tmp/{{ item | basename }}.yml"
with_items: "{{ glance_config.stdout_lines }}"

View File

@ -3,12 +3,20 @@
# Tasks to get gnocchi config data
#
- name: Check that Gnocchi is installed
become: true
stat: path=/etc/gnocchi/gnocchi.conf
register: gnocchi_config
- name: Parse Gnocchi config
become: true
shell: python /tmp/openstack-config-parser.py gnocchi /etc/gnocchi/gnocchi.conf /tmp/out.yml
when: gnocchi_config.stat.exists
- name: Fetch output
fetch: src=/tmp/out.yml dest=/tmp/out.yml flat=yes
when: gnocchi_config.stat.exists
- name: Load configuration variables
include_vars: /tmp/out.yml
when: gnocchi_config.stat.exists

View File

@ -3,12 +3,20 @@
# Tasks to get heat facts
#
- name: Check that Heat is installed
become: true
stat: path=/etc/heat/heat.conf
register: heat_config
- name: Parse Heat config
become: true
shell: python /tmp/openstack-config-parser.py heat /etc/heat/heat.conf /tmp/out.yml
when: heat_config.stat.exists
- name: Fetch output
fetch: src=/tmp/out.yml dest=/tmp/out.yml flat=yes
when: heat_config.stat.exists
- name: Load configuration variables
include_vars: /tmp/out.yml
when: heat_config.stat.exists

View File

@ -3,15 +3,23 @@
# Tasks to set keystone facts
#
- name: Check that Keystone is installed
become: true
stat: path=/etc/keystone/keystone.conf
register: keystone_config
- name: Parse Keystone config
become: true
shell: python /tmp/openstack-config-parser.py keystone /etc/keystone/keystone.conf /tmp/out.yml
when: keystone_config.stat.exists
- name: Fetch output
fetch: src=/tmp/out.yml dest=/tmp/out.yml flat=yes
when: keystone_config.stat.exists
- name: Load configuration variables
include_vars: /tmp/out.yml
when: keystone_config.stat.exists
- name: Determine if Keystone is deployed in eventlet
shell: ps afx | grep "[Kk]eystone-all" -c

View File

@ -3,15 +3,23 @@
# Tasks to get neutron facts
#
- name: Check that Neutron is installed
become: true
stat: path=/etc/neutron/neutron.conf
register: neutron_config
- name: Parse Neutron config
become: true
shell: python /tmp/openstack-config-parser.py neutron /etc/neutron/neutron.conf /tmp/out.yml
when: neutron_config.stat.exists
- name: Fetch output
fetch: src=/tmp/out.yml dest=/tmp/out.yml flat=yes
when: neutron_config.stat.exists
- name: Load configuration variables
include_vars: /tmp/out.yml
when: neutron_config.stat.exists
- name: Parse Neutron plugin.ini
become: true

View File

@ -3,13 +3,21 @@
# Tasks to get nova facts
#
- name: Check that Nova is installed
become: true
stat: path=/etc/nova/nova.conf
register: nova_config
- name: Parse Nova config
become: true
shell: python /tmp/openstack-config-parser.py nova /etc/nova/nova.conf /tmp/out.yml
when: nova_config.stat.exists
- name: Fetch output
fetch: src=/tmp/out.yml dest=/tmp/out.yml flat=yes
when: nova_config.stat.exists
- name: Load configuration variables
include_vars: /tmp/out.yml
when: nova_config.stat.exists

View File

@ -3,10 +3,12 @@
- name: Disable DNS resolution in Overcloud sshd config
lineinfile: dest=/etc/ssh/sshd_config line="UseDNS no" state=present
become: true
when: "{{disable_ssh_dns}}"
become: true
become_user: root
- name: Restart sshd service
service: name=sshd state=restarted
become: true
when: "{{disable_ssh_dns}}"
become: true
become_user: root

View File

@ -18,6 +18,12 @@
- browbeat/common
- browbeat/browbeat
- browbeat/browbeat-network
- name: Disable sshd dns
hosts: overcloud
vars:
disable_ssh_dns: true
roles:
- browbeat/no-sshd-dns
- name: Run Browbeat