ansible/playbooks/host_update.yml

54 lines
1.3 KiB
YAML
Raw Normal View History

2013-12-20 21:47:29 +00:00
# This playbook updates hosts without guests.
#
# requires --extra-vars="target=somehostname yumcommand=update"
---
- name: Update the system
2013-12-20 21:47:29 +00:00
hosts: "{{ target }}"
gather_facts: true
2013-12-20 21:47:29 +00:00
user: root
2016-08-08 19:36:31 +00:00
tasks:
- name: Apply updates
ansible.builtin.package:
state: latest
name: "*"
update_cache: true
async: 7200
poll: 30
when: package_excludes is not defined
- debug:
msg:
- '!!!!!!!!!!!!!!!!!!! host {{ inventory_hostname }} has EXCLUDES OF {{ package_excludes }} !!!!!!!!!!!!!'
- '!!!!!!!!!!!!!!!!!!! DANGER DANGER DANGER ^ CHECK THAT EXCLUDES ARE STILL NEEDED ^ !!!!!!!!!!!!!!!!!!!!'
when: package_excludes is defined
changed_when: true
- name: Apply updates with excludes
ansible.builtin.package:
state: latest
name: "*"
update_cache: true
exclude: "{{ package_excludes }}"
2013-12-20 21:47:29 +00:00
async: 7200
poll: 30
when: package_excludes is defined
2013-12-20 21:47:29 +00:00
- name: Run rkhunter if installed
hosts: "{{ target }}"
2013-12-20 21:47:29 +00:00
user: root
tasks:
- name: Check for rkhunter
ansible.builtin.command: /usr/bin/test -f /usr/bin/rkhunter
2013-12-20 21:47:29 +00:00
register: rkhunter
ignore_errors: true
2016-08-08 19:36:31 +00:00
- name: Run rkhunter --propupd
ansible.builtin.command: /usr/bin/rkhunter --propupd
2018-04-04 19:24:21 +00:00
when: rkhunter is success