-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstorage-node.yml
More file actions
213 lines (174 loc) · 6.42 KB
/
storage-node.yml
File metadata and controls
213 lines (174 loc) · 6.42 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
---
- name: "swift-storage node playbook"
hosts: storage
remote_user: root
gather_facts: yes
tasks:
- name: "Install openstack-ocata repo"
yum: name=centos-release-openstack-ocata state=present
# - name: "change to enable ocatarepo"
# lineinfile: path=/etc/yum.repos.d/CentOS-OpenStack-ocata.repo regexp='^enabled=1' line='enabled=0'
- name: "install epelrepo"
yum: name=epel-release state=present
- name: "Install swift-account,swift-object and swift-container"
yum: name={{ item }} enablerepo=centos-openstack-ocata,epel state=present
with_items:
- openstack-swift-account
- openstack-swift-container
- openstack-swift-object
- xfsprogs
- rsync
- openssh-clients
- name: "format free space disk"
raw: mkfs.xfs -i size=1024 -s size=4096 /dev/vdb
# - name: "create directory"
# shell: mkdir -p /tmp/node/device{{ item }}
# args:
# executable: /bin/bash
# with_items:
# - { item: "0", when: "ansible_host == 103.36.84.142" }
# - { item: "1", when: "ansible_host == 103.36.84.177" }
# - { item: "2", when: "ansible_host == 103.36.84.178" }
# when: ansible_hostname == swiftstorage0
# tags: test
- name: "create directory"
shell: mkdir -p /srv/node/device0
args:
executable: /bin/bash
when: ansible_hostname == "xswiftnode1"
- name: "create directory"
shell: mkdir -p /srv/node/device1
args:
executable: /bin/bash
when: ansible_hostname == "xswiftnode2"
- name: "mount disk"
shell: mount -o noatime,nodiratime,nobarrier /dev/vdb /srv/node/device0
args:
executable: /bin/bash
when: ansible_hostname == "xswiftnode1"
- name: "mount disk"
shell: mount -o noatime,nodiratime,nobarrier /dev/vdb /srv/node/device1
args:
executable: /bin/bash
when: ansible_hostname == "xswiftnode2"
# - name: "mount disk"
# shell: mount -o noatime,nodiratime,nobarrier /dev/sdb1 /srv/node/device2
# args:
# executable: /bin/bash
# when: ansible_hostname == swiftstorage2
- name: "change ownsership"
raw: chown -R swift. /srv/node
- name: "add entry in fstab"
lineinfile:
dest: /etc/fstab
line: /dev/vdb /srv/node/device0 xfs noatime,nodiratime,nobarrier 0 0
insertbefore: EOF
when: ansible_hostname == "xswiftnode1"
- name: "add entry in fstab"
lineinfile:
dest: /etc/fstab
line: /dev/vdb /srv/node/device1 xfs noatime,nodiratime,nobarrier 0 0
insertbefore: EOF
when: ansible_hostname == "xswiftnode2"
# - name: "add entry in fstab"
# lineinfile:
# dest: /etc/fstab
# line: /dev/sdb1 /srv/node/device2 xfs noatime,nodiratime,nobarrier 0 0
# insertbefore: EOF
# when: ansible_hostname == swiftstorage2
- name: "copy swift rings to storage nodes"
shell: scp -3 103.36.84.142:/tmp/f1 103.36.84.177:/tmp/
args:
executable: /bin/bash
tags: scp
# - name: Copy controller_node-To-storage_nodes (from serverA to serverB,C)
# synchronize: src=/etc/swift/*.gz dest=/etc/swift/
# delegate_to: 103.36.84.142
# tags: scp
- name: "change ownership"
raw: chown swift. /etc/swift/*.gz
- name: "swift hash_path_suffix"
lineinfile:
path: /etc/swift/swift.conf
regexp: '^swift_hash_path_suffix ='
line: 'swift_hash_path_suffix = swift_shared_path'
- name: "swift hash_path_preffix"
lineinfile:
path: /etc/swift/swift.conf
line: 'swift_hash_path_prefix = swift_shared_path'
state: present
- name: "bind_ip in account/object/container"
lineinfile:
path: /etc/swift/{{ item }}.conf
regexp: '^bind_ip ='
line: 'bind_ip = 0.0.0.0'
with_items:
- account-server
- container-server
- object-server
tags: bind
- name: "configure rsync"
lineinfile:
dest: /etc/rsyncd.conf
insertafter: EOF
create: true
state: present
line: |
pid file = /var/run/rsyncd.pid
log file = /var/log/rsyncd.log
uid = swift
gid = swift
address = {{ ansible_host }}
[account]
path = /srv/node
read only = false
write only = no
list = yes
incoming chmod = 0644
outgoing chmod = 0644
max connections = 25
lock file = /var/lock/account.lock
[container]
path = /srv/node
read only = false
write only = no
list = yes
incoming chmod = 0644
outgoing chmod = 0644
max connections = 25
lock file = /var/lock/container.lock
[object]
path = /srv/node
read only = false
write only = no
list = yes
incoming chmod = 0644
outgoing chmod = 0644
max connections = 25
lock file = /var/lock/object.lock
[swift_server]
path = /etc/swift
read only = true
write only = no
list = yes
incoming chmod = 0644
outgoing chmod = 0644
max connections = 5
lock file = /var/lock/swift_server.lock
- name: "start and enable rsync"
service: name=rsyncd state=started enabled=yes
- name: "start and enable openstack-swift services"
service: name={{ item }} state=started enabled=yes
with_items:
- openstack-swift-account
- openstack-swift-account-auditor
- openstack-swift-account-reaper
- openstack-swift-account-replicator
- openstack-swift-container
- openstack-swift-container-auditor
- openstack-swift-container-replicator
- openstack-swift-container-updater
- openstack-swift-object
- openstack-swift-object-auditor
- openstack-swift-object-replicator
- openstack-swift-object-updater