Split out group_vars

* Create controllers, hypervisors and libvirt groups for hosts
* Create a 'deploy' playbook for all current constructive actions
This commit is contained in:
Will Miller
2018-08-21 16:57:25 +00:00
parent 72a17aabd1
commit 2a04903e24
6 changed files with 47 additions and 13 deletions

View File

@@ -1,8 +1,13 @@
---
- hosts: all
- hosts: hypervisors
tasks:
- include_tasks: host_setup.yml
- hosts: controllers
tasks:
- include_tasks: schedule.yml
vars:
- hosts: libvirt
tasks:
- name: Configure host as a Libvirt/QEMU/KVM hypervisor
@@ -18,3 +23,9 @@
owner: "{{ libvirt_pool_owner }}"
group: "{{ libvirt_pool_group }}"
libvirt_host_require_vt: "{{ libvirt_require_vt }}"
- name: Create Libvirt VMs
include_tasks: create_libvirt_vms.yml
vars:
flavour: flav0
name: "{{ item }}"

View File

@@ -0,0 +1,15 @@
---
# FIXME(w-miller): set this more cleverly?
base_path: "~/tenks/"
flavours:
flav0:
memory_mb: 4096
vcpus: 4
volumes:
- capacity: 10GB
physical_networks:
- physnet1
specs:
flav0: 4

View File

@@ -27,15 +27,4 @@ veth_tenks_suffix: "-ovs"
# Used for the port on the existing bridge.
veth_source_suffix: "-phy"
libvirt_pool_name: tenks
libvirt_pool_path: /var/lib/libvirt/tenks_pool/
libvirt_pool_type: dir
# Capacity is irrelevant for directory-based pools.
libvirt_pool_capacity:
libvirt_pool_mode: 755
libvirt_pool_owner: "{ remote_user }}"
libvirt_pool_group: "{ remote_user }}"
# By default, allow QEMU without hardware virtualisation since this is a
# development tool.
libvirt_require_vt: false
console_log_directory: /var/log/tenks/console_logs/

View File

@@ -4,6 +4,12 @@
name: "{{ system_requirements }}"
become: true
- name: Ensure console log directory exists
file:
path: "{{ console_log_directory }}"
state: directory
become: true
- name: Check if ovs-vsctl command is present
shell: ovs-vsctl --version
register: ovs_vsctl_check

8
ansible/inventory/groups Normal file
View File

@@ -0,0 +1,8 @@
[controllers]
# Empty group to provide delaration of controllers group.
[hypervisors:children]
libvirt
[libvirt]
# Empty group to provide declaration of libvirt group.

5
ansible/inventory/hosts Normal file
View File

@@ -0,0 +1,5 @@
[controllers]
localhost ansible_connection=local
[libvirt]
localhost ansible_connection=local