-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsystems.yaml
66 lines (55 loc) · 1.65 KB
/
systems.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
# vars:
# reboot - A boolean used to indicate whether or not the playbook should reboot the servers. It
# defaults to false.
- hosts: systems
sudo: true
roles:
- role: notify-chat
msg: "Updating {{ inventory_hostname }} system packages"
tasks:
- group_by: key={{ ansible_distribution }}
changed_when: false
- group_by: key={{ ansible_distribution }}_{{ ansible_distribution_major_version }}
changed_when: false
- hosts: CentOS:RedHat
gather_facts: false
sudo: true
tasks:
- name: upgrade system packages
yum: name=* state=latest
- hosts: CentOS:RedHat:&builders
gather_facts: false
sudo: true
tasks:
- name: ensure tomcat owns /usr/src/redhat
file: path=/usr/src/redhat state=directory owner=tomcat recurse=true
- hosts: CentOS:RedHat:&db
gather_facts: false
sudo: true
tasks:
- name: ensure DE DBMS starts on boot
service: name=postgresql-9.2 enabled=true
- hosts: systems:!CentOS_7
gather_facts: false
sudo: true
roles:
- denyhosts
- hosts: systems
gather_facts: false
sudo: true
pre_tasks:
- name: reboot server
when: reboot|default(false)
command: /sbin/shutdown -r +2
- name: wait for server to stop
sudo: false
when: reboot|default(false)
local_action: wait_for host="{{ inventory_hostname }}" port={{ ansible_ssh_port }} state=stopped
- name: verify server up
sudo: false
when: reboot|default(false)
local_action: wait_for host="{{ inventory_hostname }}" port={{ ansible_ssh_port }} state=started
roles:
- role: notify-chat
msg: "Done updating {{ inventory_hostname }} system packages"