-
Notifications
You must be signed in to change notification settings - Fork 0
/
swift-proxy.yml
116 lines (100 loc) · 4.73 KB
/
swift-proxy.yml
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
---
- name: "Swift-proxy playbook"
hosts: openstack
remote_user: root
gather_facts: yes
vars:
xswiftnode1: 103.36.84.177
xswiftnode2: 103.36.84.178
tasks:
- name: "Install swift"
yum: name={{ item }} enablerepo=centos-openstack-ocata,epel state=present
with_items:
- openstack-swift-proxy
- python-memcached
- openssh-clients
# - name: "Backup Original cinder configuation"
# copy: remote_src=True src=/etc/swift/proxy-server.conf dest=/etc/swift/proxy-server.conf.org
- name: "Specify memchaed server ip in proxy-server.conf"
lineinfile:
path: /etc/swift/proxy-server.conf
regexp: '^memcache_servers ='
line: 'memcache_servers = {{ ansible_host }}:11211'
- name: "swift conf"
lineinfile:
dest: /etc/swift/proxy-server.conf
insertafter: EOF
create: true
state: present
line: |
auth_uri = http://{{ ansible_host }}:5000
auth_url = http://{{ ansible_host }}:35357
memcached_servers = {{ ansible_host }}:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = swift
password = servicepassword
delay_auth_decision = true
- name: "comment old keystone auth varaibles in swift-proxy conf"
lineinfile: path=/etc/swift/proxy-server.conf
regexp={{ item.regexp }}
line={{ item.line }}
with_items:
- { regexp: "^admin_tenant_name =", line: "#admin_tenant_name = %SERVICE_TENANT_NAME%" }
- { regexp: "admin_user =", line: "#admin_user = %SERVICE_USER%" }
- { regexp: "admin_password =", line: "#admin_password = %SERVICE_PASSWORD%" }
- { regexp: "auth_host =", line: "#auth_host = 127.0.0.1" }
- { regexp: "auth_port =", line: "#auth_port = 35357" }
- { regexp: "auth_protocol =", line: "#auth_protocol = http" }
- { regexp: "signing_dir =", line: "#signing_dir = /tmp/keystone-signing-swift" }
- 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: "Configure ring files"
shell: "{{ item }}"
args:
executable: /bin/bash
with_items:
- swift-ring-builder /etc/swift/account.builder create 12 2 1
- swift-ring-builder /etc/swift/container.builder create 12 2 1
- swift-ring-builder /etc/swift/object.builder create 12 2 1
# - name: "ring acccount conf"
# raw: swift-ring-builder /etc/swift/account.builder create 12 2 1
#
# - name: "ring object conf"
# raw: swift-ring-builder /etc/swift/object.builder create 12 2 1
#
# - name: "ring container conf"
# raw: swift-ring-builder /etc/swift/container.builder create 12 2 1
- name: "swift-ring-builder add account/object/container-builder for stoarage nodes"
shell: "{{ item }}"
args:
executable: /bin/bash
with_items:
- swift-ring-builder /etc/swift/account.builder add r0z0-{{ xswiftnode1 }}:6202/device0 100
- swift-ring-builder /etc/swift/container.builder add r0z0-{{ xswiftnode1 }}:6201/device0 100
- swift-ring-builder /etc/swift/object.builder add r0z0-{{ xswiftnode1 }}:6200/device0 100
- swift-ring-builder /etc/swift/account.builder add r1z1-{{ xswiftnode2 }}:6202/device1 100
- swift-ring-builder /etc/swift/container.builder add r1z1-{{ xswiftnode2 }}:6201/device1 100
- swift-ring-builder /etc/swift/object.builder add r1z1-{{ xswiftnode2 }}:6200/device1 100
# - swift-ring-builder /etc/swift/account.builder add r2z2-{{ ansible_host }}:6202/device2 100
# - swift-ring-builder /etc/swift/container.builder add r2z2-{{ ansible_host }}:6201/device2 100
# - swift-ring-builder /etc/swift/object.builder add r2z2-{{ ansible_host }}:6200/device2 100
- swift-ring-builder /etc/swift/account.builder rebalance
- swift-ring-builder /etc/swift/container.builder rebalance
- swift-ring-builder /etc/swift/object.builder rebalance
- name: "chown for swift acc"
raw: chown swift. /etc/swift/*.gz
- name: "start and enable openstack swift proxy"
service: name=openstack-swift-proxy state=restarted enabled=yes
- name: "disable firewall"
service: name=firewalld state=stopped enabled=no