Move virthost from a task to a role.

Setup a variable for hosts we want nested virt enabled on (default false)
add task to setup that on ones we want
This commit is contained in:
Kevin Fenzi 2015-12-10 22:36:13 +00:00
parent 4f0c441afc
commit aebe90cc65
6 changed files with 15 additions and 1 deletions

View file

@ -3,6 +3,9 @@ freezes: true
# most of our systems are in phx2 # most of our systems are in phx2
datacenter: phx2 datacenter: phx2
# usually we do not want to enable nested virt, only on some virthosts
nested: false
# most of our systems are 64bit. # most of our systems are 64bit.
# Used to install various nagios scripts and the like. # Used to install various nagios scripts and the like.
libdir: /usr/lib64 libdir: /usr/lib64

View file

@ -1,3 +1,4 @@
--- ---
# This virthost only has non release critical instances, so it doesn't freeze # This virthost only has non release critical instances, so it doesn't freeze
freezes: false freezes: false
nested: true

View file

@ -1,3 +1,4 @@
--- ---
# This virthost only has non release critical instances, so it doesn't freeze # This virthost only has non release critical instances, so it doesn't freeze
freezes: false freezes: false
nested: true

View file

@ -23,12 +23,12 @@
- { role: iscsi_client, when: datacenter == "phx2" } - { role: iscsi_client, when: datacenter == "phx2" }
- sudo - sudo
- { role: openvpn/client, when: datacenter != "phx2" } - { role: openvpn/client, when: datacenter != "phx2" }
- virthost
tasks: tasks:
- include: "{{ tasks }}/yumrepos.yml" - include: "{{ tasks }}/yumrepos.yml"
- include: "{{ tasks }}/2fa_client.yml" - include: "{{ tasks }}/2fa_client.yml"
- include: "{{ tasks }}/motd.yml" - include: "{{ tasks }}/motd.yml"
- include: "{{ tasks }}/virthost.yml"
handlers: handlers:
- include: "{{ handlers }}/restart_services.yml" - include: "{{ handlers }}/restart_services.yml"

View file

@ -0,0 +1 @@
nested=1

View file

@ -51,3 +51,11 @@
tags: tags:
- config - config
when: ansible_distribution == 'RedHat' and ansible_distribution_major_version|int == 7 when: ansible_distribution == 'RedHat' and ansible_distribution_major_version|int == 7
#
# Some virthosts we want to use nested virt (a tech preview in rhel 7.2)
# We need this module option set and then need to tweak the libvirt xml to enable it
#
- name: setup nested virt on virthosts with nested=true variable
copy: src=kvm_intel.conf dest=/etc/modprobe.d/kvm_intel.conf
when: nested is true