ansible/playbooks/vhost_update.yml

53 lines
1.1 KiB
YAML
Raw Normal View History

# requires --extra-vars="target=somevhostname yumcommand=update"
- name: find instances
2013-11-22 22:03:52 +00:00
hosts: "{{ target }}"
2013-09-30 18:15:41 +00:00
accelerate: true
user: root
tasks:
- name: get list of guests
action: virt command=list_vms
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-11-22 22:03:52 +00:00
- name: add the host to myvms_new group
local_action: add_host hostname={{ target }} groupname=myvms_new
- name: update the system
hosts: myvms_new
2013-09-30 18:15:41 +00:00
accelerate: true
user: root
tasks:
- name: expire-caches
action: command yum clean expire-cache
2013-11-22 22:03:52 +00:00
- name: yum -y {{ yumcommand }}
action: command yum -y {{ yumcommand }}
async: 7200
2013-02-27 21:58:17 +00:00
poll: 50
2013-11-22 22:03:52 +00:00
- name: update all run rkhunter if installed
hosts: myvms_new
accelerate: true
user: root
tasks:
- name: check for rkhunter
action: command /usr/bin/test -f /usr/bin/rkhunter
register: rkhunter
ignore_errors: true
- name: run rkhunter --propupd
action: command /usr/bin/rkhunter --propupd
when: rkhunter|success