forked from beekhof/osp-ha-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
swift-aco.scenario
105 lines (86 loc) · 3.98 KB
/
swift-aco.scenario
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
# This file can be used directly by 'phd', see 'build-all.sh' in this
# directory for how it can be invoked. The only requirement is a list
# of nodes you'd like it to modify.
#
# The scope of each command-block is controlled by the preceeding
# 'target' line.
#
# - target=all
# The commands are executed on evey node provided
#
# - target=local
# The commands are executed from the node hosting phd. When not
# using phd, they should be run from some other independant host
# (such as the puppet master)
#
# - target=$PHD_ENV_nodes{N}
# The commands are executed on the Nth node provided.
# For example, to run on only the first node would be target=$PHD_ENV_nodes1
#
# Tasks to be performed at this step include:
#################################
# Scenario Requirements Section #
#################################
= REQUIREMENTS =
nodes: 3
= VARIABLES =
PHD_VAR_deployment
######################
# Deployment Scripts #
######################
= SCRIPTS =
target=all
....
yum install -y openstack-swift-object openstack-swift-container openstack-swift-account openstack-utils rsync xfsprogs
....
target=all
....
# If you have a dedicated device, format it here and have the cluster mount it as per 'swift-fs' below
# We don't, but swift wants a different partition than /, so we'll create a loopback file and mount that for 'swift-fs'
mkdir -p /local/swiftstorage/target
truncate --size=1G /local/swift.img
losetup /dev/loop0 /local/swift.img
mkfs.xfs /dev/loop0
mount /dev/loop0 /local/swiftstorage
chown -R swift:swift /local
umount /dev/loop0
# Some extra magic to set up the loopback device after a reboot
echo "losetup /dev/loop0 /local/swift.img" >> /etc/rc.d/rc.local
chmod a+x /etc/rc.d/rc.local
openstack-config --set /etc/swift/object-server.conf DEFAULT bind_ip 0.0.0.0
openstack-config --set /etc/swift/object-server.conf DEFAULT devices /local/swiftstorage
openstack-config --set /etc/swift/object-server.conf DEFAULT mount_check false
openstack-config --set /etc/swift/account-server.conf DEFAULT bind_ip 0.0.0.0
openstack-config --set /etc/swift/account-server.conf DEFAULT devices /local/swiftstorage
openstack-config --set /etc/swift/account-server.conf DEFAULT mount_check false
openstack-config --set /etc/swift/container-server.conf DEFAULT bind_ip 0.0.0.0
openstack-config --set /etc/swift/container-server.conf DEFAULT devices /local/swiftstorage
openstack-config --set /etc/swift/container-server.conf DEFAULT mount_check false
openstack-config --set /etc/swift/object-server.conf DEFAULT mount_check false
openstack-config --set /etc/swift/account-server.conf DEFAULT mount_check false
openstack-config --set /etc/swift/container-server.conf DEFAULT mount_check false
mkdir -p /tmp/keystone-signing-swift
chown -R root:swift /etc/swift
chown -R swift:swift /tmp/keystone-signing-swift
....
target=all
....
pcs resource show swift-fs > /dev/null 2>&1
if [ $? != 0 ]; then
# We must be either the first node to run, or configuring
# single-node clusters for a segregated deployment
pcs resource create swift-fs Filesystem device="/dev/loop0" directory="/local/swiftstorage/target" fstype="xfs" force_clones="yes" --clone interleave=true
pcs resource create swift-account systemd:openstack-swift-account --clone interleave=true
pcs constraint colocation add swift-account-clone with swift-fs-clone
pcs constraint order start swift-fs-clone then swift-account-clone
pcs resource create swift-container systemd:openstack-swift-container --clone interleave=true
pcs constraint colocation add swift-container-clone with swift-account-clone
pcs constraint order start swift-account-clone then swift-container-clone
pcs resource create swift-object systemd:openstack-swift-object --clone interleave=true
pcs constraint colocation add swift-object-clone with swift-container-clone
pcs constraint order start swift-container-clone then swift-object-clone
fi
if [ $PHD_VAR_deployment = collapsed ]; then
pcs constraint order start keystone-clone then swift-account-clone
fi
....