Skip to content
This repository was archived by the owner on Feb 9, 2019. It is now read-only.

example #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion adhoc/ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
68 changes: 68 additions & 0 deletions lab1.playbook
Original file line number Diff line number Diff line change
@@ -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