Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 1 | #!/bin/bash -xe |
| 2 | |
Jiri Broulik | ddd5526 | 2018-04-11 14:52:43 +0200 | [diff] [blame] | 3 | FORMULA_VERSION=${FORMULA_VERSION:-2018.3.1} |
Jiri Broulik | 05c5b60 | 2018-04-11 13:52:37 +0200 | [diff] [blame] | 4 | APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"http://apt.mirantis.com/xenial/ $FORMULA_VERSION salt"} |
azvyagintsev | 0adfe68 | 2018-06-13 16:29:40 +0300 | [diff] [blame] | 5 | SALT_OPTS="-t 10 --retcode-passthrough --no-color" |
Jiri Broulik | 05c5b60 | 2018-04-11 13:52:37 +0200 | [diff] [blame] | 6 | |
azvyagintsev | 0adfe68 | 2018-06-13 16:29:40 +0300 | [diff] [blame] | 7 | salt-call ${SALT_OPTS} reclass.validate_pillar |
Jiri Broulik | aa400a0 | 2018-04-12 00:18:47 +0200 | [diff] [blame] | 8 | |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 9 | echo "deb [arch=amd64] ${APT_MIRANTIS_SALT_REPO}" > /etc/apt/sources.list.d/mcp_salt.list |
| 10 | apt-get update |
| 11 | apt-get install salt-formula* -y |
azvyagintsev | 0adfe68 | 2018-06-13 16:29:40 +0300 | [diff] [blame] | 12 | |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 13 | salt-call saltutil.refresh_pillar |
| 14 | salt-call saltutil.sync_all |
azvyagintsev | 0adfe68 | 2018-06-13 16:29:40 +0300 | [diff] [blame] | 15 | salt-call ${SALT_OPTS} state.sls salt |
| 16 | salt-call ${SALT_OPTS} state.sls linux.system.repo,linux.system.package,linux.system.user,linux.system.directory,linux.system.config |
| 17 | salt-call ${SALT_OPTS} state.sls linux.network |
| 18 | salt-call ${SALT_OPTS} state.sls openssh |
| 19 | salt-call ${SALT_OPTS} state.sls git.server |
| 20 | salt-call ${SALT_OPTS} state.sls postgresql |
| 21 | # install only MAAS packages, don't configure anything. |
| 22 | # Configuration will be processed during cfg01 initialization. |
| 23 | # Those step, required to have clean MAAS configuration - w\o auto import and etc. |
| 24 | salt-call ${SALT_OPTS} state.sls_id maas_cluster_packages maas |
| 25 | salt-call ${SALT_OPTS} state.sls_id maas_region_packages maas |
| 26 | |
Jiri Broulik | 3ffb745 | 2018-04-12 10:37:07 +0200 | [diff] [blame] | 27 | # linux.system.file only for backwards compatibility of jenkins - mcp-common-scripts |
azvyagintsev | 0adfe68 | 2018-06-13 16:29:40 +0300 | [diff] [blame] | 28 | salt-call ${SALT_OPTS} state.sls jenkins.master,linux.system.file |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 29 | sleep 60 |
| 30 | salt-call -t 5 --no-color state.sls jenkins.client.plugin |
| 31 | systemctl restart jenkins |
| 32 | sleep 60 |
| 33 | # Jenkins Mirantis theme |
azvyagintsev | 0adfe68 | 2018-06-13 16:29:40 +0300 | [diff] [blame] | 34 | # FIXME move those into cluster model |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 35 | git clone https://github.com/Mirantis/docker-jenkins.git |
| 36 | cp -r docker-jenkins/theme /var/lib/jenkins/userContent |
| 37 | chown -R jenkins:jenkins /var/lib/jenkins/userContent/* |
| 38 | # finish Jenkins setup |
| 39 | salt-call -t 5 --no-color state.sls jenkins.client.plugin |
| 40 | systemctl restart jenkins |
| 41 | sleep 60 |
| 42 | salt-call -t 5 --no-color state.sls jenkins.client |
| 43 | systemctl restart jenkins |
| 44 | sleep 60 |
azvyagintsev | 0adfe68 | 2018-06-13 16:29:40 +0300 | [diff] [blame] | 45 | salt-call ${SALT_OPTS} state.sls jenkins.client |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 46 | |
azvyagintsev | 05e8437 | 2018-10-17 17:31:28 +0300 | [diff] [blame] | 47 | # Duplicate of ubuntu_info.sh |
| 48 | mkdir -p /var/log/bootstrap_logs/ ; pushd /var/log/bootstrap_logs/ |
| 49 | # Drop some reclass info,if available |
| 50 | if [[ $(which salt-key) ]] ; then |
| 51 | for node in $(salt-key -l acc | grep -v 'Accepted Keys:') ; do |
| 52 | salt ${node} pillar.data --out=json > ${node}.pillardata.json || true |
| 53 | reclass -n ${node} -o json > ${node}.reclass.json || true |
| 54 | done |
| 55 | fi |
| 56 | popd |