forked from fultonj/tripleo-ceph-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmistral-ceph-ansible.sh
executable file
·111 lines (103 loc) · 3.84 KB
/
mistral-ceph-ansible.sh
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
#!/usr/bin/env bash
# Filename: mistral-ceph-ansible.sh
# Description: prep and run ceph-ansible
# Time-stamp: <2017-03-08 09:41:40 jfulton>
# -------------------------------------------------------
PRE_PREP=0
PREP=1
RUN=1
WORKFLOW='mistral-ceph-ansible'
#OPTION='jeos'
OPTION='hci'
#OPTION='jeos-docker'
#OPTION='hci-docker'
# -------------------------------------------------------
if [[ $PRE_PREP -eq 1 ]]; then
echo "Updating inventory"
bash ansible-inventory.sh
echo "Zapping Disks"
bash zap.sh
fi
# -------------------------------------------------------
if [[ $PREP -eq 1 ]]; then
# If we do this for real, then do we ship an RPM of ceph-ansible?
# It's already shipped for RHCS2 downstream
if [[ ! -d ceph-ansible ]]; then
echo "ceph-ansible is missing please run init.sh"
exit 1
fi
if [[ -d /tmp/ceph-ansible ]]; then
sudo rm -rf /tmp/ceph-ansible
fi
cp -r ceph-ansible /tmp/
cp /tmp/ceph-ansible/site.yml.sample /tmp/ceph-ansible/site.yml
# all of this nonsense will be-replaced when this workflow is parametized
if [[ $OPTION == 'jeos' ]]; then
# need to set mon-interface to eth0
cp /tmp/ceph-ansible/group_vars/mons.yml.sample /tmp/ceph-ansible/group_vars/mons.yml
cp group_vars/native-all.yml /tmp/ceph-ansible/group_vars/all.yml
cp group_vars/osds.yml /tmp/ceph-ansible/group_vars/osds.yml
fi
if [[ $OPTION == 'hci' ]]; then
# need to set mon-interface to br-ex
cp group_vars/native-all.yml /tmp/ceph-ansible/group_vars/all.yml
cp group_vars/osds.yml /tmp/ceph-ansible/group_vars/osds.yml
cp group_vars/mons.yml /tmp/ceph-ansible/group_vars/mons.yml
fi
if [[ $OPTION == 'jeos-docker' ]]; then
# need to set mon-interface to eth0
# mons.yml is not used in this scenario
cp group_vars/docker-all.yml /tmp/ceph-ansible/group_vars/all.yml
# There is an open bug for containerized ceph requring me to update
# ceph-ansible/roles/ceph-mon/tasks/docker/pre_requisite.yml
#
# to comment out the following task:
# # ensure extras enabled for docker
# - name: enable extras on centos
# yum_repository:
# name: extras
# state: present
# enabled: yes
# when:
# - ansible_distribution == 'CentOS'
# tags:
# with_pkg
# workaround:
cp ceph-ansible/roles/ceph-mon/tasks/docker/pre_requisite.yml /tmp/ceph-ansible/roles/ceph-mon/tasks/docker/pre_requisite.yml
fi
if [[ $OPTION == 'hci-docker' ]]; then
echo "waiting for fix to https://github.com/ceph/ceph-ansible/issues/1321"
# Items in group_vars/docker-all.yml that don't work with docker are commented out
# https://github.com/ceph/ceph-ansible/issues/1321
#cp group_vars/docker-all.yml /tmp/ceph-ansible/group_vars/all.yml
fi
#cp group_vars/* /tmp/ceph-ansible/group_vars/
#rm /tmp/ceph-ansible/group_vars/*-all.yml # don't copy in special exceptions
sudo chown -R mistral:mistral /tmp/ceph-ansible/
fi
# -------------------------------------------------------
if [[ $RUN -eq 1 ]]; then
if [[ ! -f input.json ]]; then
echo "Error: input.json is not in `pwd`"
exit 1
fi
source ~/stackrc
EXISTS=$(mistral workflow-list | grep $WORKFLOW | wc -l)
if [[ $EXISTS -gt 0 ]]; then
mistral workflow-update $WORKFLOW.yaml
else
mistral workflow-create $WORKFLOW.yaml
fi
mistral execution-create $WORKFLOW ceph-ansible-input.json
UUID=$(mistral execution-list | grep $WORKFLOW | awk {'print $2'} | tail -1)
mistral execution-get $UUID
echo "Getting output for the following tasks in workflow $WORKFLOW"
mistral task-list $UUID
for TASK_ID in $(mistral task-list $UUID | awk {'print $2'} | egrep -v 'ID|^$'); do
mistral task-get-result $TASK_ID | jq . | sed -e 's/\\n/\n/g' -e 's/\\"/"/g'
done
# to make following up easier:
echo "UUID: $UUID"
echo "TASK_ID: $TASK_ID"
echo $TASK_ID > TASK_ID
fi