Merge "Remove legacy gather roles and playbook"
This commit is contained in:
		@@ -1,17 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
#
 | 
			
		||||
# Tasks to get ceilometer facts
 | 
			
		||||
#
 | 
			
		||||
- name: Parse Ceilometer config
 | 
			
		||||
  become: true
 | 
			
		||||
  command: python /tmp/openstack-config-parser.py ceilometer /tmp/out.yml
 | 
			
		||||
  register: ceilometer_parsed
 | 
			
		||||
  ignore_errors: true
 | 
			
		||||
 | 
			
		||||
- name: Fetch output
 | 
			
		||||
  fetch: src=/tmp/out.yml dest=/tmp/out-{{ inventory_hostname }}.yml flat=yes
 | 
			
		||||
  when: ceilometer_parsed is succeeded
 | 
			
		||||
 | 
			
		||||
- name: Load configuration variables
 | 
			
		||||
  include_vars: /tmp/out-{{ inventory_hostname }}.yml
 | 
			
		||||
  when: ceilometer_parsed is succeeded
 | 
			
		||||
@@ -1,17 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
#
 | 
			
		||||
# Tasks to get cinder facts
 | 
			
		||||
#
 | 
			
		||||
- name: Parse Cinder config
 | 
			
		||||
  become: true
 | 
			
		||||
  command: python /tmp/openstack-config-parser.py cinder /tmp/out.yml
 | 
			
		||||
  register: cinder_parsed
 | 
			
		||||
  ignore_errors: true
 | 
			
		||||
 | 
			
		||||
- name: Fetch output
 | 
			
		||||
  fetch: src=/tmp/out.yml dest=/tmp/out-{{ inventory_hostname }}.yml flat=yes
 | 
			
		||||
  when: cinder_parsed is succeeded
 | 
			
		||||
 | 
			
		||||
- name: Load configuration variables
 | 
			
		||||
  include_vars: /tmp/out-{{ inventory_hostname }}.yml
 | 
			
		||||
  when: cinder_parsed is succeeded
 | 
			
		||||
@@ -1,154 +0,0 @@
 | 
			
		||||
#!/usr/bin/env python
 | 
			
		||||
#   Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
#   you may not use this file except in compliance with the License.
 | 
			
		||||
#   You may obtain a copy of the License at
 | 
			
		||||
#
 | 
			
		||||
#   http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
#
 | 
			
		||||
#   Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
#   distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
#   See the License for the specific language governing permissions and
 | 
			
		||||
#   limitations under the License.
 | 
			
		||||
 | 
			
		||||
import sys
 | 
			
		||||
import os
 | 
			
		||||
import subprocess
 | 
			
		||||
# usage: openstack-config-parser.py [service] [output file]
 | 
			
		||||
 | 
			
		||||
def run_cmd(cmd):
 | 
			
		||||
    process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
 | 
			
		||||
                               stderr=subprocess.PIPE)
 | 
			
		||||
    stdout, stderr = process.communicate()
 | 
			
		||||
    output_dict = {}
 | 
			
		||||
    output_dict['stdout'] = stdout.strip()
 | 
			
		||||
    output_dict['stderr'] = stderr.strip()
 | 
			
		||||
    output_dict['rc'] = process.returncode
 | 
			
		||||
    return output_dict
 | 
			
		||||
 | 
			
		||||
def strip_chars(line):
 | 
			
		||||
    forbidden_chars = ['#', '\n', '"', '\\', ' ', '<', '>']
 | 
			
		||||
    for char in forbidden_chars:
 | 
			
		||||
        line = line.replace(char, '')
 | 
			
		||||
    return line
 | 
			
		||||
 | 
			
		||||
def parse_config(serviceName, fileName):
 | 
			
		||||
    # a dict containing key/value pairs, last value is what is stored.
 | 
			
		||||
    values = {}
 | 
			
		||||
    with open(fileName) as config:
 | 
			
		||||
        section = None
 | 
			
		||||
        for line in config:
 | 
			
		||||
            pair = strip_chars(line)
 | 
			
		||||
            pair = pair.split('=')
 | 
			
		||||
            # excludes any line without a key/val pair
 | 
			
		||||
            valid_line = not line.startswith("# ") and \
 | 
			
		||||
                         '[' not in line and line != '\n' \
 | 
			
		||||
                         and line != '#\n' and "password" \
 | 
			
		||||
                         not in line.lower()
 | 
			
		||||
            if line.startswith('['):
 | 
			
		||||
                section = line.replace('[','').replace(']','').replace('\n','')
 | 
			
		||||
            if '#' not in line and valid_line and not section == None and len(pair) == 2:
 | 
			
		||||
                pair[0] = strip_chars(pair[0])
 | 
			
		||||
                pair[1] = strip_chars(pair[1])
 | 
			
		||||
                values["openstack_S_" + serviceName + "_S_" + section + "_S_" + pair[0]] = pair[1]
 | 
			
		||||
    return values
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def try_type(val):
 | 
			
		||||
    try:
 | 
			
		||||
        int(val)
 | 
			
		||||
        return val
 | 
			
		||||
    except (ValueError, TypeError):
 | 
			
		||||
        try:
 | 
			
		||||
            float(val)
 | 
			
		||||
            return val
 | 
			
		||||
        except (ValueError, TypeError):
 | 
			
		||||
            if type(val) is list:
 | 
			
		||||
                return "\"" + str(val) + "\""
 | 
			
		||||
            elif val.lower() in ("true", "false"):
 | 
			
		||||
                return val
 | 
			
		||||
            else:
 | 
			
		||||
                return "\"" + val + "\""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def add_conf_location(serviceName, fileName, values): 
 | 
			
		||||
    # Stores the exact location we gathered this config from.
 | 
			
		||||
    index = "openstack_S_" + serviceName + "_S_" + "Browbeat" + "_S_" + "gather_conf_path"
 | 
			
		||||
    if index in values:
 | 
			
		||||
        values[index].append(fileName)
 | 
			
		||||
    else:
 | 
			
		||||
        values[index] = [fileName]
 | 
			
		||||
 | 
			
		||||
def print_vars_file(values, fileName):
 | 
			
		||||
    with open(fileName, 'w') as output:
 | 
			
		||||
        for key in values:
 | 
			
		||||
            output.write(key + ": " + try_type(values[key]) + "\n")
 | 
			
		||||
 | 
			
		||||
def is_containerized(service_name):
 | 
			
		||||
    out = run_cmd("docker ps")
 | 
			
		||||
    if service_name in out['stdout']:
 | 
			
		||||
        return True
 | 
			
		||||
    else:
 | 
			
		||||
        return False
 | 
			
		||||
 | 
			
		||||
def get_configs_list(path, extension='.conf'):
 | 
			
		||||
    configs = []
 | 
			
		||||
    for item in os.listdir(path):
 | 
			
		||||
        if item.endswith(extension):
 | 
			
		||||
            configs.extend([item])
 | 
			
		||||
    return configs
 | 
			
		||||
 | 
			
		||||
def get_neutron_plugin(output, cfg_path):
 | 
			
		||||
    plugin = output['openstack_S_neutron_S_DEFAULT_S_core_plugin']
 | 
			
		||||
    plugin_path = "{}/plugins/{}/".format(cfg_path, plugin)
 | 
			
		||||
    for item in get_configs_list(plugin_path, extension='.ini'):
 | 
			
		||||
        full_path = "{}/{}".format(plugin_path,
 | 
			
		||||
                                   item)
 | 
			
		||||
        output.update(parse_config("neutron-plugin", full_path))
 | 
			
		||||
        add_conf_location("neutron", full_path, output)
 | 
			
		||||
    return output
 | 
			
		||||
 | 
			
		||||
def main():
 | 
			
		||||
    if len(sys.argv) < 3:
 | 
			
		||||
        print("usage: openstack-config-parser.py [service] [output file]")
 | 
			
		||||
        exit(1)
 | 
			
		||||
 | 
			
		||||
    service_name = sys.argv[1]
 | 
			
		||||
    outfile = sys.argv[2]
 | 
			
		||||
 | 
			
		||||
    # This is a list of services that require exceptions from the usual
 | 
			
		||||
    # pattern when gathering their config files
 | 
			
		||||
    pattern_exceptions = ['glance']
 | 
			
		||||
    in_container = is_containerized(service_name)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    if 'undercloud' in service_name:
 | 
			
		||||
        cfg_path = "/home/stack"
 | 
			
		||||
    elif in_container and service_name not in pattern_exceptions:
 | 
			
		||||
        cfg_path = "/var/lib/config-data/puppet-generated/{}/etc/{}".format(
 | 
			
		||||
            service_name, service_name)
 | 
			
		||||
    # Glance has all configs in a folder named glance_api, ps shows no
 | 
			
		||||
    # processes outside of the container, so I assume those are the right
 | 
			
		||||
    # configs, even though the container is also named glance-api
 | 
			
		||||
    # jkilpatr 7/13/17
 | 
			
		||||
    elif in_container and 'glance' in service_name:
 | 
			
		||||
        cfg_path = "/var/lib/config-data/glance_api/etc/glance"
 | 
			
		||||
    else:
 | 
			
		||||
        cfg_path = "/etc/{}".format(service_name)
 | 
			
		||||
 | 
			
		||||
    print("Parsing all .conf files in {}".format(cfg_path))
 | 
			
		||||
    output = {}
 | 
			
		||||
    for item in get_configs_list(cfg_path):
 | 
			
		||||
        full_path = "{}/{}".format(cfg_path,
 | 
			
		||||
                                   item)
 | 
			
		||||
        output.update(parse_config(service_name, full_path))
 | 
			
		||||
        add_conf_location(service_name, full_path, output)
 | 
			
		||||
    # Required to find and load the active neutron plugin file.
 | 
			
		||||
    if 'neutron' in service_name:
 | 
			
		||||
        output.update(get_neutron_plugin(output, cfg_path))
 | 
			
		||||
 | 
			
		||||
    print_vars_file(output, outfile)
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    sys.exit(main())
 | 
			
		||||
 | 
			
		||||
@@ -1,15 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
# Cleanup for gather common
 | 
			
		||||
# Required to prevent perms issues
 | 
			
		||||
 | 
			
		||||
- name: cleanup script
 | 
			
		||||
  file:
 | 
			
		||||
    path: /tmp/openstack-config-parser.py
 | 
			
		||||
    state: absent
 | 
			
		||||
  become: true
 | 
			
		||||
 | 
			
		||||
- name: cleanup varsfile
 | 
			
		||||
  file:
 | 
			
		||||
    path: /tmp/out.yml
 | 
			
		||||
    state: absent
 | 
			
		||||
  become: true
 | 
			
		||||
@@ -1,21 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
- name: Copy config parser script to remote
 | 
			
		||||
  copy: src=openstack-config-parser.py dest=/tmp/openstack-config-parser.py
 | 
			
		||||
  notify:
 | 
			
		||||
     - cleanup script
 | 
			
		||||
     - cleanup varsfile
 | 
			
		||||
 | 
			
		||||
- name: Determine if docker is running
 | 
			
		||||
  shell: docker ps | wc -l
 | 
			
		||||
  register: docker_ps
 | 
			
		||||
 | 
			
		||||
- name: Set var for container deployment
 | 
			
		||||
  set_fact:
 | 
			
		||||
    containers: True
 | 
			
		||||
    config_path: /var/lib/config-data/puppet-generated/
 | 
			
		||||
  when: docker_ps.stdout|int > 1
 | 
			
		||||
 | 
			
		||||
- name: Set fact for non-container deployment
 | 
			
		||||
  set_fact:
 | 
			
		||||
    config_path: /etc
 | 
			
		||||
  when: docker_ps.stdout|int < 2
 | 
			
		||||
@@ -1,42 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
#
 | 
			
		||||
# Compute Tasks for gathering facts
 | 
			
		||||
#
 | 
			
		||||
- name: Get ovs version
 | 
			
		||||
  shell: ovs-vswitchd --version | grep vSwitch | awk {'print$4'}
 | 
			
		||||
  register: ovs_version
 | 
			
		||||
 | 
			
		||||
- name: Set ovs version fact
 | 
			
		||||
  set_fact:
 | 
			
		||||
    openstack_ovs_version: "{{ ovs_version.stdout }}"
 | 
			
		||||
 | 
			
		||||
- name: Get neutron ovs agent ovsdb setting
 | 
			
		||||
  command: crudini --get /etc/neutron/plugins/ml2/openvswitch_agent.ini ovs ovsdb_interface
 | 
			
		||||
  register: ovsdb_status
 | 
			
		||||
  ignore_errors: true
 | 
			
		||||
 | 
			
		||||
- name: Set Neutron OVS ovsdb fact
 | 
			
		||||
  set_fact:
 | 
			
		||||
    openstack_neutron_ovsdb: "{{ ovsdb_status.stdout }}"
 | 
			
		||||
  when: (ovsdb_status.stdout.find('native') != -1 or ovsdb_status.stdout.find('vsctl') != -1)
 | 
			
		||||
 | 
			
		||||
- name: Set Neutron OVS ovsdb fact
 | 
			
		||||
  set_fact:
 | 
			
		||||
    openstack_neutron_ovsdb: "vsctl"
 | 
			
		||||
  when: (ovsdb_status.stdout.find('native') == -1 and ovsdb_status.stdout.find('vsctl') == -1)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
- name: Check for Nested Virtualization
 | 
			
		||||
  shell: cat /proc/cpuinfo | grep hypervisor
 | 
			
		||||
  register: nested_virt
 | 
			
		||||
  ignore_errors: true
 | 
			
		||||
 | 
			
		||||
- name: Set Nested Virtualization flag
 | 
			
		||||
  set_fact:
 | 
			
		||||
    openstack_nested_virt: true
 | 
			
		||||
  when: nested_virt.stdout != ""
 | 
			
		||||
 | 
			
		||||
- name: Set Nested Virtualization flag
 | 
			
		||||
  set_fact:
 | 
			
		||||
    openstack_nested_virt: false
 | 
			
		||||
  when: nested_virt.stdout == ""
 | 
			
		||||
@@ -1,6 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
- name: Dump all vars
 | 
			
		||||
  template: src=dump_facts.j2 dest={{ browbeat_path }}/metadata/machine_facts.json
 | 
			
		||||
 | 
			
		||||
- name: Generate metadata jsons
 | 
			
		||||
  command: python {{ browbeat_path }}/browbeat/metadata.py {{ browbeat_path }}/metadata
 | 
			
		||||
@@ -1,15 +0,0 @@
 | 
			
		||||
[
 | 
			
		||||
{% if groups['controller'] is defined %}
 | 
			
		||||
 {% for host in groups['controller'] %}
 | 
			
		||||
  {{hostvars[host]| to_nice_json}},
 | 
			
		||||
 {% endfor %}
 | 
			
		||||
{% endif %}
 | 
			
		||||
{% if groups['compute'] is defined %}
 | 
			
		||||
 {% for host in groups['compute'] %}
 | 
			
		||||
  {{hostvars[host]| to_nice_json}},
 | 
			
		||||
 {% endfor %}
 | 
			
		||||
{% endif %}
 | 
			
		||||
{% for host in groups['undercloud'] %}
 | 
			
		||||
{{hostvars[host]| to_nice_json}}
 | 
			
		||||
{% endfor %}
 | 
			
		||||
]
 | 
			
		||||
@@ -1,65 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
#
 | 
			
		||||
# 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
 | 
			
		||||
 | 
			
		||||
@@ -1,18 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
#
 | 
			
		||||
# Tasks to get Glance facts
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
- name: Parse Glance config files
 | 
			
		||||
  become: true
 | 
			
		||||
  command: "python /tmp/openstack-config-parser.py glance /tmp/out.yml"
 | 
			
		||||
  register: glance_parsed
 | 
			
		||||
  ignore_errors: true
 | 
			
		||||
 | 
			
		||||
- name: Fetch output
 | 
			
		||||
  fetch: src=/tmp/out.yml dest=/tmp/out-{{ inventory_hostname }}.yml flat=yes
 | 
			
		||||
  when: glance_parsed is succeeded
 | 
			
		||||
 | 
			
		||||
- name: Load configuration variables
 | 
			
		||||
  include_vars: /tmp/out-{{ inventory_hostname }}.yml
 | 
			
		||||
  when: glance_parsed is succeeded
 | 
			
		||||
@@ -1,18 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
#
 | 
			
		||||
# Tasks to get gnocchi config data
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
- name: Parse Gnocchi config
 | 
			
		||||
  become: true
 | 
			
		||||
  command: python /tmp/openstack-config-parser.py gnocchi /tmp/out.yml
 | 
			
		||||
  register: gnocchi_parsed
 | 
			
		||||
  ignore_errors: true
 | 
			
		||||
 | 
			
		||||
- name: Fetch output
 | 
			
		||||
  fetch: src=/tmp/out.yml dest=/tmp/out-{{ inventory_hostname }}.yml flat=yes
 | 
			
		||||
  when: gnocchi_parsed is succeeded
 | 
			
		||||
 | 
			
		||||
- name: Load configuration variables
 | 
			
		||||
  include_vars: /tmp/out-{{ inventory_hostname }}.yml
 | 
			
		||||
  when: gnocchi_parsed is succeeded
 | 
			
		||||
@@ -1,18 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
#
 | 
			
		||||
# Tasks to get heat facts
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
- name: Parse Heat config
 | 
			
		||||
  become: true
 | 
			
		||||
  command: python /tmp/openstack-config-parser.py heat /tmp/out.yml
 | 
			
		||||
  register: heat_parsed
 | 
			
		||||
  ignore_errors: true
 | 
			
		||||
 | 
			
		||||
- name: Fetch output
 | 
			
		||||
  fetch: src=/tmp/out.yml dest=/tmp/out-{{ inventory_hostname }}.yml flat=yes
 | 
			
		||||
  when: heat_parsed is succeeded
 | 
			
		||||
 | 
			
		||||
- name: Load configuration variables
 | 
			
		||||
  include_vars: /tmp/out-{{ inventory_hostname }}.yml
 | 
			
		||||
  when: heat_parsed is succeeded
 | 
			
		||||
@@ -1,60 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
#
 | 
			
		||||
# Tasks to set keystone facts
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
- name: Parse Keystone config
 | 
			
		||||
  become: true
 | 
			
		||||
  command: python /tmp/openstack-config-parser.py keystone /tmp/out.yml
 | 
			
		||||
  register: keystone_parsed
 | 
			
		||||
  ignore_errors: true
 | 
			
		||||
 | 
			
		||||
- name: Fetch output
 | 
			
		||||
  fetch: src=/tmp/out.yml dest=/tmp/out-{{ inventory_hostname }}.yml flat=yes
 | 
			
		||||
  when: keystone_parsed is succeeded
 | 
			
		||||
 | 
			
		||||
- name: Load configuration variables
 | 
			
		||||
  include_vars: /tmp/out-{{ inventory_hostname }}.yml
 | 
			
		||||
  when: keystone_parsed is succeeded
 | 
			
		||||
 | 
			
		||||
- name: Determine if Keystone is deployed in eventlet
 | 
			
		||||
  shell: ps afx | grep "[Kk]eystone-all" -c
 | 
			
		||||
  register: keystone_in_eventlet
 | 
			
		||||
  changed_when: false
 | 
			
		||||
  ignore_errors: True
 | 
			
		||||
 | 
			
		||||
- name: Set keystone_deployment variable to httpd
 | 
			
		||||
  set_fact: openstack_keystone_deployment='httpd'
 | 
			
		||||
  when: keystone_in_eventlet.stdout|int == 0
 | 
			
		||||
 | 
			
		||||
- name: Set keystone_deployment variable to eventlet
 | 
			
		||||
  set_fact: openstack_keystone_deployment='eventlet'
 | 
			
		||||
  when: keystone_in_eventlet.stdout|int > 0
 | 
			
		||||
 | 
			
		||||
- name: Determine number of keystone admin processes for httpd
 | 
			
		||||
  shell: grep processes /etc/httpd/conf.d/10-keystone_wsgi_admin.conf | awk '{print $5}'| awk -F= '{print $2}'
 | 
			
		||||
  register: keystone_admin_worker_processes
 | 
			
		||||
  when: keystone_in_eventlet.stdout|int == 0
 | 
			
		||||
 | 
			
		||||
- name: Determine number of keystone admin threads for httpd
 | 
			
		||||
  shell: grep threads /etc/httpd/conf.d/10-keystone_wsgi_admin.conf | awk '{print $6}'| awk -F= '{print $2}'
 | 
			
		||||
  register: keystone_admin_worker_threads
 | 
			
		||||
  when: keystone_in_eventlet.stdout|int == 0
 | 
			
		||||
 | 
			
		||||
- name: Determine number of keystone main threads for httpd
 | 
			
		||||
  shell: grep threads /etc/httpd/conf.d/10-keystone_wsgi_main.conf | awk '{print $6}'| awk -F= '{print $2}'
 | 
			
		||||
  register: keystone_main_worker_threads
 | 
			
		||||
  when: keystone_in_eventlet.stdout|int == 0
 | 
			
		||||
 | 
			
		||||
- name: Determine number of keystone main processes for httpd
 | 
			
		||||
  shell: grep threads /etc/httpd/conf.d/10-keystone_wsgi_main.conf | awk '{print $5}'| awk -F= '{print $2}'
 | 
			
		||||
  register: keystone_main_worker_processes
 | 
			
		||||
  when: keystone_in_eventlet.stdout|int == 0
 | 
			
		||||
 | 
			
		||||
- name: Set keystone httpd worker facts
 | 
			
		||||
  set_fact:
 | 
			
		||||
    openstack_S_keystone_S_admin_workers_S_processes: "{{ keystone_admin_worker_processes.stdout }}"
 | 
			
		||||
    openstack_S_keystone_S_admin_workers_S_threads: "{{ keystone_admin_worker_threads.stdout }}"
 | 
			
		||||
    openstack_S_keystone_S_main_workers_S_processes: "{{ keystone_main_worker_processes.stdout }}"
 | 
			
		||||
    openstack_S_keystone_S_main_workers_S_threads: "{{ keystone_main_worker_threads.stdout }}"
 | 
			
		||||
  when: keystone_in_eventlet.stdout|int == 0
 | 
			
		||||
@@ -1,17 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
#
 | 
			
		||||
# Tasks to get mistral facts
 | 
			
		||||
#
 | 
			
		||||
- name: Parse Mistral config
 | 
			
		||||
  become: true
 | 
			
		||||
  command: python /tmp/openstack-config-parser.py mistral /tmp/out.yml
 | 
			
		||||
  register: mistral_parsed
 | 
			
		||||
  ignore_errors: true
 | 
			
		||||
 | 
			
		||||
- name: Fetch output
 | 
			
		||||
  fetch: src=/tmp/out.yml dest=/tmp/out-{{ inventory_hostname }}.yml flat=yes
 | 
			
		||||
  when: mistral_parsed is succeeded
 | 
			
		||||
 | 
			
		||||
- name: Load configuration variables
 | 
			
		||||
  include_vars: /tmp/out-{{ inventory_hostname }}.yml
 | 
			
		||||
  when: mistral_parsed is succeeded
 | 
			
		||||
@@ -1,34 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Get mysql facts
 | 
			
		||||
#
 | 
			
		||||
  - name: Get max_connections on the database
 | 
			
		||||
    shell: mysql -e "show variables like 'max_connections';" | grep max_connections | awk '{print $2}'
 | 
			
		||||
    register: max_conn
 | 
			
		||||
    ignore_errors: true
 | 
			
		||||
    when: hostvars[inventory_hostname]['containers'] is not defined
 | 
			
		||||
 | 
			
		||||
  - name: Get max_connections on the database
 | 
			
		||||
    shell: docker exec mysql cat /etc/my.cnf.d/galera.cnf| grep max_connections | awk -F ' = ' '{print $2}'
 | 
			
		||||
    register: max_conn_container
 | 
			
		||||
    ignore_errors: true
 | 
			
		||||
    when: hostvars[inventory_hostname]['containers'] is defined
 | 
			
		||||
 | 
			
		||||
  - name: Set max database connections
 | 
			
		||||
    set_fact:
 | 
			
		||||
      openstack_mysql_max_connections: "{{ max_conn.stdout }}"
 | 
			
		||||
    when: hostvars[inventory_hostname]['containers'] is not defined
 | 
			
		||||
 | 
			
		||||
  - name: Set max database connections
 | 
			
		||||
    set_fact:
 | 
			
		||||
      openstack_mysql_max_connections: "{{ max_conn_container.stdout }}"
 | 
			
		||||
    when: hostvars[inventory_hostname]['containers'] is defined
 | 
			
		||||
 | 
			
		||||
  - name : Get file descriptors for the mysql process
 | 
			
		||||
    shell: cat /proc/$(pgrep mysqld_safe)/limits | grep "open files" | awk '{print $4}'
 | 
			
		||||
    register: mysql_desc
 | 
			
		||||
 | 
			
		||||
  - name: Set file descriptors fact for mysql
 | 
			
		||||
    set_fact:
 | 
			
		||||
      openstack_mysql_file_descriptors: "{{ mysql_desc.stdout }}"
 | 
			
		||||
@@ -1,18 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
#
 | 
			
		||||
# Tasks to get neutron facts
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
- name: Parse Neutron config
 | 
			
		||||
  become: true
 | 
			
		||||
  command: python /tmp/openstack-config-parser.py neutron /tmp/out.yml
 | 
			
		||||
  register: neutron_parsed
 | 
			
		||||
  ignore_errors: true
 | 
			
		||||
 | 
			
		||||
- name: Fetch output
 | 
			
		||||
  fetch: src=/tmp/out.yml dest=/tmp/out-{{ inventory_hostname }}.yml flat=yes
 | 
			
		||||
  when: neutron_parsed is succeeded
 | 
			
		||||
 | 
			
		||||
- name: Load configuration variables
 | 
			
		||||
  include_vars: /tmp/out-{{ inventory_hostname }}.yml
 | 
			
		||||
  when: neutron_parsed is succeeded
 | 
			
		||||
@@ -1,18 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
#
 | 
			
		||||
# Tasks to get nova facts
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
- name: Parse Nova config
 | 
			
		||||
  become: true
 | 
			
		||||
  command: python /tmp/openstack-config-parser.py nova /tmp/out.yml
 | 
			
		||||
  register: nova_parsed
 | 
			
		||||
  ignore_errors: true
 | 
			
		||||
 | 
			
		||||
- name: Fetch output
 | 
			
		||||
  fetch: src=/tmp/out.yml dest=/tmp/out-{{ inventory_hostname }}.yml flat=yes
 | 
			
		||||
  when: nova_parsed is succeeded
 | 
			
		||||
 | 
			
		||||
- name: Load configuration variables
 | 
			
		||||
  include_vars: /tmp/out-{{ inventory_hostname }}.yml
 | 
			
		||||
  when: nova_parsed is succeeded
 | 
			
		||||
@@ -1,25 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
#
 | 
			
		||||
# Tasks to set rabbitmq facts for controllers
 | 
			
		||||
#
 | 
			
		||||
  - name : Get rabbitmq file descriptors
 | 
			
		||||
    shell: rabbitmqctl status | grep file_descriptors | awk -F',' '{print $3}' | sed 's/.$//'
 | 
			
		||||
    register: rabbitmq_desc
 | 
			
		||||
    ignore_errors: true
 | 
			
		||||
    when: hostvars[inventory_hostname]['containers'] is not defined
 | 
			
		||||
 | 
			
		||||
  - name : Get rabbitmq file descriptors - containers
 | 
			
		||||
    shell: docker exec rabbitmq rabbitmqctl status | grep total_limit | awk -F',' '{print $2}'| sed 's/.$//'
 | 
			
		||||
    register: rabbitmq_desc_container
 | 
			
		||||
    ignore_errors: true
 | 
			
		||||
    when: hostvars[inventory_hostname]['containers'] is defined
 | 
			
		||||
 | 
			
		||||
  - name: Set rabbitmq file descriptors
 | 
			
		||||
    set_fact:
 | 
			
		||||
      openstack_rabbitmq_file_descriptors: "{{ rabbitmq_desc.stdout }}"
 | 
			
		||||
    when: hostvars[inventory_hostname]['containers'] is not defined
 | 
			
		||||
 | 
			
		||||
  - name: Set rabbitmq file descriptors - containers
 | 
			
		||||
    set_fact:
 | 
			
		||||
      openstack_rabbitmq_file_descriptors: "{{ rabbitmq_desc_container.stdout }}"
 | 
			
		||||
    when: hostvars[inventory_hostname]['containers'] is defined
 | 
			
		||||
@@ -1,75 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
#
 | 
			
		||||
# Tasks to set undercloud facts
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  - name: Check that the undercloud.conf exists
 | 
			
		||||
    become: true
 | 
			
		||||
    stat: path=/home/stack/undercloud.conf
 | 
			
		||||
    register: undercloud_conf
 | 
			
		||||
 | 
			
		||||
  - name: Undercloud.conf
 | 
			
		||||
    become: true
 | 
			
		||||
    command: python /tmp/openstack-config-parser.py undercloud /tmp/out.yml
 | 
			
		||||
    when: undercloud_conf.stat.exists
 | 
			
		||||
 | 
			
		||||
  - name: Fetch output
 | 
			
		||||
    fetch: src=/tmp/out.yml dest=/tmp/out-{{ inventory_hostname }}.yml flat=yes
 | 
			
		||||
    when: undercloud_conf.stat.exists
 | 
			
		||||
 | 
			
		||||
  - name: Load configuration variables
 | 
			
		||||
    include_vars: /tmp/out-{{ inventory_hostname }}.yml
 | 
			
		||||
    when: undercloud_conf.stat.exists
 | 
			
		||||
 | 
			
		||||
  - name: Get max_connections on the database
 | 
			
		||||
    shell: mysql -e "show variables like 'max_connections';" | grep max_connections | awk '{print $2}'
 | 
			
		||||
    register: max_conn
 | 
			
		||||
    ignore_errors: true
 | 
			
		||||
    when: undercloud_conf.stat.exists
 | 
			
		||||
 | 
			
		||||
  - name: Set max database connections
 | 
			
		||||
    set_fact:
 | 
			
		||||
      openstack_mysql_max_connections: "{{ max_conn.stdout }}"
 | 
			
		||||
    when: undercloud_conf.stat.exists
 | 
			
		||||
 | 
			
		||||
  - name : Get file descriptors for the mysql process
 | 
			
		||||
    shell: cat /proc/$(pgrep mysqld_safe)/limits | grep "open files" | awk '{print $4}'
 | 
			
		||||
    register: mysql_desc
 | 
			
		||||
    when: undercloud_conf.stat.exists
 | 
			
		||||
 | 
			
		||||
  - name: Set file descriptors fact for mysql
 | 
			
		||||
    set_fact:
 | 
			
		||||
      openstack_mysql_file_descriptors: "{{ mysql_desc.stdout }}"
 | 
			
		||||
    when: undercloud_conf.stat.exists
 | 
			
		||||
 | 
			
		||||
  - name : Get rabbitmq file descriptors
 | 
			
		||||
    shell: rabbitmqctl status | grep total_limit |  awk -F',' '{print $2}' | sed 's/.$//'
 | 
			
		||||
    register: rabbitmq_desc
 | 
			
		||||
    ignore_errors: true
 | 
			
		||||
    when: undercloud_conf.stat.exists
 | 
			
		||||
 | 
			
		||||
  - name: Set rabbitmq file descriptors
 | 
			
		||||
    set_fact:
 | 
			
		||||
      openstack_rabbitmq_file_descriptors: "{{ rabbitmq_desc.stdout  }}"
 | 
			
		||||
    when: undercloud_conf.stat.exists
 | 
			
		||||
 | 
			
		||||
  - name: Get Controller Nodes number
 | 
			
		||||
    shell: source {{ ansible_env.HOME }}/stackrc; nova list | grep controller | grep ACTIVE | wc -l
 | 
			
		||||
    register: controller_count
 | 
			
		||||
    when: undercloud_conf.stat.exists
 | 
			
		||||
 | 
			
		||||
  - name : Set Controler number fact
 | 
			
		||||
    set_fact:
 | 
			
		||||
      osp_controllers_number: "{{ controller_count.stdout }}"
 | 
			
		||||
    when: undercloud_conf.stat.exists
 | 
			
		||||
 | 
			
		||||
  - name: Get Compute Nodes number
 | 
			
		||||
    shell: source {{ ansible_env.HOME }}/stackrc; nova list | grep compute | grep ACTIVE | wc -l
 | 
			
		||||
    register: compute_count
 | 
			
		||||
    when: undercloud_conf.stat.exists
 | 
			
		||||
 | 
			
		||||
  - name : Set Commpute number fact
 | 
			
		||||
    set_fact:
 | 
			
		||||
      osp_computes_number: "{{ compute_count.stdout }}"
 | 
			
		||||
    when: undercloud_conf.stat.exists
 | 
			
		||||
@@ -1,36 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
- hosts: compute
 | 
			
		||||
  remote_user: "{{ host_remote_user }}"
 | 
			
		||||
  become: true
 | 
			
		||||
  roles:
 | 
			
		||||
    - common
 | 
			
		||||
    - compute
 | 
			
		||||
 | 
			
		||||
- hosts: controller
 | 
			
		||||
  remote_user: "{{ host_remote_user }}"
 | 
			
		||||
  become: true
 | 
			
		||||
  roles:
 | 
			
		||||
    - common
 | 
			
		||||
    - nova
 | 
			
		||||
    - neutron
 | 
			
		||||
    - keystone
 | 
			
		||||
    - ceilometer
 | 
			
		||||
    - gnocchi
 | 
			
		||||
    - cinder
 | 
			
		||||
    - heat
 | 
			
		||||
    - mysql
 | 
			
		||||
    - rabbitmq
 | 
			
		||||
    - glance
 | 
			
		||||
 | 
			
		||||
- hosts: undercloud
 | 
			
		||||
  remote_user: "{{ local_remote_user }}"
 | 
			
		||||
  become: true
 | 
			
		||||
  roles:
 | 
			
		||||
    - common
 | 
			
		||||
    - undercloud
 | 
			
		||||
    - mistral
 | 
			
		||||
 | 
			
		||||
- hosts: browbeat
 | 
			
		||||
  remote_user: "{{ browbeat_user }}"
 | 
			
		||||
  roles:
 | 
			
		||||
    - dump-facts
 | 
			
		||||
		Reference in New Issue
	
	Block a user