blob: b4cedea2a412189b3ace2a7aa2a9e392b8451564 (
plain)
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
|
#!/bin/bash
set -eux
SLEEP_TIME=5
CONTROLLER_HOSTS=${CONTROLLER_HOSTS:-""}
COMPUTE_HOSTS=${COMPUTE_HOSTS:-""}
BLOCKSTORAGE_HOSTS=${BLOCKSTORAGE_HOSTS:-""}
OBJECTSTORAGE_HOSTS=${OBJECTSTORAGE_HOSTS:-""}
CEPHSTORAGE_HOSTS=${CEPHSTORAGE_HOSTS:-""}
SUBNODES_SSH_KEY=${SUBNODES_SSH_KEY:-"~/.ssh/id_rsa"}
SSH_OPTIONS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=Verbose -o PasswordAuthentication=no -o ConnectionAttempts=32"
read -a Controller_hosts_a <<< $CONTROLLER_HOSTS
read -a Compute_hosts_a <<< $COMPUTE_HOSTS
read -a BlockStorage_hosts_a <<< $BLOCKSTORAGE_HOSTS
read -a ObjectStorage_hosts_a <<< $OBJECTSTORAGE_HOSTS
read -a CephStorage_hosts_a <<< $CEPHSTORAGE_HOSTS
roles="Controller Compute BlockStorage ObjectStorage CephStorage"
admin_user_id=$(openstack user show admin -c id -f value)
admin_project_id=$(openstack project show admin -c id -f value)
function check_stack {
local stack_to_check=$1
if [ "$stack_to_check" = "|" ]; then
echo Stack not created
return 1
fi
echo Checking if $1 stack is created
set +e
heat resource-list $stack_to_check
rc=$?
set -e
if [ ! "$rc" = "0" ]; then
echo Stack $1 not yet created
fi
return $rc
}
for role in $roles; do
while ! check_stack overcloud; do
sleep $SLEEP_TIME
done
rg_stack=$(heat resource-list overcloud | grep " $role " | awk '{print $4}')
while ! check_stack $rg_stack; do
sleep $SLEEP_TIME
rg_stack=$(heat resource-list overcloud | grep " $role " | awk '{print $4}')
done
stacks=$(heat resource-list $rg_stack | grep OS::TripleO::$role | awk '{print $4}')
i=0
for stack in $stacks; do
server_resource_name=$role
if [ "$server_resource_name" = "Compute" ]; then
server_resource_name="NovaCompute"
fi
server_stack=$(heat resource-list $stack | grep " $server_resource_name " | awk '{print $4}')
while ! check_stack $server_stack; do
sleep $SLEEP_TIME
server_stack=$(heat resource-list $stack | grep " $server_resource_name " | awk '{print $4}')
done
deployed_server_stack=$(heat resource-list $server_stack | grep "deployed-server" | awk '{print $4}')
echo "======================"
echo "$role$i os-collect-config.conf configuration:"
config="
[DEFAULT]
collectors=heat
command=os-refresh-config
polling_interval=30
[heat]
user_id=$admin_user_id
password=$OS_PASSWORD
auth_url=$OS_AUTH_URL
project_id=$admin_project_id
stack_id=$deployed_server_stack
resource_name=deployed-server-config"
echo "$config"
echo "======================"
echo
host=
eval host=\${${role}_hosts_a[i]}
if [ -n "$host" ]; then
# Delete the os-collect-config.conf template so our file won't get
# overwritten
ssh $SSH_OPTIONS -i $SUBNODES_SSH_KEY $host sudo /bin/rm -f /usr/libexec/os-apply-config/templates/etc/os-collect-config.conf
ssh $SSH_OPTIONS -i $SUBNODES_SSH_KEY $host "echo \"$config\" > os-collect-config.conf"
ssh $SSH_OPTIONS -i $SUBNODES_SSH_KEY $host sudo cp os-collect-config.conf /etc/os-collect-config.conf
ssh $SSH_OPTIONS -i $SUBNODES_SSH_KEY $host sudo systemctl restart os-collect-config
fi
let i+=1
done
done
|