blob: 57c0417c1c1ae124c109c8ca1dd096ca14ae82de [file] [log] [blame]
{% from 'virtual-mcp10-ovs/map.jinja' import HOSTNAME_CFG01 with context %}
{% from 'virtual-mcp10-ovs/map.jinja' import LAB_CONFIG_NAME with context %}
{% from 'virtual-mcp10-ovs/map.jinja' import DOMAIN_NAME with context %}
{% set SALT_MODELS_REPOSITORY = os_env('SALT_MODELS_REPOSITORY','https://gerrit.mcp.mirantis.net/salt-models/mcp-virtual-lab') %}
# Other salt model repository parameters see in shared-salt.yaml
{% import 'shared-salt.yaml' as SHARED with context %}
# Install salt to the config node
- description: Configure repository on the cfg01 node
cmd:
echo "nameserver 172.18.208.44" >> /etc/resolv.conf;
which wget >/dev/null || (apt-get update; apt-get install -y wget);
echo "deb [arch=amd64] http://apt.mirantis.com/xenial nightly salt extra" > /etc/apt/sources.list.d/mcp_salt.list;
wget -O - http://apt.mirantis.com/public.gpg | apt-key add -;
echo "deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3 xenial main" > /etc/apt/sources.list.d/saltstack.list;
wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3/SALTSTACK-GPG-KEY.pub | apt-key add -;
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 1}
skip_fail: false
- description: Update packages on cfg01
cmd: apt-get clean; apt-get update
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 1}
skip_fail: false
- description: Install common packages on cfg01
cmd: apt-get install -y python-pip wget curl tmux byobu iputils-ping traceroute htop tree
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 1}
skip_fail: false
{{ SHARED.MACRO_INSTALL_SALT_MASTER() }}
{{ SHARED.MACRO_CLONE_RECLASS_MODELS() }}
{{ SHARED.MACRO_CONFIGURE_RECLASS(FORMULA_SERVICES='"linux" "reclass" "salt" "openssh" "ntp" "git" "nginx" "collectd" "sensu" "heka" "sphinx" "keystone" "mysql" "grafana" "haproxy" "rsyslog" "horizon"') }}
- description: Configure salt-minion on cfg01
cmd: |
[ ! -d /etc/salt/minion.d ] && mkdir -p /etc/salt/minion.d;
cat << "EOF" >> /etc/salt/minion.d/minion.conf
id: {{ HOSTNAME_CFG01 }}
master: 127.0.0.1
EOF
apt-get install -y salt-minion;
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 1}
skip_fail: false
- description: Restart services
cmd: |
systemctl restart salt-master;
systemctl restart salt-minion;
echo "Showing system info and metadata ...";
salt-call --no-color grains.items;
salt-call --no-color pillar.data;
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
{{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }}
{{ SHARED.MACRO_GENERATE_INVENTORY() }}
{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
- description: Hack gtw node
cmd: salt 'gtw*' cmd.run "ip addr del 172.16.10.110/24 dev ens4; ip addr flush dev ens4";
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: Hack cmp01 node
cmd: salt 'cmp01*' cmd.run "ip addr del 172.16.10.105/24 dev ens4; ip addr flush dev ens4";
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: Hack cmp02 node
cmd: salt 'cmp02*' cmd.run "ip addr del 172.16.10.106/24 dev ens4; ip addr flush dev ens4";
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false