2013-11-21 21:37:43 +00:00
|
|
|
# This playboook updates a virthost and all it's guests.
|
|
|
|
#
|
2013-03-04 22:37:13 +00:00
|
|
|
# requires --extra-vars="target=somevhostname yumcommand=update"
|
2015-07-22 21:52:30 +00:00
|
|
|
# Might add nodns=true or nonagios=true at extra-vars
|
2013-11-21 21:37:43 +00:00
|
|
|
#
|
2013-02-25 17:37:22 +00:00
|
|
|
|
|
|
|
- name: find instances
|
2013-11-22 22:03:52 +00:00
|
|
|
hosts: "{{ target }}"
|
2013-11-21 21:37:43 +00:00
|
|
|
gather_facts: False
|
2013-02-25 17:37:22 +00:00
|
|
|
user: root
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
- name: get list of guests
|
2013-11-21 21:37:43 +00:00
|
|
|
virt: command=list_vms
|
2013-02-25 17:37:22 +00:00
|
|
|
register: vmlist
|
|
|
|
|
|
|
|
- name: add them to myvms_new group
|
2013-11-22 22:03:52 +00:00
|
|
|
local_action: add_host hostname={{ item }} groupname=myvms_new
|
|
|
|
with_items: vmlist.list_vms
|
2013-02-25 17:37:22 +00:00
|
|
|
|
2015-03-11 17:02:08 +00:00
|
|
|
# Call out to another playbook. Disable any proxies that may live here
|
2015-07-23 21:10:04 +00:00
|
|
|
#- include: update-proxy-dns.yml status=disable proxies=myvms_new:&proxies
|
2015-03-11 17:02:08 +00:00
|
|
|
|
2013-11-22 22:03:52 +00:00
|
|
|
- name: update the system
|
2013-11-21 21:37:43 +00:00
|
|
|
hosts: "{{ target }}:myvms_new"
|
|
|
|
gather_facts: False
|
2013-02-25 17:37:22 +00:00
|
|
|
user: root
|
|
|
|
|
|
|
|
tasks:
|
2015-03-11 17:02:08 +00:00
|
|
|
- name: schedule regular host downtime
|
2015-05-04 14:38:03 +00:00
|
|
|
nagios: action=downtime minutes=30 service=host host={{ inventory_hostname_short }}{{ env_suffix }}
|
2015-03-11 17:02:08 +00:00
|
|
|
delegate_to: noc01.phx2.fedoraproject.org
|
|
|
|
ignore_errors: true
|
2015-07-23 20:17:24 +00:00
|
|
|
when: nonagios is not defined or not "true" in nonagios
|
2015-03-11 17:02:08 +00:00
|
|
|
|
2013-02-25 17:37:22 +00:00
|
|
|
- name: expire-caches
|
2013-11-21 21:37:43 +00:00
|
|
|
command: yum clean expire-cache
|
2013-02-25 17:37:22 +00:00
|
|
|
|
2013-11-22 22:03:52 +00:00
|
|
|
- name: yum -y {{ yumcommand }}
|
2013-11-21 21:37:43 +00:00
|
|
|
command: yum -y {{ yumcommand }}
|
2013-02-26 22:56:11 +00:00
|
|
|
async: 7200
|
2013-11-21 21:37:43 +00:00
|
|
|
poll: 30
|
2013-02-25 17:37:22 +00:00
|
|
|
|
2013-11-22 22:11:49 +00:00
|
|
|
- name: run rkhunter if installed
|
|
|
|
hosts: "{{ target }}:myvms_new"
|
2013-11-22 22:03:52 +00:00
|
|
|
user: root
|
|
|
|
|
|
|
|
tasks:
|
2013-02-25 17:37:22 +00:00
|
|
|
- name: check for rkhunter
|
2013-11-21 21:37:43 +00:00
|
|
|
command: /usr/bin/test -f /usr/bin/rkhunter
|
2013-02-25 17:37:22 +00:00
|
|
|
register: rkhunter
|
|
|
|
ignore_errors: true
|
|
|
|
|
|
|
|
- name: run rkhunter --propupd
|
2013-11-21 21:37:43 +00:00
|
|
|
command: /usr/bin/rkhunter --propupd
|
2013-07-05 17:15:37 +00:00
|
|
|
when: rkhunter|success
|