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 | |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 7 | echo "deb [arch=amd64] ${APT_MIRANTIS_SALT_REPO}" > /etc/apt/sources.list.d/mcp_salt.list |
| 8 | apt-get update |
| 9 | apt-get install salt-formula* -y |
azvyagintsev | 0adfe68 | 2018-06-13 16:29:40 +0300 | [diff] [blame] | 10 | |
Ivan Berezovskiy | 738ce82 | 2018-11-16 13:00:24 +0400 | [diff] [blame^] | 11 | # Wait for salt-master and salt-minion to wake up after restart |
| 12 | # since we just perform 'reboot.sh' |
| 13 | salt-call --timeout=120 test.ping |
| 14 | |
| 15 | salt-call ${SALT_OPTS} saltutil.clear_cache |
| 16 | salt-call ${SALT_OPTS} saltutil.refresh_pillar |
| 17 | salt-call ${SALT_OPTS} saltutil.sync_all |
| 18 | salt-call ${SALT_OPTS} reclass.validate_pillar |
| 19 | |
| 20 | salt-call ${SALT_OPTS} state.sls linux.system.repo,linux.system.package,linux.system.user,linux.system.directory,linux.system.file,linux.system.config |
azvyagintsev | 0adfe68 | 2018-06-13 16:29:40 +0300 | [diff] [blame] | 21 | salt-call ${SALT_OPTS} state.sls linux.network |
Ivan Berezovskiy | 738ce82 | 2018-11-16 13:00:24 +0400 | [diff] [blame^] | 22 | salt-call ${SALT_OPTS} state.sls salt.minion.ca |
| 23 | |
| 24 | salt-call ${SALT_OPTS} state.sls salt |
| 25 | salt-call ${SALT_OPTS} state.sls docker.host |
| 26 | |
azvyagintsev | 0adfe68 | 2018-06-13 16:29:40 +0300 | [diff] [blame] | 27 | salt-call ${SALT_OPTS} state.sls openssh |
| 28 | salt-call ${SALT_OPTS} state.sls git.server |
| 29 | salt-call ${SALT_OPTS} state.sls postgresql |
| 30 | # install only MAAS packages, don't configure anything. |
| 31 | # Configuration will be processed during cfg01 initialization. |
| 32 | # Those step, required to have clean MAAS configuration - w\o auto import and etc. |
| 33 | salt-call ${SALT_OPTS} state.sls_id maas_cluster_packages maas |
| 34 | salt-call ${SALT_OPTS} state.sls_id maas_region_packages maas |
| 35 | |
azvyagintsev | 0adfe68 | 2018-06-13 16:29:40 +0300 | [diff] [blame] | 36 | # FIXME move those into cluster model |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 37 | git clone https://github.com/Mirantis/docker-jenkins.git |
Ivan Berezovskiy | 738ce82 | 2018-11-16 13:00:24 +0400 | [diff] [blame^] | 38 | mkdir -p /srv/volumes/jenkins/userContent/theme/ |
| 39 | cp -r docker-jenkins/theme/* /srv/volumes/jenkins/userContent/theme/ |
| 40 | rm -rf docker-jenkins |
| 41 | chown -R 1000:1000 /srv/volumes/jenkins/userContent/ |
| 42 | |
| 43 | docker pull "docker-prod-local.artifactory.mirantis.com/mirantis/cicd/jenkins:${MCP_VERSION}" |
| 44 | docker pull "docker-prod-local.artifactory.mirantis.com/mirantis/cicd/jnlp-slave:${MCP_VERSION}" |
| 45 | # Flag for cloud-init script |
| 46 | touch /root/jenkins_in_docker |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 47 | |
azvyagintsev | 05e8437 | 2018-10-17 17:31:28 +0300 | [diff] [blame] | 48 | # Duplicate of ubuntu_info.sh |
| 49 | mkdir -p /var/log/bootstrap_logs/ ; pushd /var/log/bootstrap_logs/ |
| 50 | # Drop some reclass info,if available |
| 51 | if [[ $(which salt-key) ]] ; then |
| 52 | for node in $(salt-key -l acc | grep -v 'Accepted Keys:') ; do |
| 53 | salt ${node} pillar.data --out=json > ${node}.pillardata.json || true |
| 54 | reclass -n ${node} -o json > ${node}.reclass.json || true |
| 55 | done |
| 56 | fi |
| 57 | popd |