Add support for monitoring nodes

Currently these nodes are not deployed using kolla-ansible but use the
host provisioning and host OS configuration pieces of kayobe. The
monasca-deploy project is used to deploy the monitoring services.
This commit is contained in:
Mark Goddard 2017-05-29 16:52:17 +01:00
parent dc7c2d9c6c
commit 27db155c0e
38 changed files with 324 additions and 76 deletions

View File

@ -1,5 +1,5 @@
---
- name: Ensure development tools are installed
hosts: seed:controllers
hosts: seed:overcloud
roles:
- role: dev-tools

View File

@ -3,6 +3,6 @@
# servers but gets in the way after this as it tries to enable all network
# interfaces. In some cases this can lead to timeouts.
- name: Ensure Glean is disabled and its artifacts are removed
hosts: seed:controllers
hosts: seed:overcloud
roles:
- role: disable-glean

View File

@ -1,6 +1,6 @@
---
- name: Disable SELinux and reboot if required
hosts: controllers:seed
hosts: seed:overcloud
roles:
- role: disable-selinux
disable_selinux_reboot_timeout: "{{ 600 if ansible_virtualization_role == 'host' else 300 }}"

View File

@ -1,6 +1,6 @@
---
- name: Ensure that controller BIOS are configured
hosts: controllers
- name: Ensure that overcloud nodes' BIOS are configured
hosts: overcloud
gather_facts: no
vars:
bios_config:

View File

@ -1,6 +1,6 @@
---
- name: Ensure that controller boot order is configured
hosts: controllers
- name: Ensure that overcloud nodes' boot order is configured
hosts: overcloud
gather_facts: no
vars:
ansible_host: "{{ ipmi_address }}"

View File

@ -1,6 +1,6 @@
---
- name: Ensure that controller BIOS are configured
hosts: controllers
- name: Gather and display BIOS and RAID facts from iDRACs
hosts: overcloud
gather_facts: no
roles:
# The role simply pulls in the drac_facts module.

View File

@ -6,6 +6,21 @@
# to setup the Kayobe user account.
controller_bootstrap_user: "{{ lookup('env', 'USER') }}"
###############################################################################
# Controller network interface configuration.
# List of default networks to which controller nodes are attached.
controller_default_network_interfaces: >
{{ [provision_oc_net_name,
provision_wl_net_name,
internal_net_name,
external_net_name,
storage_net_name,
storage_mgmt_net_name] | unique | list }}
# List of extra networks to which controller nodes are attached.
controller_extra_network_interfaces: []
###############################################################################
# Controller node BIOS configuration.

View File

@ -0,0 +1,64 @@
---
###############################################################################
# Monitoring node configuration.
# User with which to access the monitoring nodes via SSH during bootstrap, in
# order to setup the Kayobe user account.
monitoring_bootstrap_user: "{{ controller_bootstrap_user }}"
###############################################################################
# Monitoring node network interface configuration.
# List of default networks to which monitoring nodes are attached.
monitoring_default_network_interfaces: >
{{ [provision_oc_net_name,
internal_net_name,
external_net_name] | unique | list }}
# List of extra networks to which monitoring nodes are attached.
monitoring_extra_network_interfaces: []
###############################################################################
# Monitoring node BIOS configuration.
# Dict of monitoring node BIOS options. Format is same as that used by
# stackhpc.drac role.
monitoring_bios_config: "{{ monitoring_bios_config_default | combine(monitoring_bios_config_extra) }}"
# Dict of default monitoring node BIOS options. Format is same as that used by
# stackhpc.drac role.
monitoring_bios_config_default: "{{ controller_bios_config_default }}"
# Dict of additional monitoring node BIOS options. Format is same as that used
# by stackhpc.drac role.
monitoring_bios_config_extra: "{{ controller_bios_config_extra }}"
###############################################################################
# Monitoring node RAID configuration.
# List of monitoring node RAID volumes. Format is same as that used by
# stackhpc.drac role.
monitoring_raid_config: "{{ monitoring_raid_config_default + monitoring_raid_config_extra }}"
# List of default monitoring node RAID volumes. Format is same as that used by
# stackhpc.drac role.
monitoring_raid_config_default: "{{ controller_raid_config_default }}"
# List of additional monitoring node RAID volumes. Format is same as that used
# by stackhpc.drac role.
monitoring_raid_config_extra: "{{ controller_raid_config_extra }}"
###############################################################################
# Monitoring node LVM configuration.
# List of monitoring node volume groups. See mrlesmithjr.manage-lvm role for
# format.
monitoring_lvm_groups: "{{ monitoring_lvm_groups_default + monitoring_lvm_groups_extra }}"
# Default list of monitoring node volume groups. See mrlesmithjr.manage-lvm
# role for format.
monitoring_lvm_groups_default: "{{ controller_lvm_groups_default }}"
# Additional list of monitoring node volume groups. See mrlesmithjr.manage-lvm
# role for format.
monitoring_lvm_groups_extra: "{{ controller_lvm_groups_extra }}"

View File

@ -0,0 +1,17 @@
---
###############################################################################
# Overcloud configuration.
# Default Ansible group for overcloud hosts if not present in
# overcloud_group_hosts_map.
overcloud_group_default: controllers
# List of names of Ansible groups for overcloud hosts.
overcloud_groups:
- controllers
- monitoring
# Dict mapping overcloud Ansible group names to lists of hosts in the group.
# As a special case, the group 'ignore' can be used to specify hosts that
# should not be added to the inventory.
overcloud_group_hosts_map: {}

View File

@ -1,3 +0,0 @@
---
# Host/IP with which to access the controllers via SSH.
ansible_host: "{{ provision_oc_net_name | net_ip }}"

View File

@ -0,0 +1,7 @@
---
###############################################################################
# Controller node BIOS configuration.
# Dict of monitoring node BIOS options. Format is same as that used by
# stackhpc.drac role.
bios_config: "{{ controller_bios_config }}"

View File

@ -6,15 +6,3 @@
network_interfaces: >
{{ (controller_default_network_interfaces +
controller_extra_network_interfaces) | unique | list }}
# List of default networks to which controller nodes are attached.
controller_default_network_interfaces: >
{{ [provision_oc_net_name,
provision_wl_net_name,
internal_net_name,
external_net_name,
storage_net_name,
storage_mgmt_net_name] | unique | list }}
# List of extra networks to which controller nodes are attached.
controller_extra_network_interfaces: []

View File

@ -0,0 +1,7 @@
---
###############################################################################
# Controller node RAID configuration.
# List of controller node RAID volumes. Format is same as that used by
# stackhpc.drac role.
raid_config: "{{ controller_raid_config }}"

View File

@ -0,0 +1,7 @@
---
# User with which to access the monitoring nodes via SSH.
ansible_user: "{{ kayobe_ansible_user }}"
# User with which to access the monitoring nodes before the kayobe_ansible_user
# account has been created.
bootstrap_user: "{{ monitoring_bootstrap_user }}"

View File

@ -0,0 +1,10 @@
---
###############################################################################
# Monitoring node BIOS configuration.
# Dict of monitoring node BIOS options. Format is same as that used by
# stackhpc.drac role.
bios_config: >
{{ controller_bios_config
if inventory_hostname in groups['controllers'] else
monitoring_bios_config }}

View File

@ -0,0 +1,9 @@
---
###############################################################################
# Monitoring node LVM configuration.
# List of LVM volume groups.
lvm_groups: >
{{ controller_lvm_groups
if inventory_hostname in groups['controllers'] else
monitoring_lvm_groups }}

View File

@ -0,0 +1,11 @@
---
###############################################################################
# Network interface attachments.
# List of networks to which these nodes are attached.
network_interfaces: >
{{ (controller_default_network_interfaces +
controller_extra_network_interfaces) | unique | list
if inventory_hostname in groups['controllers'] else
(monitoring_default_network_interfaces +
monitoring_extra_network_interfaces) | unique | list }}

View File

@ -0,0 +1,10 @@
---
###############################################################################
# Monitoring node RAID configuration.
# List of monitoring node RAID volumes. Format is same as that used by
# stackhpc.drac role.
raid_config: >
{{ controller_raid_config
if inventory_hostname in groups['controllers'] else
monitoring_raid_config }}

View File

@ -0,0 +1,3 @@
---
# Host/IP with which to access the overcloud nodes via SSH.
ansible_host: "{{ provision_oc_net_name | net_ip }}"

View File

@ -1,6 +1,6 @@
---
- name: Ensure IP addresses are allocated
hosts: seed:controllers
hosts: seed:overcloud
gather_facts: no
pre_tasks:
- name: Initialise the IP allocations fact

View File

@ -2,6 +2,6 @@
# Enable IP routing in the kernel.
- name: Ensure IP routing is enabled
hosts: seed:controllers
hosts: seed:overcloud
roles:
- role: ip-routing

View File

@ -1,6 +1,6 @@
---
- name: Ensure the Kayobe Ansible user account exists
hosts: seed:controllers
hosts: seed:overcloud
vars:
ansible_user: "{{ bootstrap_user }}"
tasks:

View File

@ -1,7 +1,7 @@
---
# Update the Bifrost inventory with the IP allocation and other variables.
- name: Ensure the Bifrost controller inventory is initialised
- name: Ensure the Bifrost overcloud inventory is initialised
hosts: seed
gather_facts: no
tasks:
@ -20,8 +20,8 @@
force: True
become: True
- name: Ensure the Bifrost controller inventory is populated
hosts: controllers
- name: Ensure the Bifrost overcloud inventory is populated
hosts: overcloud
gather_facts: no
vars:
seed_host: "{{ groups['seed'][0] }}"

View File

@ -1,6 +1,6 @@
---
- name: Ensure LVM configuration is applied
hosts: seed:controllers
hosts: seed:overcloud
pre_tasks:
- name: Fail if the LVM physical disks have not been configured
fail:

View File

@ -1,6 +1,6 @@
---
- name: Ensure networking is configured
hosts: seed:controllers
hosts: seed:overcloud
tags:
- config
vars:

View File

@ -1,6 +1,6 @@
---
- name: Ensure NTP is installed and configured
hosts: seed:controllers
hosts: seed:overcloud
roles:
- role: yatesr.timezone
become: True

View File

@ -6,30 +6,30 @@
# set the ironic nodes' to maintenance mode to prevent ironic from managing
# their power states.
- name: Group controller hosts by their BMC type
hosts: controllers
- name: Group overcloud nodes by their BMC type
hosts: overcloud
gather_facts: no
vars:
# List of BMC types supporting BIOS and RAID configuration.
supported_bmc_types:
- idrac
tasks:
- name: Fail if controller has BIOS and/or RAID configuration and BMC type is not supported
- name: Fail if node has BIOS and/or RAID configuration and BMC type is not supported
fail:
msg: >
Controller has BIOS and/or RAID configuration but BMC type
Node has BIOS and/or RAID configuration but BMC type
{% if bmc_type is undefined %}is not defined{% else %}{{ bmc_type }}
is not supported{% endif %}.
when:
- "{{ controller_bios_config or controller_raid_config }}"
- "{{ bios_config or raid_config }}"
- "{{ bmc_type is undefined or bmc_type not in supported_bmc_types }}"
- name: Group controller hosts by their BMC type
- name: Group overcloud hosts by their BMC type
group_by:
key: "controllers_with_bmcs_of_type_{{ bmc_type | default('unknown') }}"
key: "overcloud_with_bmcs_of_type_{{ bmc_type | default('unknown') }}"
- name: Check whether any changes to controller BIOS and RAID configuration are required
hosts: controllers_with_bmcs_of_type_idrac
- name: Check whether any changes to nodes' BIOS and RAID configuration are required
hosts: overcloud_with_bmcs_of_type_idrac
gather_facts: no
vars:
# Set this to False to avoid rebooting the nodes after configuration.
@ -39,22 +39,22 @@
drac_address: "{{ ipmi_address }}"
drac_username: "{{ ipmi_username }}"
drac_password: "{{ ipmi_password }}"
drac_bios_config: "{{ controller_bios_config }}"
drac_raid_config: "{{ controller_raid_config }}"
drac_bios_config: "{{ bios_config }}"
drac_raid_config: "{{ raid_config }}"
drac_check_mode: True
tasks:
- name: Set a fact about whether the configuration changed
set_fact:
bios_or_raid_change: "{{ drac_result | changed }}"
- name: Ensure that controller BIOS and RAID volumes are configured
hosts: controllers_with_bmcs_of_type_idrac
- name: Ensure that overcloud BIOS and RAID volumes are configured
hosts: overcloud_with_bmcs_of_type_idrac
gather_facts: no
vars:
# Set this to False to avoid rebooting the nodes after configuration.
drac_reboot: True
pre_tasks:
- name: Set the controller nodes' maintenance mode
- name: Set the overcloud nodes' maintenance mode
command: >
docker exec bifrost_deploy
bash -c '. env-vars &&
@ -82,12 +82,12 @@
drac_address: "{{ ipmi_address }}"
drac_username: "{{ ipmi_username }}"
drac_password: "{{ ipmi_password }}"
drac_bios_config: "{{ controller_bios_config }}"
drac_raid_config: "{{ controller_raid_config }}"
drac_bios_config: "{{ bios_config }}"
drac_raid_config: "{{ raid_config }}"
when: "{{ bios_or_raid_change | bool }}"
tasks:
- name: Unset the controller nodes' maintenance mode
- name: Unset the overcloud nodes' maintenance mode
command: >
docker exec bifrost_deploy
bash -c '. env-vars &&

View File

@ -1,10 +1,10 @@
---
# Use bifrost to deprovision the overcloud nodes.
- name: Ensure the overcloud controllers are deprovisioned
hosts: controllers
- name: Ensure the overcloud nodes are deprovisioned
hosts: overcloud
vars:
# Set to False to avoid waiting for the controllers to become active.
# Set to False to avoid waiting for the nodes to become active.
wait_available: True
wait_available_timeout: 600
wait_available_interval: 10

View File

@ -1,10 +1,10 @@
---
# Use bifrost to inspect the overcloud nodes' hardware.
- name: Ensure the overcloud controller hardware is inspected
hosts: controllers
- name: Ensure the overcloud nodes' hardware is inspected
hosts: overcloud
vars:
# Set to False to avoid waiting for the controllers to become active.
# Set to False to avoid waiting for the nodes to become active.
wait_inspected: True
wait_inspected_timeout: 600
wait_inspected_interval: 10
@ -133,7 +133,7 @@
when:
- "{{ wait_inspected | bool }}"
- name: Fail if any of the controllers are not manageable
- name: Fail if any of the nodes are not manageable
fail:
msg: >
Ironic node for {{ inventory_hostname }} is in an unexpected

View File

@ -2,7 +2,7 @@
# Gather an inventory of nodes from the seed's Ironic service. Use this to
# generate an Ansible inventory for Kayobe.
- name: Ensure the controller Ansible inventory is populated
- name: Ensure the overcloud Ansible inventory is populated
hosts: seed
tasks:
- name: Gather the Ironic node inventory using Bifrost
@ -18,20 +18,36 @@
set_fact:
ironic_inventory: "{{ inventory_result.stdout | from_json }}"
- name: Ensure Kayobe controller inventory exists
- name: Ensure Kayobe overcloud inventory exists
local_action:
module: copy
content: |
# Managed by Ansible - do not edit.
# This is the Kayobe controller inventory, autogenerated from the seed
# This is the Kayobe overcloud inventory, autogenerated from the seed
# node's Ironic inventory.
[controllers]
{# Build a list of all hosts with explicit mappings. #}
{% set all_mapped_hosts = [] %}
{% for hosts in overcloud_group_hosts_map.values() %}
{% set _ = all_mapped_hosts.extend(hosts) %}
{% endfor %}
{% set ignore_hosts = overcloud_group_hosts_map.get("ignore", []) %}
{# Add a section for each group. #}
{% for group in overcloud_groups %}
[{{ group }}]
{% set group_hosts = overcloud_group_hosts_map.get(group, []) %}
{% for host in ironic_inventory.baremetal.hosts %}
{% if (host in group_hosts or
(group == overcloud_group_default and host not in all_mapped_hosts))
and host not in ignore_hosts %}
{% set hostvars=ironic_inventory._meta.hostvars[host] %}
{% set ipmi_address=hostvars.driver_info.ipmi_address | default %}
{% set system_vendor=hostvars.extra.system_vendor | default %}
{% set bmc_type=system_vendor | bmc_type_from_system_vendor %}
{{ host }} ipmi_address={{ ipmi_address }} bmc_type={{ bmc_type }}
{% endif %}
{% endfor %}
dest: "{{ kayobe_config_path }}/inventory/controllers"
{% endfor %}
dest: "{{ kayobe_config_path }}/inventory/overcloud"

View File

@ -1,14 +1,14 @@
---
# Use bifrost to provision the overcloud nodes with a base OS.
- name: Ensure the overcloud controllers are provisioned
hosts: controllers
- name: Ensure the overcloud nodes are provisioned
hosts: overcloud
vars:
# Set to False to avoid waiting for the controllers to become active.
# Set to False to avoid waiting for the nodes to become active.
wait_active: True
wait_active_timeout: 600
wait_active_interval: 10
# Set to False to avoid waiting for the controllers to be accessible via
# Set to False to avoid waiting for the nodes to be accessible via
# SSH.
wait_ssh: True
wait_ssh_timeout: 600
@ -133,7 +133,7 @@
with_items:
- "{{ hostvars[groups['seed'][0]].ansible_host }}"
# We execute this only once, allowing the Bifrost Ansible to handle
# multiple controllers.
# multiple nodes.
run_once: True
- name: Wait for the ironic node to become active
@ -171,7 +171,7 @@
- "{{ wait_active | bool }}"
- "{{ initial_provision_state != 'active' }}"
- name: Fail if any of the controllers are not available
- name: Fail if any of the nodes are not available
fail:
msg: >
Ironic node for {{ inventory_hostname }} is in an unexpected
@ -182,7 +182,7 @@
- "{{ initial_provision_state != 'active' }}"
- "{{ final_provision_state != 'active' }}"
- name: Wait for SSH access to the controllers
- name: Wait for SSH access to the nodes
local_action:
module: wait_for
host: "{{ ansible_host }}"

View File

@ -27,8 +27,17 @@ controllers
[compute:children]
[monitoring:children]
controllers
[monitoring]
# These hostnames must be resolvable from your deployment host
{% for monitoring_host in groups['monitoring'] %}
{% set monitoring_hv=hostvars[monitoring_host] %}
{{ monitoring_host }}{% if "ansible_host" in monitoring_hv %} ansible_host={{ monitoring_hv["ansible_host"] }}{% endif %}
{% endfor %}
[monitoring:vars]
ansible_user=kolla
ansible_become=true
[storage:children]
controllers

View File

@ -2,7 +2,7 @@
# Enable SNAT using iptables.
- name: Ensure SNAT is configured
hosts: seed:controllers
hosts: seed:overcloud
vars:
snat_rules:
- interface: "{{ ansible_default_ipv4.interface }}"

View File

@ -7,6 +7,6 @@
# any LVM or file system state from them.
- name: Ensure that all unmounted block devices are wiped
hosts: seed:controllers
hosts: seed:overcloud
roles:
- role: wipe-disks

View File

@ -7,6 +7,13 @@
[controllers]
# Empty group to provide declaration of controllers group.
[monitoring]
# Empty group to provide declaration of monitoring group.
[overcloud:children]
controllers
monitoring
[docker:children]
# Hosts in this group will have Docker installed.
seed

56
etc/kayobe/monitoring.yml Normal file
View File

@ -0,0 +1,56 @@
---
###############################################################################
# Monitoring node configuration.
# User with which to access the monitoring nodes via SSH during bootstrap, in
# order to setup the Kayobe user account.
#monitoring_bootstrap_user:
###############################################################################
# Monitoring node BIOS configuration.
# Dict of monitoring node BIOS options. Format is same as that used by
# stackhpc.drac role.
#monitoring_bios_config:
# Dict of default monitoring node BIOS options. Format is same as that used by
# stackhpc.drac role.
#monitoring_bios_config_default:
# Dict of additional monitoring node BIOS options. Format is same as that used
# by stackhpc.drac role.
#monitoring_bios_config_extra:
###############################################################################
# Monitoring node RAID configuration.
# List of monitoring node RAID volumes. Format is same as that used by
# stackhpc.drac role.
#monitoring_raid_config:
# List of default monitoring node RAID volumes. Format is same as that used by
# stackhpc.drac role.
#monitoring_raid_config_default:
# List of additional monitoring node RAID volumes. Format is same as that used
# by stackhpc.drac role.
#monitoring_raid_config_extra:
###############################################################################
# Monitoring node LVM configuration.
# List of monitoring node volume groups. See mrlesmithjr.manage-lvm role for
# format.
#monitoring_lvm_groups:
# Default list of monitoring node volume groups. See mrlesmithjr.manage-lvm
# role for format.
#monitoring_lvm_groups_default:
# Additional list of monitoring node volume groups. See mrlesmithjr.manage-lvm
# role for format.
#monitoring_lvm_groups_extra:
###############################################################################
# Dummy variable to allow Ansible to accept this file.
workaround_ansible_issue_8743: yes

14
etc/kayobe/overcloud.yml Normal file
View File

@ -0,0 +1,14 @@
---
###############################################################################
# Overcloud configuration.
# Default Ansible group for overcloud hosts.
#overcloud_group_default:
# List of names of Ansible groups for overcloud hosts.
#overcloud_groups:
# Dict mapping overcloud Ansible group names to lists of hosts in the group.
# As a special case, the group 'ignore' can be used to specify hosts that
# should not be added to the inventory.
#overcloud_group_hosts_map:

View File

@ -373,7 +373,8 @@ class OvercloudHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
def take_action(self, parsed_args):
self.app.LOG.debug("Configuring overcloud host OS")
ansible_user = self.run_kayobe_config_dump(
parsed_args, host="controllers[0]", var_name="kayobe_ansible_user")
parsed_args, var_name="kayobe_ansible_user")
ansible_user = ansible_user.values()[0]
playbooks = _build_playbook_list(
"ip-allocation", "ssh-known-host", "kayobe-ansible-user")
if parsed_args.wipe_disks:
@ -381,12 +382,12 @@ class OvercloudHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
playbooks += _build_playbook_list(
"dev-tools", "disable-selinux", "network", "disable-glean", "ntp",
"lvm")
self.run_kayobe_playbooks(parsed_args, playbooks, limit="controllers")
self.run_kayobe_playbooks(parsed_args, playbooks, limit="overcloud")
extra_vars = {"ansible_user": ansible_user}
self.run_kolla_ansible_overcloud(parsed_args, "bootstrap-servers",
extra_vars=extra_vars)
playbooks = _build_playbook_list("kolla-host", "docker")
self.run_kayobe_playbooks(parsed_args, playbooks, limit="controllers")
self.run_kayobe_playbooks(parsed_args, playbooks, limit="overcloud")
class OvercloudServiceDeploy(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,