sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 1 | {% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import HOSTNAME_CFG01 with context %} |
| 2 | {% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import LAB_CONFIG_NAME with context %} |
| 3 | {% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import DOMAIN_NAME with context %} |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 4 | {% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import HOSTNAME_KVM01 with context %} |
| 5 | {% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import HOSTNAME_KVM02 with context %} |
| 6 | {% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import HOSTNAME_KVM03 with context %} |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 7 | |
| 8 | {% set SALT_MODELS_REPOSITORY = os_env('SALT_MODELS_REPOSITORY','https://gerrit.mcp.mirantis.net/salt-models/mcp-virtual-lab') %} |
| 9 | # Other salt model repository parameters see in shared-salt.yaml |
| 10 | |
| 11 | # Name of the context file (without extension, that is fixed .yaml) used to render the Environment model |
| 12 | {% set ENVIRONMENT_MODEL_INVENTORY_NAME = os_env('ENVIRONMENT_MODEL_INVENTORY_NAME','physical-cookied-bm-mcp-ocata-contrail') %} |
| 13 | # Path to the context files used to render Cluster and Environment models |
sgudz | 868f086 | 2018-03-16 21:47:18 +0200 | [diff] [blame] | 14 | {%- set CLUSTER_CONTEXT_NAME = 'salt-context-cookiecutter-contrail.yaml' %} |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 15 | {%- set ENVIRONMENT_CONTEXT_NAMES = ['salt-context-environment.yaml','lab04-physical-inventory.yaml'] %} |
| 16 | {%- set CONTROL_VLAN = os_env('CONTROL_VLAN', '2422') %} |
| 17 | {%- set TENANT_VLAN = os_env('TENANT_VLAN', '2423') %} |
| 18 | |
| 19 | |
| 20 | {% import 'shared-salt.yaml' as SHARED with context %} |
| 21 | |
| 22 | {{ SHARED.MACRO_INSTALL_SALT_MASTER() }} |
| 23 | |
| 24 | {{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL(CONTROL_VLAN=CONTROL_VLAN, TENANT_VLAN=TENANT_VLAN) }} |
| 25 | |
| 26 | {{ SHARED.MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL() }} |
| 27 | |
Tatyana Leontovich | eedbd85 | 2018-07-10 11:29:38 +0300 | [diff] [blame] | 28 | {{ SHARED.MACRO_CONFIGURE_RECLASS(FORMULA_SERVICES='"linux" "reclass" "salt" "openssh" "ntp" "git" "nginx" "collectd" "sensu" "heka" "sphinx" "keystone" "mysql" "grafana" "haproxy" "rsyslog" "horizon" "prometheus" "telegraf" "elasticsearch" "powerdns" "glusterfs" "xtrabackup" "maas" "backupninja" "jenkins" "fluentd" "auditd" ') }} |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 29 | |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 30 | {{ SHARED.MACRO_INSTALL_SALT_MINIONS() }} |
| 31 | |
| 32 | {{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }} |
| 33 | |
Dennis Dmitriev | 257a938 | 2018-02-15 04:00:46 +0200 | [diff] [blame] | 34 | {{ SHARED.ADJUST_SL_OPTS(OVERRIDES_FILENAME='/srv/salt/reclass/classes/environment/' + ENVIRONMENT_MODEL_INVENTORY_NAME + '/overrides.yml') }} |
| 35 | |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 36 | - description: "Workaround for rack01 compute generator" |
| 37 | cmd: | |
| 38 | set -e; |
| 39 | # Remove rack01 key |
Dennis Dmitriev | d96ace1 | 2018-01-26 14:46:21 +0200 | [diff] [blame] | 40 | . /root/venv-reclass-tools/bin/activate; |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 41 | reclass-tools del-key parameters.reclass.storage.node.openstack_compute_rack01 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml; |
| 42 | # Add openstack_compute_node definition from system |
| 43 | reclass-tools add-key 'classes' 'system.reclass.storage.system.openstack_compute_multi' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml --merge; |
sgudz | 868f086 | 2018-03-16 21:47:18 +0200 | [diff] [blame] | 44 | node_name: {{ HOSTNAME_CFG01 }} |
| 45 | retry: {count: 1, delay: 10} |
| 46 | skip_fail: false |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 47 | |
sgudz | 868f086 | 2018-03-16 21:47:18 +0200 | [diff] [blame] | 48 | - description: "WR for changing image to proposed" |
| 49 | cmd: | |
| 50 | set -e; |
| 51 | # Add message_queu host for opencontrail |
| 52 | . /root/venv-reclass-tools/bin/activate; |
| 53 | reclass-tools add-key parameters._param.salt_control_xenial_image 'http://ci.mcp.mirantis.net:8085/images/ubuntu-16-04-x64-mcpproposed.qcow2' /srv/salt/reclass/classes/cluster/cookied-bm-mcp-ocata-contrail/infra/init.yml; |
| 54 | reclass-tools add-key parameters._param.salt_control_trusty_image 'http://ci.mcp.mirantis.net:8085/images/ubuntu-14-04-x64-mcpproposed.qcow2' /srv/salt/reclass/classes/cluster/cookied-bm-mcp-ocata-contrail/infra/init.yml; |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 55 | node_name: {{ HOSTNAME_CFG01 }} |
| 56 | retry: {count: 1, delay: 10} |
| 57 | skip_fail: false |
| 58 | |
| 59 | {{ SHARED.MACRO_GENERATE_INVENTORY() }} |
| 60 | |
| 61 | {{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }} |
| 62 | |
| 63 | |
| 64 | - description: "Workaround for PROD-14060" |
| 65 | cmd: | |
| 66 | set -e; |
| 67 | # Add tenant and single addresses for computes |
sgudz | b3f5fe4 | 2018-02-06 17:06:53 +0200 | [diff] [blame] | 68 | salt-call reclass.cluster_meta_set deploy_address 172.16.49.73 /srv/salt/reclass/nodes/_generated/cmp001.cookied-bm-mcp-ocata-contrail.local.yml |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 69 | salt-call reclass.cluster_meta_set tenant_address 192.168.0.101 /srv/salt/reclass/nodes/_generated/cmp001.cookied-bm-mcp-ocata-contrail.local.yml |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 70 | salt-call reclass.cluster_meta_set single_address 10.167.8.101 /srv/salt/reclass/nodes/_generated/cmp001.cookied-bm-mcp-ocata-contrail.local.yml |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 71 | |
| 72 | salt-call reclass.cluster_meta_set deploy_address 172.16.49.74 /srv/salt/reclass/nodes/_generated/cmp002.cookied-bm-mcp-ocata-contrail.local.yml |
| 73 | salt-call reclass.cluster_meta_set tenant_address 192.168.0.102 /srv/salt/reclass/nodes/_generated/cmp002.cookied-bm-mcp-ocata-contrail.local.yml |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 74 | salt-call reclass.cluster_meta_set single_address 10.167.8.102 /srv/salt/reclass/nodes/_generated/cmp002.cookied-bm-mcp-ocata-contrail.local.yml |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 75 | |
| 76 | node_name: {{ HOSTNAME_CFG01 }} |
| 77 | retry: {count: 1, delay: 10} |
| 78 | skip_fail: false |
| 79 | |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 80 | |
| 81 | - description: Temporary workaround for removing cinder-volume from CTL nodes |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 82 | cmd: | |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 83 | sed -i 's/\-\ system\.cinder\.volume\.single//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml; |
| 84 | sed -i 's/\-\ system\.cinder\.volume\.notification\.messagingv2//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml; |
| 85 | node_name: {{ HOSTNAME_CFG01 }} |
| 86 | retry: {count: 1, delay: 5} |
| 87 | skip_fail: true |
| 88 | |
sgudz | 868f086 | 2018-03-16 21:47:18 +0200 | [diff] [blame] | 89 | - description: Temporary WR for correct bridge name according to envoronment templates |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 90 | cmd: | |
sgudz | 868f086 | 2018-03-16 21:47:18 +0200 | [diff] [blame] | 91 | sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml; |
| 92 | sed -i 's/br\-mgm/br\_mgm/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml; |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 93 | node_name: {{ HOSTNAME_CFG01 }} |
| 94 | retry: {count: 1, delay: 10} |
sgudz | 868f086 | 2018-03-16 21:47:18 +0200 | [diff] [blame] | 95 | skip_fail: false |
| 96 | |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 97 | {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
| 98 | |
| 99 | ######################################## |
| 100 | # Spin up Control Plane VMs on KVM nodes |
| 101 | ######################################## |
| 102 | |
| 103 | - description: Execute 'libvirt' states to create necessary libvirt networks |
| 104 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt |
| 105 | node_name: {{ HOSTNAME_CFG01 }} |
| 106 | retry: {count: 2, delay: 10} |
| 107 | skip_fail: false |
| 108 | |
| 109 | - description: Create VMs for control plane |
| 110 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control |
| 111 | node_name: {{ HOSTNAME_CFG01 }} |
| 112 | retry: {count: 3, delay: 10} |
| 113 | skip_fail: false |
| 114 | |
| 115 | - description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)' |
| 116 | cmd: | |
| 117 | salt-key -l acc| sort > /tmp/current_keys.txt && |
| 118 | salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt |
| 119 | node_name: {{ HOSTNAME_CFG01 }} |
| 120 | retry: {count: 20, delay: 30} |
| 121 | skip_fail: false |
| 122 | |
| 123 | ######################################### |
| 124 | # Configure all running salt minion nodes |
| 125 | ######################################### |
| 126 | |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 127 | - description: Hack resolv.conf on VCP nodes for internal services access |
| 128 | cmd: | |
| 129 | salt --hard-crash --state-output=mixed --state-verbose=False -C '* and not kvm* and not cmp* and not gtw* and not cfg*' cmd.run "echo 'nameserver 172.18.208.44' > /etc/resolv.conf;" |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 130 | node_name: {{ HOSTNAME_CFG01 }} |
| 131 | retry: {count: 1, delay: 5} |
| 132 | skip_fail: false |
| 133 | |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 134 | - description: Refresh pillars on all minions |
| 135 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar |
| 136 | node_name: {{ HOSTNAME_CFG01 }} |
| 137 | retry: {count: 1, delay: 5} |
| 138 | skip_fail: false |
| 139 | |
| 140 | - description: Sync all salt resources |
| 141 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5 |
| 142 | node_name: {{ HOSTNAME_CFG01 }} |
| 143 | retry: {count: 1, delay: 5} |
| 144 | skip_fail: false |
| 145 | |
| 146 | - description: Show reclass-salt --top for generated nodes |
| 147 | cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/ |
| 148 | node_name: {{ HOSTNAME_CFG01 }} |
| 149 | retry: {count: 1, delay: 5} |
| 150 | skip_fail: false |
| 151 | |
| 152 | {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
Tatyana Leontovich | 4453dd6 | 2018-06-26 18:44:31 +0300 | [diff] [blame] | 153 | |
| 154 | {{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}} |
| 155 | |
| 156 | {{SHARED.MACRO_CHECK_SALT_VERSION_ON_NODES()}} |