diff --git a/OSP_INSTALL.md b/OSP_INSTALL.md new file mode 100644 index 000000000..0f7aa0257 --- /dev/null +++ b/OSP_INSTALL.md @@ -0,0 +1,142 @@ + +# rpc-maas OSP install docs + +## Download rpc-maas + +``` +git clone https://github.com/rcbops/rpc-maas /opt/rpc-maas +cd /opt/rpc-maas/ +``` + +## Setting up the installer venv + +Ran as root on the director vm. +``` +cd /opt/rpc-maas/ +./scripts/prepare.sh +``` + +## Creating rackspace monitoring entities and agent tokens. + +According to the docs the rackspace-monitoring-agent installation and entity creation is handled by the rackspace cloud engineers. Before continuing on the following must be completed. + +* Entity and agent token creation. + +## Update the rpc-maas config file + +This is the primary config file used for the rpc-maas install. It will vary depending on the environment. Follow the docs to complete the config. +* [Configuring Overrides](https://pages.github.rackspace.com/rpc-internal/docs-rpc/master/rpc-monitoring-internal/monitoring-impl/monitoring-internal.html#step-2-configuring-overrides) + +``` +vi /opt/rpc-maas/user_maas_variables.yml +``` + +* Example: +``` +# MaaS v2 overrides +maas_auth_method: token +maas_api_url: https://monitoring.api.rackspacecloud.com/v1.0/hybrid: +maas_auth_token: +maas_agent_token: +#maas_notification_plan: npManaged +maas_notification_plan: npTechnicalContactsEmail +maas_notification_plan_override: {} +# The entityLabel should based on the 'maas_fqdn_extension', as follows: +# entityLabel == '{{ inventory_hostname }}{{ maas_fqdn_extension }}' +# Refer to the naming convention documentation section for additional details +# +maas_fqdn_extension: "" + +# Define a Unique Environment ID +# If multiple clouds exist on an account, each should have a different value +# +maas_env_identifier: "lab-tnd1" + +# Identify data center requirements for PNM and hardware monitoring +# true = Rackspace DC (RDC) or OpenStack Everywhere deployments +# false = Customer DC (CDC) +# +maas_raxdc: true + +# Release-specific exclusions are now handled dynamically. These +# overrides will likely remain empty. These are included for +# compatibility to remove any remnant host_vars that may have +# existed in the inventory. +maas_excluded_checks: [] +maas_excluded_alarms: [] + +maas_rabbitmq_password: "W9XAvUdM9bPEexa" +maas_swift_accesscheck_password: "7eEmTknw2zyLf8H" + +# Set the OSA/RPCO working directories ONLY if you use non-standard +# directories. If these locations differ from the list below, update and +# uncomment accordingly. +maas_product_dir: /opt/rpc-maas +maas_product_osa_dir: /opt/rpc-maas + +# Set the product type. Valid options are: rpco, osa, or ceph. +# Only set 'osa' if there is no corresponding rpco directory. +maas_env_product: rpco + +# Allow operations that make use of the MaaS API +maas_use_api: true + +# Enable remote lb_api_checks +maas_remote_check: true + +# Enable Dell/HP Hardware monitoring checks +maas_host_check: true + +# Switch the MaaS scheme to https +maas_scheme: https + +# Disable if non-transparent web proxy is preventing raxmon SSL verification +maas_raxmon_ssl_verify: true + +# Set overrides for check period/timeout +maas_check_period_override: + disk_utilisation: 900 + hp-check: 300 + nova_api_local_check: 120 + neutron_api_local_check: 120 +maas_check_timeout_override: + disk_utilisation: 899 + hp-check: 299 + nova_api_local_check: 119 + neutron_api_local_check: 119 + +maas_rabbitmq_user: maas + +local_suffix: ".localdomain" +ansible_nodename: "{{inventory_hostname}}{{local_suffix}}" + +#neutron_plugin_type: ovn +horizon_service_protocol: 'http' +horizon_service_port: '80' + +## OSP17 defaults +undercloud_provisioning_interface: "br_ctlplane" +ansible_user: tripleo-admin +physical_host: "{{ hostvars[inventory_hostname]['ansible_'+provisioning_interface]['ipv4']['address'] }}" +container_address: "{{ internal_api_ip | default(physical_host) }}" + +## OSP17 +deploy_osp: true +maas_stackrc: /home/stack/lab-tnd1rc +overcloud_stack: "lab-tnd1" +overcloud_provisioning_interface: "eno1" +``` + +## Run the install +``` +cd /opt/rpc-maas +. /root/ansible_venv/bin/activate +ansible-playbook -i /opt/rpc-maas/inventory/inventory.py \ + -i /home/stack/tripleo-deploy/undercloud/tripleo-ansible-inventory.yaml \ + -i /home/stack/overcloud-deploy//tripleo-ansible-inventory.yaml \ + -e @/opt/rpc-maas/user_maas_variables.yml \ + -f 75 playbooks/site.yml \ + --ssh-common-args='-o StrictHostKeyChecking=no' \ + --private-key /home/stack/.ssh/id_rsa +deactivate +``` diff --git a/inventory/inventory.py b/inventory/inventory.py new file mode 100755 index 000000000..607d86e01 --- /dev/null +++ b/inventory/inventory.py @@ -0,0 +1,455 @@ +#!/usr/bin/env python3 +import sys +import json +import yaml + + +def read_yaml_file(file_path): + with open(file_path, 'r') as yaml_file: + data = yaml.safe_load(yaml_file) + return data + + +user_maas_variables = read_yaml_file("user_maas_variables.yml") + + +overcloud_variables = read_yaml_file( + f"/home/stack/overcloud-deploy/{user_maas_variables['overcloud_stack']}/{user_maas_variables['overcloud_stack']}-export.yaml") + +overcloud_environment_variable = read_yaml_file( + f"/home/stack/overcloud-deploy/{user_maas_variables['overcloud_stack']}/environment/tripleo-{user_maas_variables['overcloud_stack']}-environment.yaml") + +undercloud_tripleo_ansible_inventory = read_yaml_file( + "/home/stack/tripleo-deploy/undercloud/tripleo-ansible-inventory.yaml") + +inventory_data = { + "glance_api": { + + "children": [ + "Controller" + ] + }, + "rabbitmq_all": { + "children": [ + "Controller" + ] + }, + "neutron_dhcp_agent": { + "children": [ + "neutron_dhcp" + ] + }, + "neutron_server": { + "children": [ + "neutron_api" + ] + }, + "nova_api_os_compute": { + "children": [ + "nova_api" + ] + }, + "rsyslog_all": { + "children": [ + "Controller" + ] + }, + "osds": { + "children": [ + "ceph_osd" + ] + }, + "swift_storage": { + + "children": [ + "Controller" + ] + }, + "utility_all": { + "children": [ + "Undercloud" + ] + }, + "nova_api_metadata": { + "children": [ + "nova_metadata" + ] + }, + "neutron_metadata_agent": { + "children": [ + "neutron_metadata" + ] + }, + "glance_all": { + "children": [ + "glance_api", + "glance_registry_disabled" + ] + }, + "heat_api_cloudwatch_disabled": { + + "children": [ + "Controller" + ] + }, + "rgws": { + "children": [ + "ceph_rgw" + ] + }, + "nova_all": { + "children": [ + "nova_placement", + "nova_conductor", + "nova_metadata", + "nova_consoleauth", + "nova_api", + "nova_migration_target", + "nova_compute", + "nova_scheduler", + "nova_libvirt", + "nova_vnc_proxy" + ] + }, + "nova_console": { + "children": [ + "nova_consoleauth" + ] + }, + "heat_api": { + + "children": [ + "Controller" + ] + }, + "shared-infra_hosts": { + "children": [ + "Controller" + ] + }, + "nova_scheduler": { + + "children": [ + "Controller" + ] + }, + "keystone_all": { + "children": [ + "Controller" + ] + }, + "neutron_metadata": { + + "children": [ + "Controller" + ] + }, + "all": { + "children": [ + "hosts" + ] + }, + "nova_placement": { + + "children": [ + "Controller" + ] + }, + "galera": { + "children": [ + "Controller" + ] + }, + "memcached_all": { + "children": [ + "Controller" + ] + }, + "heat_all": { + "children": [ + "heat_api", + "heat_api_cloudwatch_disabled", + "heat_engine", + "heat_api_cfn" + ] + }, + "ceph_osd": { + + "children": [ + "CephStorage", + "CephStorage_Perf" + ] + }, + "swift_ringbuilder": { + + "children": [ + "Controller" + ] + }, + "nova_api": { + + "children": [ + "Controller" + ] + }, + "swift_all": { + "children": [ + "swift_ringbuilder", + "swift_storage", + "swift_proxy" + ] + }, + "neutron_dhcp": { + + "children": [ + "Controller" + ] + }, + "nova_libvirt": { + + "children": [ + "Compute" + ] + }, + "neutron_all": { + "children": [ + "neutron_metadata", + "neutron_dhcp", + "neutron_plugin_ml2", + "neutron_ovs_agent", + "neutron_api", + "neutron_l3" + ] + }, + "nova_vnc_proxy": { + + "children": [ + "Controller" + ] + }, + "neutron_plugin_ml2": { + + "children": [ + "Compute", + "Controller" + ] + }, + "horizon": { + + "children": [ + "Controller" + ] + }, + "horizon_all": { + "children": [ + "Controller" + ] + }, + "nova_metadata": { + + "children": [ + "Controller" + ] + }, + "heat_engine": { + + "children": [ + "Controller" + ] + }, + "cinder_api": { + + "children": [ + "Controller" + ] + }, + "neutron_l3_agent": { + "children": [ + "neutron_l3" + ] + }, + "cinder_all": { + "children": [ + "cinder_api", + "cinder_volume", + "cinder_scheduler" + ] + }, + "nova_migration_target": { + + "children": [ + "Compute" + ] + }, + "neutron_openvswitch_agent": { + "children": [ + "neutron_ovs_agent" + ] + }, + "glance_registry_disabled": { + + "children": [ + "Controller" + ] + }, + "nova_conductor": { + + "children": [ + "Controller" + ] + }, + "nova_compute": { + "children": [ + "Compute" + ] + }, + "galera_all": { + "children": [ + "Controller" + ], + "vars": { + "galera_root_password": overcloud_variables['parameter_defaults']['MysqlRootPassword'] + } + }, + "neutron_ovs_agent": { + + "children": [ + "Compute", + "Controller" + ] + }, + "swift_proxy": { + + "children": [ + "Controller" + ] + }, + "cinder_scheduler": { + + "children": [ + "Controller" + ] + }, + "neutron_l3": { + + "children": [ + "Controller" + ] + }, + "nova_consoleauth": { + + "children": [ + "Controller" + ] + }, + "cinder_volume": { + + "children": [ + "Controller" + ] + }, + "hosts": { + "children": [ + "overcloud", + "Undercloud" + ] + }, + "overcloud": { + "children": [ + "CephStorage", + "CephStorage_Perf", + "Compute", + "Controller" + ], + "vars": { + "provisioning_interface": user_maas_variables['overcloud_provisioning_interface'], + "internal_lb_vip_address": overcloud_environment_variable['parameter_defaults']['VipPortMap']['internal_api']['ip_address'], + "external_lb_vip_address": overcloud_environment_variable['parameter_defaults']['VipPortMap']['external']['ip_address'] + } + }, + "mons": { + "children": [ + "ceph_mon" + ] + }, + "mons": { + "children": [ + "ceph_mon" + ] + }, + "neutron_linuxbridge_agent": { + "children": [ + "neutron_ovs_agent" + ] + }, + "neutron_api": { + + "children": [ + "Controller" + ] + }, + "heat_api_cfn": { + "children": [ + "Controller" + ] + }, + "undercloud": { + "children": [ + "Undercloud" + ], + "vars": { + "provisioning_interface": user_maas_variables['undercloud_provisioning_interface'], + "internal_lb_vip_address": undercloud_tripleo_ansible_inventory['Undercloud']['hosts']['undercloud']['ctlplane_ip'], + "external_lb_vip_address": undercloud_tripleo_ansible_inventory['Undercloud']['hosts']['undercloud']['external_ip'] + } + } +} + + +def list_hosts(): + hosts = { + "_meta": { + "hostvars": {} + }, + "all": { + "children": [] + } + } + + for group, group_data in inventory_data.items(): + hosts[group] = { + "children": group_data.get("children", []) + } + + if "vars" in group_data: + hosts[group]["vars"] = group_data["vars"] + + print(json.dumps(hosts, indent=4)) + + +def host_details(hostname): + host_vars = {} + for group, group_data in inventory_data.items(): + if hostname in group_data.get("children", []) or group == hostname: + host_vars.update(group_data.get("vars", {})) + + if host_vars: + print(json.dumps(host_vars, indent=4)) + else: + print(f"No details found for host {hostname}") + + +if __name__ == "__main__": + if len(sys.argv) > 1: + if sys.argv[1] == "--list": + list_hosts() + elif sys.argv[1] == "--host": + if len(sys.argv) > 2: + host_details(sys.argv[2]) + else: + print("Please provide a hostname with --host option") + else: + print("Invalid option. Use --list or --host") + else: + print("Please provide an option --list or --host") + diff --git a/playbooks/common-tasks/maas-venv-create.yml b/playbooks/common-tasks/maas-venv-create.yml index 3c1c0640d..b13bf7f19 100644 --- a/playbooks/common-tasks/maas-venv-create.yml +++ b/playbooks/common-tasks/maas-venv-create.yml @@ -18,14 +18,6 @@ src: "files/pip-constraints.txt" dest: "/tmp/pip-constraints.txt" -- name: Install required pip packages - package: - name: "{{ maas_agent_distro_packages }}" - register: install_packages - until: install_packages is success - retries: 5 - delay: 2 - - name: Check for pip.conf stat: path: /root/.pip/pip.conf @@ -38,14 +30,14 @@ - pip_conf.stat.exists | bool - name: Create MaaS venv - command: "virtualenv -p {{ ansible_python.executable }} {{ target_venv | default(maas_venv) }}" + command: "python3 -m venv virtualenv-3 {{ target_venv | default(maas_venv) }}" args: creates: "{{ target_venv | default(maas_venv) }}/bin/python" when: - not ansible_local['maas']['general']['deploy_osp'] | bool - name: Create MaaS venv (--system-site-packages) - command: "virtualenv -p {{ ansible_python.executable }} --system-site-packages {{ target_venv | default(maas_venv) }}" + command: "python3 -m venv --system-site-packages {{ target_venv | default(maas_venv) }}" args: creates: "{{ target_venv | default(maas_venv) }}/bin/python" when: @@ -133,4 +125,4 @@ command: mv /root/.pip/pip.conf.bak_maas /root/.pip/pip.conf when: - pip_conf_temp.stat.exists is defined - - pip_conf_temp.stat.exists | bool + - pip_conf_temp.stat.exists | bool \ No newline at end of file diff --git a/playbooks/files/rax-maas/plugins/maas_common.py b/playbooks/files/rax-maas/plugins/maas_common.py index 7dbc92eeb..df7da5713 100755 --- a/playbooks/files/rax-maas/plugins/maas_common.py +++ b/playbooks/files/rax-maas/plugins/maas_common.py @@ -95,7 +95,8 @@ def build_sdk_connection(): if os.path.exists(OPENRC) or os.path.exists(STACKRC): try: - sdk_conn = connect(cloud=AUTH_DETAILS.get('OS_CLOUDNAME'), verify=False) + sdk_conn = connect(cloud=AUTH_DETAILS.get( + 'OS_CLOUDNAME'), verify=False) except MissingRequiredOptions as e: raise e diff --git a/playbooks/files/rax-maas/tools/rpc-maas-tool.py b/playbooks/files/rax-maas/tools/rpc-maas-tool.py index 7279f055b..d58c255ae 100644 --- a/playbooks/files/rax-maas/tools/rpc-maas-tool.py +++ b/playbooks/files/rax-maas/tools/rpc-maas-tool.py @@ -34,6 +34,12 @@ from rackspace_monitoring.types import Provider import alarmparser +import certifi + +cafile = certifi.where() + +with open(cafile, 'r') as f: + ca_certificates = f.read() DEFAULT_CONFIG_FILE = '/root/.raxrc' logging.basicConfig(level=logging.DEBUG, @@ -100,6 +106,7 @@ def _get_conn(self): user = self.config.get('credentials', 'username') api_key = self.config.get('credentials', 'api_key') self.conn = self.driver(user, api_key) + print(user, api_key) except (configparser.NoSectionError, configparser.NoOptionError): url = self.config.get('api', 'url') token = self.config.get('api', 'token') @@ -215,6 +222,7 @@ class RpcMaasAgentConfig(object): Parse them as yaml and store that. """ + def __init__(self, agentconfdpath): self.agentconfdpath = agentconfdpath self.checks = self._parse_maas_configs() @@ -241,6 +249,7 @@ def _parse_config_file(self, path): class RpcMassCli(object): """CLI interface for RPC Maas""" + def __init__(self): self.parse_args() LOGGER.addHandler(logging.FileHandler(self.args.logfile)) diff --git a/playbooks/library/gather_disk_device_facts b/playbooks/library/gather_disk_device_facts index 1d5951e32..674c8e31b 100644 --- a/playbooks/library/gather_disk_device_facts +++ b/playbooks/library/gather_disk_device_facts @@ -42,9 +42,8 @@ class DiskDeviceFacts(object): """Get disk device facts on a host""" if venv_bin is not None: - activate_this = '%s/activate_this.py' % (venv_bin) - exec(open(activate_this).read(), dict(__file__=activate_this)) - + activate_this = '%s/activate' % (venv_bin) + subprocess.call(['bash', '-c', f'source {activate_this}']) # We place these imports after we activate the virtualenv to ensure # we're importing the correct libraries import psutil diff --git a/playbooks/library/raxmon.py b/playbooks/library/raxmon.py index 311821bd0..5a474091d 100644 --- a/playbooks/library/raxmon.py +++ b/playbooks/library/raxmon.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python3 # Copyright 2017, Rackspace US, Inc. # @@ -15,7 +14,7 @@ # limitations under the License. import configparser - +import subprocess from ansible.module_utils.basic import * # noqa: ignore=H303 @@ -258,9 +257,8 @@ def main(): ) if module.params['venv_bin']: - activate_this = '%s/activate_this.py' % (module.params['venv_bin']) - exec(open(activate_this).read(), dict(__file__=activate_this)) - + activate_this = '%s/activate' % (module.params['venv_bin']) + subprocess.call(['bash', '-c', f'source {activate_this}']) # We place these imports after we activate the virtualenv to ensure we're # importing the correct libraries diff --git a/playbooks/maas-host-kernel.yml b/playbooks/maas-host-kernel.yml index 42d0564fe..557ea6ad5 100644 --- a/playbooks/maas-host-kernel.yml +++ b/playbooks/maas-host-kernel.yml @@ -36,6 +36,7 @@ - name: Install checks for hosts kernel hosts: hosts:mons:mgrs:osds:rgws:grafana-server gather_facts: true + become: true pre_tasks: - name: Check nf_conntrack status stat: diff --git a/playbooks/maas-openstack-ironic.yml b/playbooks/maas-openstack-ironic.yml index 1ca2a9ca7..1571ed128 100644 --- a/playbooks/maas-openstack-ironic.yml +++ b/playbooks/maas-openstack-ironic.yml @@ -16,7 +16,7 @@ - name: Install checks for openstack ironic-api hosts: ironic_api gather_facts: true - user: "{{ ansible_ssh_user | default('root') }}" + user: "{{ ansible_user | default('root') }}" become: true pre_tasks: - name: Refresh local facts @@ -83,7 +83,7 @@ - name: Install checks for openstack ironic-conductor hosts: ironic_conductor gather_facts: true - user: "{{ ansible_ssh_user | default('root') }}" + user: "{{ ansible_user | default('root') }}" become: true pre_tasks: - include_tasks: "common-tasks/maas_excluded_regex.yml" @@ -110,7 +110,7 @@ - name: Install checks for openstack ironic-compute hosts: ironic_compute gather_facts: true - user: "{{ ansible_ssh_user | default('root') }}" + user: "{{ ansible_user | default('root') }}" become: true pre_tasks: - include_tasks: "common-tasks/maas_excluded_regex.yml" @@ -133,4 +133,4 @@ environment: "{{ deployment_environment_variables | default({}) }}" tags: - - maas-openstack-ironic + - maas-openstack-ironic \ No newline at end of file diff --git a/playbooks/maas-sdk-integration.yml b/playbooks/maas-sdk-integration.yml index 9fbff1a11..faccf5dd2 100644 --- a/playbooks/maas-sdk-integration.yml +++ b/playbooks/maas-sdk-integration.yml @@ -17,6 +17,8 @@ hosts: localhost gather_facts: true become: true + vars: + internal_lb_vip_address: "{{ hostvars['undercloud']['internal_lb_vip_address'] }}" pre_tasks: - name: Refresh local facts setup: @@ -181,6 +183,8 @@ become: true vars: ansible_python_interpreter: "{{ target_venv | default(maas_venv) }}/bin/python" + internal_lb_vip_address: "{{ hostvars['undercloud']['internal_lb_vip_address'] }}" + external_lb_vip_address: "{{ hostvars['undercloud']['external_lb_vip_address'] }}" tasks: - name: Determine endpoint components service_discovery: diff --git a/playbooks/templates/rax-maas/cinder_backup_check.yaml.j2 b/playbooks/templates/rax-maas/cinder_backup_check.yaml.j2 index cce13036c..6ad1dba35 100644 --- a/playbooks/templates/rax-maas/cinder_backup_check.yaml.j2 +++ b/playbooks/templates/rax-maas/cinder_backup_check.yaml.j2 @@ -1,7 +1,7 @@ {% from "templates/common/macros.jinja" import get_metadata with context %} {% set label = "cinder_backup_check" %} {% set check_name = label+'--'+inventory_hostname %} -{% set service_host = ansible_nodename + ansible_local['maas']['general']['local_suffix'] | default('') %} +{% set service_host = ansible_fqdn %} type : agent.plugin label : "{{ check_name }}" period : "{{ maas_check_period_override[label] | default(maas_check_period) }}" diff --git a/playbooks/templates/rax-maas/ironic_compute_check.yaml.j2 b/playbooks/templates/rax-maas/ironic_compute_check.yaml.j2 index 25f141842..683d083dd 100644 --- a/playbooks/templates/rax-maas/ironic_compute_check.yaml.j2 +++ b/playbooks/templates/rax-maas/ironic_compute_check.yaml.j2 @@ -1,7 +1,7 @@ {% from "templates/common/macros.jinja" import get_metadata with context %} {% set label = "ironic_compute_check" %} {% set check_name = label+'--'+inventory_hostname %} -{% set service_host = ansible_nodename + ansible_local['maas']['general']['local_suffix'] | default('') %} +{% set service_host = ansible_fqdn %} type : agent.plugin label : "{{ check_name }}" period : "{{ maas_check_period_override[label] | default(maas_check_period) }}" diff --git a/playbooks/templates/rax-maas/neutron_dhcp_agent_check.yaml.j2 b/playbooks/templates/rax-maas/neutron_dhcp_agent_check.yaml.j2 index 2eb2dfd1e..595f4888b 100644 --- a/playbooks/templates/rax-maas/neutron_dhcp_agent_check.yaml.j2 +++ b/playbooks/templates/rax-maas/neutron_dhcp_agent_check.yaml.j2 @@ -1,7 +1,7 @@ {% from "templates/common/macros.jinja" import get_metadata with context %} {% set label = "neutron_dhcp_agent_check" %} {% set check_name = label+'--'+inventory_hostname %} -{% set service_host = ansible_nodename + ansible_local['maas']['general']['local_suffix'] | default('') %} +{% set service_host = ansible_fqdn %} type : agent.plugin label : "{{ check_name }}" period : "{{ maas_check_period_override[label] | default(maas_check_period) }}" diff --git a/playbooks/templates/rax-maas/neutron_l3_agent_check.yaml.j2 b/playbooks/templates/rax-maas/neutron_l3_agent_check.yaml.j2 index 5339675a7..483ef6e83 100644 --- a/playbooks/templates/rax-maas/neutron_l3_agent_check.yaml.j2 +++ b/playbooks/templates/rax-maas/neutron_l3_agent_check.yaml.j2 @@ -1,7 +1,7 @@ {% from "templates/common/macros.jinja" import get_metadata with context %} {% set label = "neutron_l3_agent_check" %} {% set check_name = label+'--'+inventory_hostname %} -{% set service_host = ansible_nodename + ansible_local['maas']['general']['local_suffix'] | default('') %} +{% set service_host = ansible_fqdn %} type : agent.plugin label : "{{ check_name }}" period : "{{ maas_check_period_override[label] | default(maas_check_period) }}" diff --git a/playbooks/templates/rax-maas/neutron_linuxbridge_agent_check.yaml.j2 b/playbooks/templates/rax-maas/neutron_linuxbridge_agent_check.yaml.j2 index c7a639c37..d9e03f22b 100644 --- a/playbooks/templates/rax-maas/neutron_linuxbridge_agent_check.yaml.j2 +++ b/playbooks/templates/rax-maas/neutron_linuxbridge_agent_check.yaml.j2 @@ -1,7 +1,7 @@ {% from "templates/common/macros.jinja" import get_metadata with context %} {% set label = "neutron_linuxbridge_agent_check" %} {% set check_name = label+'--'+inventory_hostname %} -{% set service_host = ansible_nodename + ansible_local['maas']['general']['local_suffix'] | default('') %} +{% set service_host = ansible_fqdn %} type : agent.plugin label : "{{ check_name }}" period : "{{ maas_check_period_override[label] | default(maas_check_period) }}" diff --git a/playbooks/templates/rax-maas/neutron_metadata_agent_check.yaml.j2 b/playbooks/templates/rax-maas/neutron_metadata_agent_check.yaml.j2 index cf7e68aed..1282ee78e 100644 --- a/playbooks/templates/rax-maas/neutron_metadata_agent_check.yaml.j2 +++ b/playbooks/templates/rax-maas/neutron_metadata_agent_check.yaml.j2 @@ -1,7 +1,7 @@ {% from "templates/common/macros.jinja" import get_metadata with context %} {% set label = "neutron_metadata_agent_check" %} {% set check_name = label+'--'+inventory_hostname %} -{% set service_host = ansible_nodename + ansible_local['maas']['general']['local_suffix'] | default('') %} +{% set service_host = ansible_fqdn %} type : agent.plugin label : "{{ check_name }}" period : "{{ maas_check_period_override[label] | default(maas_check_period) }}" diff --git a/playbooks/templates/rax-maas/neutron_metadata_proxy_check.yaml.j2 b/playbooks/templates/rax-maas/neutron_metadata_proxy_check.yaml.j2 index e5c4d9468..59a3ca8b4 100644 --- a/playbooks/templates/rax-maas/neutron_metadata_proxy_check.yaml.j2 +++ b/playbooks/templates/rax-maas/neutron_metadata_proxy_check.yaml.j2 @@ -1,7 +1,7 @@ {% from "templates/common/macros.jinja" import get_metadata with context %} {% set label = "neutron_metadata_proxy_check" %} {% set check_name = label+'--'+inventory_hostname %} -{% set service_host = ansible_nodename + ansible_local['maas']['general']['local_suffix'] | default('') %} +{% set service_host = ansible_fqdn %} type : agent.plugin label : "{{ check_name }}" period : "{{ maas_check_period_override[label] | default(maas_check_period) }}" diff --git a/playbooks/templates/rax-maas/neutron_metering_agent_check.yaml.j2 b/playbooks/templates/rax-maas/neutron_metering_agent_check.yaml.j2 index b930d3d38..b4efc16f9 100644 --- a/playbooks/templates/rax-maas/neutron_metering_agent_check.yaml.j2 +++ b/playbooks/templates/rax-maas/neutron_metering_agent_check.yaml.j2 @@ -1,7 +1,7 @@ {% from "templates/common/macros.jinja" import get_metadata with context %} {% set label = "neutron_metering_agent_check" %} {% set check_name = label+'--'+inventory_hostname %} -{% set service_host = ansible_nodename + ansible_local['maas']['general']['local_suffix'] | default('') %} +{% set service_host = ansible_fqdn %} type : agent.plugin label : "{{ check_name }}" period : "{{ maas_check_period_override[label] | default(maas_check_period) }}" diff --git a/playbooks/templates/rax-maas/neutron_ovs_agent_check.yaml.j2 b/playbooks/templates/rax-maas/neutron_ovs_agent_check.yaml.j2 index 396561e93..303cbea92 100644 --- a/playbooks/templates/rax-maas/neutron_ovs_agent_check.yaml.j2 +++ b/playbooks/templates/rax-maas/neutron_ovs_agent_check.yaml.j2 @@ -1,7 +1,7 @@ {% from "templates/common/macros.jinja" import get_metadata with context %} {% set label = "neutron_ovs_agent_check" %} {% set check_name = label+'--'+inventory_hostname %} -{% set service_host = ansible_nodename + ansible_local['maas']['general']['local_suffix'] | default('') %} +{% set service_host = ansible_fqdn %} type : agent.plugin label : "{{ check_name }}" period : "{{ maas_check_period_override[label] | default(maas_check_period) }}" diff --git a/playbooks/templates/rax-maas/nova_cert_check.yaml.j2 b/playbooks/templates/rax-maas/nova_cert_check.yaml.j2 index bd4820188..a817da9ab 100644 --- a/playbooks/templates/rax-maas/nova_cert_check.yaml.j2 +++ b/playbooks/templates/rax-maas/nova_cert_check.yaml.j2 @@ -1,7 +1,7 @@ {% from "templates/common/macros.jinja" import get_metadata with context %} {% set label = "nova_cert_check" %} {% set check_name = label+'--'+inventory_hostname %} -{% set service_host = ansible_nodename + ansible_local['maas']['general']['local_suffix'] | default('') %} +{% set service_host = ansible_fqdn %} type : agent.plugin label : "{{ check_name }}" period : "{{ maas_check_period_override[label] | default(maas_check_period) }}" diff --git a/playbooks/templates/rax-maas/nova_compute_check.yaml.j2 b/playbooks/templates/rax-maas/nova_compute_check.yaml.j2 index aab11203a..becebaf81 100644 --- a/playbooks/templates/rax-maas/nova_compute_check.yaml.j2 +++ b/playbooks/templates/rax-maas/nova_compute_check.yaml.j2 @@ -1,7 +1,7 @@ {% from "templates/common/macros.jinja" import get_metadata with context %} {% set label = "nova_compute_check" %} {% set check_name = label+'--'+inventory_hostname %} -{% set service_host = ansible_nodename + ansible_local['maas']['general']['local_suffix'] | default('') %} +{% set service_host = ansible_fqdn %} type : agent.plugin label : "{{ check_name }}" period : "{{ maas_check_period_override[label] | default(maas_check_period) }}" diff --git a/playbooks/templates/rax-maas/nova_conductor_check.yaml.j2 b/playbooks/templates/rax-maas/nova_conductor_check.yaml.j2 index b8406818b..0b91d5a74 100644 --- a/playbooks/templates/rax-maas/nova_conductor_check.yaml.j2 +++ b/playbooks/templates/rax-maas/nova_conductor_check.yaml.j2 @@ -1,7 +1,7 @@ {% from "templates/common/macros.jinja" import get_metadata with context %} {% set label = "nova_conductor_check" %} {% set check_name = label+'--'+inventory_hostname %} -{% set service_host = ansible_nodename + ansible_local['maas']['general']['local_suffix'] | default('') %} +{% set service_host = ansible_fqdn %} type : agent.plugin label : "{{ check_name }}" period : "{{ maas_check_period_override[label] | default(maas_check_period) }}" diff --git a/playbooks/templates/rax-maas/nova_consoleauth_check.yaml.j2 b/playbooks/templates/rax-maas/nova_consoleauth_check.yaml.j2 index fbc35f9d1..6ee7fcb16 100644 --- a/playbooks/templates/rax-maas/nova_consoleauth_check.yaml.j2 +++ b/playbooks/templates/rax-maas/nova_consoleauth_check.yaml.j2 @@ -1,7 +1,7 @@ {% from "templates/common/macros.jinja" import get_metadata with context %} {% set label = "nova_consoleauth_check" %} {% set check_name = label+'--'+inventory_hostname %} -{% set service_host = ansible_nodename + ansible_local['maas']['general']['local_suffix'] | default('') %} +{% set service_host = ansible_fqdn %} type : agent.plugin label : "{{ check_name }}" period : "{{ maas_check_period_override[label] | default(maas_check_period) }}" diff --git a/playbooks/templates/rax-maas/nova_scheduler_check.yaml.j2 b/playbooks/templates/rax-maas/nova_scheduler_check.yaml.j2 index 32d7f4c8a..3bd20afcb 100644 --- a/playbooks/templates/rax-maas/nova_scheduler_check.yaml.j2 +++ b/playbooks/templates/rax-maas/nova_scheduler_check.yaml.j2 @@ -1,7 +1,7 @@ {% from "templates/common/macros.jinja" import get_metadata with context %} {% set label = "nova_scheduler_check" %} {% set check_name = label+'--'+inventory_hostname %} -{% set service_host = ansible_nodename + ansible_local['maas']['general']['local_suffix'] | default('') %} +{% set service_host = ansible_fqdn %} type : agent.plugin label : "{{ check_name }}" period : "{{ maas_check_period_override[label] | default(maas_check_period) }}" diff --git a/playbooks/templates/rax-maas/rabbitmq_status.yaml.j2 b/playbooks/templates/rax-maas/rabbitmq_status.yaml.j2 index 9ab4ab720..0f0be676e 100644 --- a/playbooks/templates/rax-maas/rabbitmq_status.yaml.j2 +++ b/playbooks/templates/rax-maas/rabbitmq_status.yaml.j2 @@ -8,7 +8,7 @@ timeout : "{{ maas_check_timeout_override[label] | default(maas_check_timeou disabled : "{{ (inventory_hostname != groups['rabbitmq_all'][0] or check_name | regex_search(maas_excluded_checks_regex)) | ternary('true', 'false') }}" details : file : run_plugin_in_venv.sh - args : ["{{ maas_plugin_dir }}/rabbitmq_status.py", "-H", "{{ rabbit_local_address | default(container_address | default(internal_api_ip | default(ansible_host))) }}", "-n", "{{ ansible_hostname.split('.')[0] }}", "-U", "{{ maas_rabbitmq_user }}", "-p", "{{ maas_rabbitmq_password }}", "--{{ rabbitmq_http_protocol }}"] + args : ["{{ maas_plugin_dir }}/rabbitmq_status.py", "-H", "{{ rabbit_local_address | default(container_address | default(internal_api_ip | default(ansible_host))) }}", "-n", "{{ ansible_hostname }}.internalapi.{{ ansible_domain }}", "-U", "{{ maas_rabbitmq_user }}", "-p", "{{ maas_rabbitmq_password }}", "--{{ rabbitmq_http_protocol }}"] timeout : {{ (maas_check_timeout_override[label] | default(maas_check_timeout) * 1000) }} {{ get_metadata(label).strip() }} {# Add extra metadata options with two leading white spaces #} diff --git a/playbooks/vars/maas-redhat.yml b/playbooks/vars/maas-redhat.yml index 9439b9f7d..c59ab2e88 100644 --- a/playbooks/vars/maas-redhat.yml +++ b/playbooks/vars/maas-redhat.yml @@ -43,11 +43,11 @@ maas_extra_distro_packages: [] # maas_repos: main: - repo: "http://stable.packages.cloudmonitoring.rackspace.com/redhat-{{ ansible_distribution_major_version | lower }}-x86_64/" + repo: "http://stable.packages.cloudmonitoring.rackspace.com/redhat-8-x86_64/" state: "present" enabled: "yes" poller: - repo: "http://stable.poller.packages.cloudmonitoring.rackspace.com/redhat-{{ ansible_distribution_major_version | lower }}-x86_64/" + repo: "http://stable.poller.packages.cloudmonitoring.rackspace.com/redhat-8-x86_64/" state: "present" enabled: "yes" @@ -67,6 +67,6 @@ maas_rabbitmq_distro_packages: # # Rally specific packages needed -# +# maas_rally_distro_packages: - - python3-PyMySQL + - python3-PyMySQL \ No newline at end of file diff --git a/scripts/prepare.sh b/scripts/prepare.sh index 2d362d123..9f5ff5c9a 100755 --- a/scripts/prepare.sh +++ b/scripts/prepare.sh @@ -1,25 +1,29 @@ #!/bin/bash -egrep -i 'Centos|RedHat' /etc/redhat-release 2>/dev/null && isRH=1 +egrep -i 'Centos|Red Hat' /etc/redhat-release 2>/dev/null && isRH=1 # Install some dependancies if [ $isRH ]; then - rpm -qi python3-pip python3-virtualenv > /dev/null - test $? -ne 0 && dnf -y install python3-pip python3-virtualenv + echo "Notes: + - Make sure OSP repositories are enabled on all the nodes. + - Please read the documentation and update /opt/rpc-maas/user_maas_variables.yml config file and set up any entities and agents as needed. + " - # Update the python alternatives if needed - if [ ! -e /usr/bin/python ]; then - alternatives --set python /usr/bin/python3 - fi + # Install some dependancies + rpm -qi python3-pip > /dev/null + if [ $? != 0 ]; then + dnf -y install python3-pip + fi else - apt install -y python3-pip virtualenv + apt install -y python3-pip fi # Create the virtual environment -if [ ! -d /root/ansible_venv ] || [ ! -f /root/ansible_venv/bin/python3 ]; then +if [ ! -d /root/ansible_venv ]; then + # Set up the python virtual env - rm -rf /root/ansible_venv - virtualenv -p /usr/bin/python3 /root/ansible_venv --system-site-packages + python3 -m venv --system-site-packages /root/ansible_venv + fi # Install required packages @@ -44,19 +48,12 @@ if [[ "$PUBCLOUD_USERNAME" != "" ]] && [[ "$PUBCLOUD_API_KEY" != "" ]] && [[ "$P fi fi -# Bomb if the /home/stack/user_maas_variables.yml doesn't exist. -if [ ! -e /home/stack/user_maas_variables.yml ]; then - echo - echo "Please read the documentation and create the /home/stack/user_maas_variables.yml config file and set up any entities and agents as needed." - echo -fi - echo echo "Example Playbook Usage Post Configuration: cd /opt/rpc-maas/ . /root/ansible_venv/bin/activate" if [ $isRH ]; then - echo "ansible-playbook -i /opt/rpc-maas/inventory/rpcr_dynamic_inventory.py -e @/home/stack/user_maas_variables.yml playbooks/site.yml" + echo "ansible-playbook -i /opt/rpc-maas/inventory/inventory.py -i /home/stack/tripleo-deploy/undercloud/tripleo-ansible-inventory.yaml -i /home/stack/overcloud-deploy//tripleo-ansible-inventory.yaml -e @/opt/rpc-maas/user_maas_variables.yml -f 75 playbooks/site.yml --ssh-common-args='-o StrictHostKeyChecking=no' --private-key /home/stack/.ssh/id_rsa" else echo ". /usr/local/bin/openstack-ansible.rc" echo "# When present add the Ceph inventory to update the maas checks on" diff --git a/user_maas_variables.yml b/user_maas_variables.yml new file mode 100755 index 000000000..1fe9543ce --- /dev/null +++ b/user_maas_variables.yml @@ -0,0 +1,92 @@ +# MaaS v2 overrides +maas_auth_method: token +maas_api_url: https://monitoring.api.rackspacecloud.com/v1.0/hybrid: +maas_auth_token: +maas_agent_token: +#maas_notification_plan: npManaged +maas_notification_plan: npTechnicalContactsEmail +maas_notification_plan_override: {} +# The entityLabel should based on the 'maas_fqdn_extension', as follows: +# entityLabel == '{{ inventory_hostname }}{{ maas_fqdn_extension }}' +# Refer to the naming convention documentation section for additional details +# +maas_fqdn_extension: "" + +# Define a Unique Environment ID +# If multiple clouds exist on an account, each should have a different value +# +maas_env_identifier: "" + +# Identify data center requirements for PNM and hardware monitoring +# true = Rackspace DC (RDC) or OpenStack Everywhere deployments +# false = Customer DC (CDC) +# +maas_raxdc: true + +# Release-specific exclusions are now handled dynamically. These +# overrides will likely remain empty. These are included for +# compatibility to remove any remnant host_vars that may have +# existed in the inventory. +maas_excluded_checks: [] +maas_excluded_alarms: [] + +maas_rabbitmq_password: "" +maas_swift_accesscheck_password: "" + +# Set the OSA/RPCO working directories ONLY if you use non-standard +# directories. If these locations differ from the list below, update and +# uncomment accordingly. +maas_product_dir: /opt/rpc-maas +maas_product_osa_dir: /opt/rpc-maas + +# Set the product type. Valid options are: rpco, osa, or ceph. +# Only set 'osa' if there is no corresponding rpco directory. +maas_env_product: rpco + +# Allow operations that make use of the MaaS API +maas_use_api: true + +# Enable remote lb_api_checks +maas_remote_check: true + +# Enable Dell/HP Hardware monitoring checks +maas_host_check: true + +# Switch the MaaS scheme to https +maas_scheme: https + +# Disable if non-transparent web proxy is preventing raxmon SSL verification +maas_raxmon_ssl_verify: true + +# Set overrides for check period/timeout +maas_check_period_override: + disk_utilisation: 900 + hp-check: 300 + nova_api_local_check: 120 + neutron_api_local_check: 120 +maas_check_timeout_override: + disk_utilisation: 899 + hp-check: 299 + nova_api_local_check: 119 + neutron_api_local_check: 119 + +maas_rabbitmq_user: maas + +local_suffix: ".localdomain" +ansible_nodename: "{{inventory_hostname}}{{local_suffix}}" + +#neutron_plugin_type: ovn +horizon_service_protocol: 'http' +horizon_service_port: '80' + +## OSP17 defaults +undercloud_provisioning_interface: "br_ctlplane" +ansible_user: tripleo-admin +physical_host: "{{ hostvars[inventory_hostname]['ansible_'+provisioning_interface]['ipv4']['address'] }}" +container_address: "{{ internal_api_ip | default(physical_host) }}" + +## OSP17 +# deploy_osp: true +# maas_stackrc: /home/stack/ +# overcloud_stack: "" +# overcloud_provisioning_interface: ""