Add configuration for seed hypervisor

Currently supports configuration of:
- Local networking
- NTP
- Libvirt storage pools and networks
This commit is contained in:
Mark Goddard 2017-08-01 15:05:08 +00:00
parent a82047f14f
commit f76f244a38
11 changed files with 151 additions and 6 deletions

View File

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

View File

@ -0,0 +1,54 @@
---
###############################################################################
# Seed hypervisor network interface configuration.
# List of default networks to which seed hypervisor nodes are attached.
seed_hypervisor_default_network_interfaces: "{{ seed_default_network_interfaces }}"
# List of extra networks to which seed hypervisor nodes are attached.
seed_hypervisor_extra_network_interfaces: "{{ seed_extra_network_interfaces }}"
###############################################################################
# Seed hypervisor libvirt storage pool configuration.
# List of libvirt storage pools for the seed hypervisor.
seed_hypervisor_libvirt_pools:
- "{{ seed_hypervisor_libvirt_pool }}"
# Libvirt storage pool for the seed VM.
seed_hypervisor_libvirt_pool:
name: "{{ seed_hypervisor_libvirt_pool_name }}"
type: dir
capacity: "{{ seed_hypervisor_libvirt_pool_capacity }}"
path: "{{ seed_hypervisor_libvirt_pool_path }}"
mode: "{{ seed_hypervisor_libvirt_pool_mode }}"
owner: "{{ seed_hypervisor_libvirt_pool_owner }}"
group: "{{ seed_hypervisor_libvirt_pool_group }}"
# Name of the libvirt storage pool for the seed VM.
seed_hypervisor_libvirt_pool_name: "default"
# Capacity of the libvirt storage pool for the seed VM.
seed_hypervisor_libvirt_pool_capacity: "{{ 75 * 2**30 }}"
# Directory path of the libvirt storage pool for the seed VM.
seed_hypervisor_libvirt_pool_path: "/var/lib/libvirt/images"
# Directory mode of the libvirt storage pool for the seed VM.
seed_hypervisor_libvirt_pool_mode: 711
# Directory owner of the libvirt storage pool for the seed VM.
seed_hypervisor_libvirt_pool_owner: "root"
# Directory group of the libvirt storage pool for the seed VM.
seed_hypervisor_libvirt_pool_group: "root"
###############################################################################
# Seed hypervisor libvirt network configuration.
# List of libvirt networks for the seed hypervisor.
seed_hypervisor_libvirt_networks: >
{{ network_interfaces |
net_select_bridges |
map('net_libvirt_network') |
list }}

View File

@ -0,0 +1,8 @@
---
###############################################################################
# Network interface attachments.
# List of networks to which these nodes are attached.
network_interfaces: >
{{ (seed_hypervisor_default_network_interfaces +
seed_hypervisor_extra_network_interfaces) | unique | list }}

View File

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

View File

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

View File

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

View File

@ -0,0 +1,7 @@
---
- name: Ensure the libvirt daemon is configured
hosts: seed-hypervisor
roles:
- role: libvirt-host
libvirt_host_pools: "{{ seed_hypervisor_libvirt_pools }}"
libvirt_host_networks: "{{ seed_hypervisor_libvirt_networks }}"

View File

@ -40,6 +40,23 @@ The ``--enable-discovery`` argument enables a one-time configuration of ports
attached to baremetal compute nodes to support hardware discovery via ironic
inspector.
Seed Hypervisor
===============
.. note::
It is not necessary to run the seed services in a VM. To use an existing
bare metal host or a VM provisioned outside of Kayobe, this section may be
skipped.
Host Configuration
------------------
To configure the seed hypervisor's host OS, and the Libvirt/KVM virtualisation
support::
(kayobe-venv) $ kayobe seed hypervisor host configure
Seed
====
@ -48,7 +65,7 @@ VM Provisioning
.. note::
It is not necesary to run the seed services in a VM. To use an existing
It is not necessary to run the seed services in a VM. To use an existing
bare metal host or a VM provisioned outside of Kayobe, this step may be
skipped. Ensure that the Ansible inventory contains a host for the seed.

View File

@ -0,0 +1,46 @@
---
###############################################################################
# Seed hypervisor network interface configuration.
# List of default networks to which seed hypervisor nodes are attached.
#seed_hypervisor_default_network_interfaces:
# List of extra networks to which seed hypervisor nodes are attached.
#seed_hypervisor_extra_network_interfaces:
###############################################################################
# Seed hypervisor libvirt storage pool configuration.
# List of libvirt storage pools for the seed hypervisor.
#seed_hypervisor_libvirt_pools:
# Libvirt storage pool for the seed VM.
#seed_hypervisor_libvirt_pool:
# Name of the libvirt storage pool for the seed VM.
#seed_hypervisor_libvirt_pool_name:
# Capacity of the libvirt storage pool for the seed VM.
#seed_hypervisor_libvirt_pool_capacity:
# Directory path of the libvirt storage pool for the seed VM.
#seed_hypervisor_libvirt_pool_path:
# Directory mode of the libvirt storage pool for the seed VM.
#seed_hypervisor_libvirt_pool_mode:
# Directory owner of the libvirt storage pool for the seed VM.
#seed_hypervisor_libvirt_pool_owner:
# Directory group of the libvirt storage pool for the seed VM.
#seed_hypervisor_libvirt_pool_group:
###############################################################################
# Seed hypervisor libvirt network configuration.
# List of libvirt networks for the seed hypervisor.
#seed_hypervisor_libvirt_networks:
###############################################################################
# Dummy variable to allow Ansible to accept this file.
workaround_ansible_issue_8743: yes

View File

@ -220,6 +220,19 @@ class PhysicalNetworkConfigure(KayobeAnsibleMixin, VaultMixin, Command):
extra_vars=extra_vars)
class SeedHypervisorHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin,
VaultMixin, Command):
"""Configure the seed hypervisor node host OS."""
def take_action(self, parsed_args):
self.app.LOG.debug("Configuring seed hypervisor host OS")
playbooks = _build_playbook_list(
"ip-allocation", "ssh-known-host", "dev-tools", "network", "ntp",
"seed-hypervisor-libvirt-host")
self.run_kayobe_playbooks(parsed_args, playbooks,
limit="seed-hypervisor")
class SeedVMProvision(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
Command):
"""Provision the seed VM."""

View File

@ -41,7 +41,6 @@ setup(
provides=[],
install_requires=open('requirements.txt', 'rt').read().splitlines(),
namespace_packages=[],
packages=find_packages(),
include_package_data=True,
@ -73,6 +72,7 @@ setup(
'playbook_run = kayobe.cli.commands:PlaybookRun',
'seed_container_image_build = kayobe.cli.commands:SeedContainerImageBuild',
'seed_host_configure = kayobe.cli.commands:SeedHostConfigure',
'seed_hypervisor_host_configure = kayobe.cli.commands:SeedHypervisorHostConfigure',
'seed_service_deploy = kayobe.cli.commands:SeedServiceDeploy',
'seed_vm_provision = kayobe.cli.commands:SeedVMProvision',
],