main.yml 3.54 KB
Newer Older
Sébastien Han's avatar
Sébastien Han committed
1
---
jjoos's avatar
jjoos committed
2
- name: update apt cache
3
4
  apt:
    update-cache: yes
Sébastien Han's avatar
Sébastien Han committed
5

Sébastien Han's avatar
Sébastien Han committed
6
7
- name: restart ceph mons
  command: service ceph restart mon
leseb's avatar
leseb committed
8
  when:
9
    socket.rc == 0 and
leseb's avatar
leseb committed
10
    ansible_distribution != 'Ubuntu' and
11
12
    mon_group_name in group_names and not
    is_ceph_infernalis
13
14
15

- name: restart ceph mons with systemd
  service:
Sébastien Han's avatar
Sébastien Han committed
16
      name: ceph-mon@{{ monitor_name }}
17
18
19
20
      state: restarted
  when:
    socket.rc == 0 and
    ansible_distribution != 'Ubuntu' and
21
22
    mon_group_name in group_names and
    is_ceph_infernalis
leseb's avatar
leseb committed
23
24

- name: restart ceph mons on ubuntu
25
  command: initctl restart ceph-mon cluster={{ cluster }} id={{ monitor_name }}
leseb's avatar
leseb committed
26
  when:
27
    socket.rc == 0 and
leseb's avatar
leseb committed
28
    ansible_distribution == 'Ubuntu' and
29
    mon_group_name in group_names
30

Sébastien Han's avatar
Sébastien Han committed
31
32
- name: restart ceph osds
  command: service ceph restart osd
leseb's avatar
leseb committed
33
  when:
34
    socket.rc == 0 and
leseb's avatar
leseb committed
35
    ansible_distribution != 'Ubuntu' and
36
    osd_group_name in group_names and
37
    not is_ceph_infernalis
38
39
40
41
42
43
44
45
46
47
48

# This does not just restart OSDs but everything else too. Unfortunately
# at this time the ansible role does not have an OSD id list to use
# for restarting them specifically.
- name: restart ceph osds with systemd
  service:
    name: ceph.target
    state: restarted
  when:
    socket.rc == 0 and
    ansible_distribution != 'Ubuntu' and
49
50
    osd_group_name in group_names and
    is_ceph_infernalis
Sébastien Han's avatar
Sébastien Han committed
51
52

- name: restart ceph osds on ubuntu
53
54
55
56
  shell: |
    for id in $(ls /var/lib/ceph/osd/ |grep -oh '[0-9]*'); do
      initctl restart ceph-osd cluster={{ cluster }} id=$id
    done
leseb's avatar
leseb committed
57
  when:
58
    socket.rc == 0 and
leseb's avatar
leseb committed
59
    ansible_distribution == 'Ubuntu' and
60
    osd_group_name in group_names
Sébastien Han's avatar
Sébastien Han committed
61

leseb's avatar
leseb committed
62
- name: restart ceph mdss on ubuntu
63
  command: initctl restart ceph-mds cluster={{ cluster }} id={{ ansible_hostname }}
leseb's avatar
leseb committed
64
  when:
65
    socket.rc == 0 and
leseb's avatar
leseb committed
66
67
68
    ansible_distribution == 'Ubuntu' and
    mds_group_name in group_names

Sébastien Han's avatar
Sébastien Han committed
69
70
- name: restart ceph mdss
  command: service ceph restart mds
leseb's avatar
leseb committed
71
  when:
72
    socket.rc == 0 and
leseb's avatar
leseb committed
73
    ansible_distribution != 'Ubuntu' and
74
    mds_group_name in group_names and
75
76
    ceph_stable and
    ceph_stable_release in ceph_stable_releases
77
78
79

- name: restart ceph mdss with systemd
  service:
Sébastien Han's avatar
Sébastien Han committed
80
      name: ceph-mds@{{ mds_name }}
81
82
83
84
      state: restarted
  when:
    socket.rc == 0 and
    ansible_distribution != 'Ubuntu' and
85
86
87
    mds_group_name in group_names and
    ceph_stable and
    ceph_stable_release not in ceph_stable_releases
Sébastien Han's avatar
Sébastien Han committed
88

leseb's avatar
leseb committed
89
- name: restart ceph rgws on ubuntu
90
  command: initctl restart radosgw cluster={{ cluster }} id=rgw.{{ ansible_hostname }}
leseb's avatar
leseb committed
91
  when:
92
    socketrgw.rc == 0 and
leseb's avatar
leseb committed
93
94
95
    ansible_distribution == 'Ubuntu' and
    rgw_group_name in group_names

Sébastien Han's avatar
Sébastien Han committed
96
97
- name: restart ceph rgws
  command: /etc/init.d/radosgw restart
leseb's avatar
leseb committed
98
  when:
99
    socketrgw.rc == 0 and
leseb's avatar
leseb committed
100
    ansible_distribution != 'Ubuntu' and
101
    rgw_group_name in group_names and
102
    not is_ceph_infernalis
leseb's avatar
leseb committed
103
104
105
106

- name: restart ceph rgws on red hat
  command: /etc/init.d/ceph-radosgw restart
  when:
107
    socketrgw.rc == 0 and
leseb's avatar
leseb committed
108
    ansible_os_family == 'RedHat' and
109
    rgw_group_name in group_names and
110
    not is_ceph_infernalis
111
112
113
114
115
116
117
118

- name: restart ceph rgws with systemd
  service:
    name: ceph-rgw@{{ ansible_hostname }}
    state: restarted
  when:
    socketrgw.rc == 0 and
    ansible_distribution != 'Ubuntu' and
119
120
    rgw_group_name in group_names and
    is_ceph_infernalis
121
122

- name: restart apache2
123
124
125
126
  service:
    name: apache2
    state: restarted
    enabled: yes
127
128
129
130
131
  when:
    ansible_os_family == 'Debian' and
    rgw_group_name in group_names

- name: restart apache2
132
133
134
135
  service:
    name: httpd
    state: restarted
    enabled: yes
136
137
138
  when:
    ansible_os_family == 'RedHat' and
    rgw_group_name in group_names