| {% set HOSTNAME_CFG01='cfg01.bm-b300-e7-cicd-pike-ovs-maas.local' %} |
| {% set LAB_CONFIG_NAME='bm-b300-e7-cicd-pike-ovs-maas' %} |
| {% set DOMAIN_NAME='bm-b300-e7-cicd-pike-ovs-maas.local' %} |
| |
| {% import 'shared-salt.yaml' as SHARED with context %} |
| {% import 'shared-test-tools.yaml' as SHARED_TEST_TOOLS with context %} |
| {% import 'shared-workarounds.yaml' as SHARED_WORKAROUNDS with context %} |
| {% import 'shared-maas.yaml' as SHARED_MAAS with context %} |
| |
| - description: Wait for salt-master is ready after configdrive user-data |
| cmd: | |
| timeout 120 salt-call test.ping |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 2, delay: 5} |
| skip_fail: false |
| |
| {{ SHARED.MACRO_INSTALL_SALT_MINIONS() }} |
| |
| {{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}} |
| |
| {{SHARED.MACRO_CHECK_SALT_VERSION_ON_NODES()}} |
| |
| - description: Generate a public key for machines in MAAS |
| cmd: | |
| ssh-keygen -y -f ~root/.ssh/id_rsa > ~root/.ssh/id_rsa.pub |
| maas mirantis sshkeys create key="$(cat ~root/.ssh/id_rsa.pub)" |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: Run comissioning of BM nodes |
| cmd: | |
| salt-call maas.process_machines |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: Wait for machines ready |
| cmd: | |
| salt-call maas.machines_status && timeout 120 salt-call state.sls maas.machines.wait_for_ready |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 7, delay: 5} |
| skip_fail: false |
| |
| - description: Enforce the interfaces configuration defined in the model for servers |
| cmd: | |
| salt-call state.sls maas.machines.assign_ip; |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: Assign drive partitions to machines |
| cmd: salt-call state.sls maas.machines.storage |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: Remove all the salt-minions and re-register the cfg01 minion |
| cmd: | |
| salt-key -y -D; |
| salt-call test.ping |
| sleep 5 |
| # Check that the cfg01 is registered |
| salt-key | grep cfg01 |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: provision the automatically commissioned physical nodes through MAAS |
| cmd: | |
| salt-call maas.deploy_machines; |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 3, delay: 5} |
| skip_fail: false |
| |
| - description: Wait for machines deployed |
| cmd: | |
| salt-call maas.machines_status && timeout 300 salt-call state.sls maas.machines.wait_for_deployed |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 8, delay: 5} |
| skip_fail: false |
| |
| {{SHARED_TEST_TOOLS.MACRO_INSTALL_RECLASS_TOOLS()}} |
| {{ SHARED_WORKAROUNDS.CLEAR_CEPH_OSD_DRIVES() }} |
| |
| - description: Add route cfg01 to kvm01, remove rp_filter (CIS-3-2-7) |
| cmd: | |
| set -x; |
| set -e; |
| salt 'kvm01*' cmd.run 'sysctl -w net.ipv4.ip_forward=1'; |
| ip route add 10.167.10.0/23 via 172.16.162.67; |
| sed -i 's/er: 1/er: 0/g' /srv/salt/reclass/classes/service/linux/system/cis/cis-3-2-7.yml; |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: Create an alias to ens3 and NAT for the new net |
| cmd: | |
| set -x; |
| set -e; |
| iptables -t nat -I POSTROUTING -s 10.200.200.0/23 -j MASQUERADE; |
| ip addr add 10.200.200.1/23 dev ens3 |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: "Upload maas_subnet_add.yml to cfg01.{{ DOMAIN_NAME }}" |
| upload: |
| local_path: {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/ |
| local_filename: maas_subnet_add.yml |
| remote_path: /root/ |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 10} |
| skip_fail: false |
| |
| - description: "Modify model to add the new MAAS network" |
| cmd: | |
| set -e; |
| set -x; |
| . /root/venv-reclass-tools/bin/activate; |
| reclass-tools merge-context /root/maas_subnet_add.yml /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/maas.yml; |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: "Rerun maas.region state" |
| cmd: | |
| set -e; |
| set -x; |
| salt 'cfg01*' state.sls maas.region |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |