From 4cbe5ce477f8edaea6931c8609d856ffaefd9248 Mon Sep 17 00:00:00 2001 From: Sebastian Mossberg Date: Fri, 8 Feb 2019 23:50:44 +0100 Subject: [PATCH 1/2] example --- lab1.playbook | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 lab1.playbook diff --git a/lab1.playbook b/lab1.playbook new file mode 100644 index 0000000..3bfe5ad --- /dev/null +++ b/lab1.playbook @@ -0,0 +1,68 @@ +# Lab example 1 +# 2019-02-08 +# +# This example playbook has been tested with https://github.com/redhatNORDICS/consulting-lab/pull/38#issuecomment-461851756 +# A complete run like this takes around 1h, so it is a good idea to use `nohup &` or a terminal multiplexer like screen or tmux. +# +# It will turn a Hetzner host running the rescue boot to a labsetup with virtual networks +# and ready to spin up VM's in matter of seconds. +# +# The process: +# Once the hetzner installer is finished with the CentOS installation +# it will start syncing down the latest RHEL 7Server repo. +# +# While the sync runs it will proceed to configure libvirt with networks, +# OpenVPN and knockd. +# +# The process is blocked until the reposync is complete. Once it has completed +# the VM template will be created. This will serve as a base for all VM's that we create. +# +# With the template in place, it will then create all VM's defined in the [vms] group in the inventory. +# The VM's are added to the in-memory inventory for further configuration and alsot to the static inventory/connections file. +# +# Next play is against the new VM's where the example just applies the motd role. +# +# Usage: +# $ nohup ansible-playbook -i inventory/ lab1.playbook & + + +# From rescue mode +- hosts: labhost + user: root + roles: + - hetzner-provision + - role: mdadm-sync + vars: + stop_sync: true + - users + +# centos installed +- hosts: labhost + become: true + gather_facts: true + roles: + - hetzner-post-provision + - subman + - role: reposync + vars: + phase: setup + - openvpn + - libvirt + - libvirt_network + - iptables + - knockd + - role: reposync + vars: + phase: final + - vm-template + - create-inventory-vms + - role: mdadm-sync + vars: + start_sync: true + +# configure vm's +- hosts: vms + become: true + roles: + - motd + From 5259dd23061ac6b06f4fa53c2bb8165e43ef0c52 Mon Sep 17 00:00:00 2001 From: Sebastian Mossberg Date: Sat, 9 Feb 2019 00:05:51 +0100 Subject: [PATCH 2/2] no known_host stuff in the ansible.cfg --- adhoc/ansible.cfg | 2 +- ansible.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/adhoc/ansible.cfg b/adhoc/ansible.cfg index baae677..3af5510 100644 --- a/adhoc/ansible.cfg +++ b/adhoc/ansible.cfg @@ -6,7 +6,7 @@ retry_files_enabled = False roles_path = ../roles/:./roles/ [ssh_connection] -ssh_args = -o ControlMaster=auto -o ControlPersist=600s +ssh_args = -o ControlMaster=auto -o ControlPersist=600s -o ServerAliveInterval=300 -o ServerAliveCountMax=2 -o StrictHostKeyChecking=no control_path = %(directory)s/%%h-%%r pipelining = True timeout = 10 diff --git a/ansible.cfg b/ansible.cfg index baae677..3af5510 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -6,7 +6,7 @@ retry_files_enabled = False roles_path = ../roles/:./roles/ [ssh_connection] -ssh_args = -o ControlMaster=auto -o ControlPersist=600s +ssh_args = -o ControlMaster=auto -o ControlPersist=600s -o ServerAliveInterval=300 -o ServerAliveCountMax=2 -o StrictHostKeyChecking=no control_path = %(directory)s/%%h-%%r pipelining = True timeout = 10