68 lines
1.9 KiB
YAML
68 lines
1.9 KiB
YAML
# This playboook updates a virthost and all it's guests.
|
|
#
|
|
# requires --extra-vars="target=somevhostname yumcommand=update"
|
|
# Might add nodns=true or nonagios=true at extra-vars
|
|
#
|
|
|
|
- name: find instances
|
|
hosts: "{{ target }}"
|
|
gather_facts: False
|
|
user: root
|
|
|
|
tasks:
|
|
- name: get list of guests
|
|
virt: command=list_vms
|
|
register: vmlist
|
|
|
|
- name: add them to myvms_new group
|
|
local_action: add_host hostname={{ item }} groupname=myvms_new
|
|
with_items: vmlist.list_vms
|
|
|
|
# Call out to another playbook. Disable any proxies that may live here
|
|
#- include: update-proxy-dns.yml status=disable proxies=myvms_new:&proxies
|
|
|
|
- name: update the system
|
|
hosts: "{{ target }}:myvms_new"
|
|
gather_facts: True
|
|
user: root
|
|
|
|
tasks:
|
|
- name: schedule regular host downtime
|
|
nagios: action=downtime minutes=30 service=host host={{ inventory_hostname_short }}{{ env_suffix }}
|
|
delegate_to: noc01.phx2.fedoraproject.org
|
|
ignore_errors: true
|
|
when: nonagios is not defined or not "true" in nonagios
|
|
|
|
- name: expire-caches
|
|
command: yum clean expire-cache
|
|
when: ansible_distribution_major_version|int < 22
|
|
|
|
- name: expire-caches
|
|
command: dnf clean expire-cache
|
|
when: ansible_distribution_major_version|int > 21 and ansible_cmdline.ostree is not defined
|
|
|
|
- name: yum -y {{ yumcommand }}
|
|
command: yum -y {{ yumcommand }}
|
|
async: 7200
|
|
poll: 30
|
|
when: ansible_distribution_major_version|int < 22
|
|
|
|
- name: dnf -y {{ yumcommand }}
|
|
command: dnf -y {{ yumcommand }}
|
|
async: 7200
|
|
poll: 30
|
|
when: ansible_distribution_major_version|int > 21 and ansible_cmdline.ostree is not defined
|
|
|
|
- name: run rkhunter if installed
|
|
hosts: "{{ target }}:myvms_new"
|
|
user: root
|
|
|
|
tasks:
|
|
- name: check for rkhunter
|
|
command: /usr/bin/test -f /usr/bin/rkhunter
|
|
register: rkhunter
|
|
ignore_errors: true
|
|
|
|
- name: run rkhunter --propupd
|
|
command: /usr/bin/rkhunter --propupd
|
|
when: rkhunter|success
|