Split MACRO_GENERATE_COOKIECUTTER_MODELS on two macros
Create two separated macros to more flexible usage:
1. MACRO_GENERATE_COOKIECUTTER_MODEL
2. MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL
Change-Id: I95573ac6637a3f96bbd1a8b7da63ff145afb4b81
diff --git a/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/salt-context-cicd_oss.yaml b/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/salt-context-cookiecutter-cicd_oss.yaml
similarity index 100%
rename from tcp_tests/templates/cookied-mcp-ocata-dop-sl2/salt-context-cicd_oss.yaml
rename to tcp_tests/templates/cookied-mcp-ocata-dop-sl2/salt-context-cookiecutter-cicd_oss.yaml
diff --git a/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/salt.yaml b/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/salt.yaml
index fe37cfc..72abd74 100644
--- a/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/salt.yaml
+++ b/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/salt.yaml
@@ -8,14 +8,18 @@
# Name of the context file (without extension, that is fixed .yaml) used to render the Environment model
{% set ENVIRONMENT_MODEL_INVENTORY_NAME = os_env('ENVIRONMENT_MODEL_INVENTORY_NAME','virtual-mcp-ocata-dop-sl2') %}
# Path to the context files used to render Cluster and Environment models
-{%- set CLUSTER_CONTEXT_PATH = '/tmp/environment/salt-context-cicd_oss.yaml' %}
-{%- set ENVIRONMENT_CONTEXT_PATH = '/tmp/environment/salt-context-environment.yaml' %}
+{%- set CLUSTER_CONTEXT_NAME = 'salt-context-cookiecutter-cicd_oss.yaml' %}
+{%- set ENVIRONMENT_CONTEXT_NAME = 'salt-context-environment.yaml' %}
+{%- set CLUSTER_CONTEXT_PATH = '/tmp/environment/' + CLUSTER_CONTEXT_NAME %}
+{%- set ENVIRONMENT_CONTEXT_PATH = '/tmp/environment/' + ENVIRONMENT_CONTEXT_NAME %}
{% import 'shared-salt.yaml' as SHARED with context %}
{{ SHARED.MACRO_INSTALL_SALT_MASTER() }}
-{{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODELS() }}
+{{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL() }}
+
+{{ SHARED.MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL() }}
{{ 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"') }}
diff --git a/tcp_tests/templates/cookied-mcp-ocata-dvr-vxlan/salt-context-cookiecutter-openstack_ovs_dvr_vxlan.yaml b/tcp_tests/templates/cookied-mcp-ocata-dvr-vxlan/salt-context-cookiecutter-openstack_ovs_dvr_vxlan.yaml
new file mode 100644
index 0000000..4f0f646
--- /dev/null
+++ b/tcp_tests/templates/cookied-mcp-ocata-dvr-vxlan/salt-context-cookiecutter-openstack_ovs_dvr_vxlan.yaml
@@ -0,0 +1,142 @@
+default_context:
+ cicd_control_node01_address: 10.167.4.91
+ cicd_control_node01_hostname: cid01
+ cicd_control_node02_address: 10.167.4.92
+ cicd_control_node02_hostname: cid02
+ cicd_control_node03_address: 10.167.4.93
+ cicd_control_node03_hostname: cid03
+ cicd_control_vip_address: 10.167.4.90
+ cicd_control_vip_hostname: cid
+ cicd_enabled: 'True'
+ cicd_private_key: <<WILL_BE_GENERATED>>
+ cicd_public_key: <<WILL_BE_GENERATED>>
+ cluster_domain: deploy-name.local
+ cluster_name: deployment_name
+ deployment_type: physical
+ compute_primary_first_nic: eth1
+ compute_primary_second_nic: eth2
+ control_network_netmask: 255.255.255.0
+ control_vlan: '10'
+ deploy_network_gateway: ''
+ deploy_network_netmask: 255.255.255.0
+ dns_server01: 8.8.8.8
+ dns_server02: 8.8.4.4
+ gateway_primary_first_nic: eth1
+ gateway_primary_second_nic: eth2
+ infra_deploy_nic: eth0
+ maas_deploy_address: 10.167.4.91
+ maas_hostname: mas01
+ upstream_proxy_enabled: True
+ upstream_proxy_address: 10.167.5.1
+ upstream_proxy_port: 8080
+ infra_kvm01_control_address: 10.167.4.241
+ infra_kvm01_deploy_address: 10.167.5.241
+ infra_kvm01_hostname: kvm01
+ infra_kvm02_control_address: 10.167.4.242
+ infra_kvm02_deploy_address: 10.167.5.242
+ infra_kvm02_hostname: kvm02
+ infra_kvm03_control_address: 10.167.4.243
+ infra_kvm03_deploy_address: 10.167.5.243
+ infra_kvm03_hostname: kvm03
+ infra_kvm_vip_address: 10.167.4.240
+ infra_primary_first_nic: eth1
+ infra_primary_second_nic: eth2
+ kubernetes_enabled: 'False'
+ opencontrail_enabled: 'False'
+ openldap_enabled: 'False'
+ openstack_compute_count: '100'
+ openstack_compute_rack01_hostname: cmp
+ openstack_compute_rack01_single_subnet: 10.167.4
+ openstack_compute_rack01_tenant_subnet: 10.167.6
+ openstack_control_address: 10.167.4.10
+ openstack_control_hostname: ctl
+ openstack_control_node01_address: 10.167.4.11
+ openstack_control_node01_hostname: ctl01
+ openstack_control_node02_address: 10.167.4.12
+ openstack_control_node02_hostname: ctl02
+ openstack_control_node03_address: 10.167.4.13
+ openstack_control_node03_hostname: ctl03
+ openstack_database_address: 10.167.4.50
+ openstack_database_hostname: dbs
+ openstack_database_node01_address: 10.167.4.51
+ openstack_database_node01_hostname: dbs01
+ openstack_database_node02_address: 10.167.4.52
+ openstack_database_node02_hostname: dbs02
+ openstack_database_node03_address: 10.167.4.53
+ openstack_database_node03_hostname: dbs03
+ openstack_enabled: 'True'
+ openstack_gateway_node01_address: 10.167.4.224
+ openstack_gateway_node01_hostname: gtw01
+ openstack_gateway_node01_tenant_address: 10.167.6.6
+ openstack_gateway_node02_address: 10.167.4.225
+ openstack_gateway_node02_hostname: gtw02
+ openstack_gateway_node02_tenant_address: 10.167.6.7
+ openstack_gateway_node03_address: 10.167.4.226
+ openstack_gateway_node03_hostname: gtw03
+ openstack_gateway_node03_tenant_address: 10.167.6.8
+ openstack_message_queue_address: 10.167.4.40
+ openstack_message_queue_hostname: msg
+ openstack_message_queue_node01_address: 10.167.4.41
+ openstack_message_queue_node01_hostname: msg01
+ openstack_message_queue_node02_address: 10.167.4.42
+ openstack_message_queue_node02_hostname: msg02
+ openstack_message_queue_node03_address: 10.167.4.43
+ openstack_message_queue_node03_hostname: msg03
+ openstack_network_engine: ovs
+ openstack_nfv_dpdk_enabled: 'False'
+ openstack_nfv_sriov_enabled: 'False'
+ openstack_ovs_dvr_enabled: 'True'
+ openstack_neutron_qos: 'False'
+ openstack_neutron_vlan_aware_vms: 'False'
+ openstack_ovs_encapsulation_type: vxlan
+ openstack_proxy_address: 10.167.4.80
+ openstack_proxy_hostname: prx
+ openstack_proxy_node01_address: 10.167.4.81
+ openstack_proxy_node01_hostname: prx01
+ openstack_proxy_node02_address: 10.167.4.82
+ openstack_proxy_node02_hostname: prx02
+ openstack_telemetry_address: 10.167.4.75
+ openstack_telemetry_hostname: mdb
+ openstack_telemetry_node01_address: 10.167.4.76
+ openstack_telemetry_node01_hostname: mdb01
+ openstack_telemetry_node02_address: 10.167.4.77
+ openstack_telemetry_node02_hostname: mdb02
+ openstack_telemetry_node03_address: 10.167.4.78
+ openstack_telemetry_node03_hostname: mdb03
+ openstack_benchmark_node01_hostname: bmk01
+ openstack_benchmark_node01_address: 10.167.4.85
+ openstack_version: ocata
+ public_host: ${_param:openstack_proxy_address}
+ reclass_repository: https://github.com/Mirantis/mk-lab-salt-model.git
+ salt_master_address: 10.167.4.15
+ salt_master_hostname: cfg01
+ salt_master_management_address: 10.167.5.15
+ stacklight_enabled: 'True'
+ stacklight_version: '2'
+ stacklight_log_address: 10.167.4.60
+ stacklight_log_hostname: log
+ stacklight_log_node01_address: 10.167.4.61
+ stacklight_log_node01_hostname: log01
+ stacklight_log_node02_address: 10.167.4.62
+ stacklight_log_node02_hostname: log02
+ stacklight_log_node03_address: 10.167.4.63
+ stacklight_log_node03_hostname: log03
+ stacklight_monitor_address: 10.167.4.70
+ stacklight_monitor_hostname: mon
+ stacklight_monitor_node01_address: 10.167.4.71
+ stacklight_monitor_node01_hostname: mon01
+ stacklight_monitor_node02_address: 10.167.4.72
+ stacklight_monitor_node02_hostname: mon02
+ stacklight_monitor_node03_address: 10.167.4.73
+ stacklight_monitor_node03_hostname: mon03
+ stacklight_telemetry_address: 10.167.4.85
+ stacklight_telemetry_hostname: mtr
+ stacklight_telemetry_node01_address: 10.167.4.86
+ stacklight_telemetry_node01_hostname: mtr01
+ stacklight_telemetry_node02_address: 10.167.4.87
+ stacklight_telemetry_node02_hostname: mtr02
+ stacklight_telemetry_node03_address: 10.167.4.88
+ stacklight_telemetry_node03_hostname: mtr03
+ tenant_network_gateway: ''
+ tenant_network_netmask: 255.255.255.0
+ tenant_vlan: '20'
diff --git a/tcp_tests/templates/cookied-mcp-ocata-dvr-vxlan/salt-context-environment.yaml b/tcp_tests/templates/cookied-mcp-ocata-dvr-vxlan/salt-context-environment.yaml
new file mode 100644
index 0000000..c520c5c
--- /dev/null
+++ b/tcp_tests/templates/cookied-mcp-ocata-dvr-vxlan/salt-context-environment.yaml
@@ -0,0 +1,350 @@
+nodes:
+ cfg01.mcp11-ovs-dpdk.local:
+ reclass_storage_name: infra_config_node01
+ roles:
+ - infra_config
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ kvm01.mcp11-ovs-dpdk.local:
+ reclass_storage_name: infra_kvm_node01
+ roles:
+ - infra_kvm
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ kvm02.mcp11-ovs-dpdk.local:
+ reclass_storage_name: infra_kvm_node02
+ roles:
+ - infra_kvm
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ kvm03.mcp11-ovs-dpdk.local:
+ reclass_storage_name: infra_kvm_node03
+ roles:
+ - infra_kvm
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ cid01.mcp11-ovs-dpdk.local:
+ reclass_storage_name: cicd_control_node01
+ roles:
+ - cicd_control_leader
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ cid02.mcp11-ovs-dpdk.local:
+ reclass_storage_name: cicd_control_node02
+ roles:
+ - cicd_control_manager
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ cid03.mcp11-ovs-dpdk.local:
+ reclass_storage_name: cicd_control_node03
+ roles:
+ - cicd_control_manager
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ ctl01.mcp11-ovs-dpdk.local:
+ reclass_storage_name: openstack_control_node01
+ roles:
+ - openstack_control_leader
+ - features_designate
+ - features_designate_keystone
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ ctl02.mcp11-ovs-dpdk.local:
+ reclass_storage_name: openstack_control_node02
+ roles:
+ - openstack_control
+ - features_designate
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ ctl03.mcp11-ovs-dpdk.local:
+ reclass_storage_name: openstack_control_node03
+ roles:
+ - openstack_control
+ - features_designate
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ dbs01.mcp11-ovs-dpdk.local:
+ reclass_storage_name: openstack_database_node01
+ roles:
+ - openstack_database_leader
+ - features_designate_database
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ dbs02.mcp11-ovs-dpdk.local:
+ reclass_storage_name: openstack_database_node02
+ roles:
+ - openstack_database
+ - features_designate_database
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ dbs03.mcp11-ovs-dpdk.local:
+ reclass_storage_name: openstack_database_node03
+ roles:
+ - openstack_database
+ - features_designate_database
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ msg01.mcp11-ovs-dpdk.local:
+ reclass_storage_name: openstack_message_queue_node01
+ roles:
+ - openstack_message_queue
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ msg02.mcp11-ovs-dpdk.local:
+ reclass_storage_name: openstack_message_queue_node02
+ roles:
+ - openstack_message_queue
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ msg03.mcp11-ovs-dpdk.local:
+ reclass_storage_name: openstack_message_queue_node03
+ roles:
+ - openstack_message_queue
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ mdb01.mcp11-ovs-dpdk.local:
+ reclass_storage_name: openstack_telemetry_node01
+ roles:
+ - openstack_telemetry
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ mdb02.mcp11-ovs-dpdk.local:
+ reclass_storage_name: openstack_telemetry_node02
+ roles:
+ - openstack_telemetry
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ mdb03.mcp11-ovs-dpdk.local:
+ reclass_storage_name: openstack_telemetry_node03
+ roles:
+ - openstack_telemetry
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ prx01.mcp11-ovs-dpdk.local:
+ reclass_storage_name: openstack_proxy_node01
+ roles:
+ - openstack_proxy
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ prx02.mcp11-ovs-dpdk.local:
+ reclass_storage_name: openstack_proxy_node02
+ roles:
+ - openstack_proxy
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ mtr01.mcp11-ovs-dpdk.local:
+ reclass_storage_name: stacklight_telemetry_node01
+ roles:
+ - stacklight_telemetry_leader
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ mtr02.mcp11-ovs-dpdk.local:
+ reclass_storage_name: stacklight_telemetry_node02
+ roles:
+ - stacklight_telemetry
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ mtr03.mcp11-ovs-dpdk.local:
+ reclass_storage_name: stacklight_telemetry_node03
+ roles:
+ - stacklight_telemetry
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ log01.mcp11-ovs-dpdk.local:
+ reclass_storage_name: stacklight_log_node01
+ roles:
+ - stacklight_log_leader_v2
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ log02.mcp11-ovs-dpdk.local:
+ reclass_storage_name: stacklight_log_node02
+ roles:
+ - stacklight_log
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ log03.mcp11-ovs-dpdk.local:
+ reclass_storage_name: stacklight_log_node03
+ roles:
+ - stacklight_log
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: single_vlan_ctl
+
+ # Generator-based computes. For compatibility only
+ cmp<<count>>.mcp11-ovs-dpdk.local:
+ reclass_storage_name: openstack_compute_rack01
+ roles:
+ - openstack_compute
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: bond0_ab_ovs_vxlan_ctl_mesh
+ ens5:
+ role: bond0_ab_ovs_vxlan_ctl_mesh
+ ens6:
+ role: bond1_ab_ovs_floating
+
+ gtw01.mcp11-ovs-dpdk.local:
+ reclass_storage_name: openstack_gateway_node01
+ roles:
+ - openstack_gateway
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: bond0_ab_ovs_vxlan_ctl_mesh
+ ens5:
+ role: bond0_ab_ovs_vxlan_ctl_mesh
+ ens6:
+ role: bond1_ab_ovs_floating
+
+ gtw02.mcp11-ovs-dpdk.local:
+ reclass_storage_name: openstack_gateway_node02
+ roles:
+ - openstack_gateway
+ - linux_system_codename_xenial
+ interfaces:
+ ens3:
+ role: single_dhcp
+ ens4:
+ role: bond0_ab_ovs_vxlan_ctl_mesh
+ ens5:
+ role: bond0_ab_ovs_vxlan_ctl_mesh
+ ens6:
+ role: bond1_ab_ovs_floating
diff --git a/tcp_tests/templates/cookied-mcp-ocata-dvr-vxlan/salt.yaml b/tcp_tests/templates/cookied-mcp-ocata-dvr-vxlan/salt.yaml
index 2e10c12..9b11377 100644
--- a/tcp_tests/templates/cookied-mcp-ocata-dvr-vxlan/salt.yaml
+++ b/tcp_tests/templates/cookied-mcp-ocata-dvr-vxlan/salt.yaml
@@ -7,119 +7,19 @@
# Name of the context file (without extension, that is fixed .yaml) used to render the Environment model
{% set ENVIRONMENT_MODEL_INVENTORY_NAME = os_env('ENVIRONMENT_MODEL_INVENTORY_NAME','virtual-devops-mcp-ocata-sl2') %}
-
+# Path to the context files used to render Cluster and Environment models
+{%- set CLUSTER_CONTEXT_NAME = 'salt-context-cookiecutter-openstack_ovs_dvr_vxlan.yaml' %}
+{%- set ENVIRONMENT_CONTEXT_NAME = 'salt-context-environment.yaml' %}
+{%- set CLUSTER_CONTEXT_PATH = '/tmp/environment/' + CLUSTER_CONTEXT_NAME %}
+{%- set ENVIRONMENT_CONTEXT_PATH = '/tmp/environment/' + ENVIRONMENT_CONTEXT_NAME %}
{% import 'shared-salt.yaml' as SHARED with context %}
{{ SHARED.MACRO_INSTALL_SALT_MASTER() }}
+{{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL() }}
-{#{ SHARED.MACRO_CLONE_RECLASS_MODELS() }#}
-- description: Create cluster model from cookiecutter templates
- cmd: |
- set -e;
- pip install cookiecutter
- export GIT_SSL_NO_VERIFY=true; git clone https://gerrit.mcp.mirantis.net/mk/cookiecutter-templates /tmp/cookiecutter-templates
- mkdir -p /srv/salt/reclass/classes/cluster/
- mkdir -p /srv/salt/reclass/classes/system/
- mkdir -p /srv/salt/reclass/classes/service/
- mkdir -p /srv/salt/reclass/nodes/_generated
-
- {%- set CONTEXT_PATH = '/tmp/cookiecutter-templates/contexts/openstack_ovs_dvr_vxlan.yml' %}
-
- # Override some context parameters
- sed -i 's/cluster_name:.*/cluster_name: {{ LAB_CONFIG_NAME }}/g' {{ CONTEXT_PATH }}
- sed -i 's/cluster_domain:.*/cluster_domain: {{ DOMAIN_NAME }}/g' {{ CONTEXT_PATH }}
- sed -i 's/control_vlan:.*/control_vlan: \"2416\"/g' {{ CONTEXT_PATH }}
- sed -i 's/tenant_vlan:.*/tenant_vlan: \"2417\"/g' {{ CONTEXT_PATH }}
-
- # Temporary workaround (with hardcoded address .90 -> .15) of bug https://mirantis.jira.com/browse/PROD-14377
- sed -i 's/salt_master_address:.*/salt_master_address: {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.15/g' {{ CONTEXT_PATH }}
- sed -i 's/salt_master_management_address:.*/salt_master_management_address: {{ SHARED.IPV4_NET_ADMIN_PREFIX }}.15/g' {{ CONTEXT_PATH }}
-
- # Replace firstly to an intermediate value to avoid intersection between
- # already replaced and replacing networks.
- # For example, if generated IPV4_NET_ADMIN_PREFIX=10.16.0 , then there is a risk of replacing twice:
- # 192.168.10 -> 10.16.0 (generated network for admin)
- # 10.16.0 -> <external network>
- # So let's replace constant networks to the keywords, and then keywords to the desired networks.
- sed -i 's/10\.167\.5/==IPV4_NET_ADMIN_PREFIX==/g' {{ CONTEXT_PATH }}
- sed -i 's/10\.167\.4/==IPV4_NET_CONTROL_PREFIX==/g' {{ CONTEXT_PATH }}
- sed -i 's/10\.167\.6/==IPV4_NET_TENANT_PREFIX==/g' {{ CONTEXT_PATH }}
- sed -i 's/172\.17\.16\./==IPV4_NET_EXTERNAL_PREFIX==/g' {{ CONTEXT_PATH }}
-
- sed -i 's/==IPV4_NET_ADMIN_PREFIX==/{{ SHARED.IPV4_NET_ADMIN_PREFIX }}/g' {{ CONTEXT_PATH }}
- sed -i 's/==IPV4_NET_CONTROL_PREFIX==/{{ SHARED.IPV4_NET_CONTROL_PREFIX }}/g' {{ CONTEXT_PATH }}
- sed -i 's/==IPV4_NET_TENANT_PREFIX==/{{ SHARED.IPV4_NET_TENANT_PREFIX }}/g' {{ CONTEXT_PATH }}
- sed -i 's/==IPV4_NET_EXTERNAL_PREFIX==/{{ SHARED.IPV4_NET_EXTERNAL_PREFIX }}./g' {{ CONTEXT_PATH }}
-
- for i in $(ls /tmp/cookiecutter-templates/cluster_product/); do
- cookiecutter /tmp/cookiecutter-templates/cluster_product/$i \
- --config-file {{ CONTEXT_PATH }} \
- --output-dir /srv/salt/reclass/classes/cluster/ \
- --no-input -f;
- done
-
- export GIT_SSL_NO_VERIFY=true; git clone https://gerrit.mcp.mirantis.net/salt-models/reclass-system /srv/salt/reclass/classes/system/
-
- # Create the cfg01 node and disable checkouting the model from remote repository
- cat << 'EOF' >> /srv/salt/reclass/nodes/_generated/{{ HOSTNAME_CFG01 }}.yml
- classes:
- - cluster.{{ LAB_CONFIG_NAME }}.infra.config
- - environment.{{ ENVIRONMENT_MODEL_INVENTORY_NAME }}.reclass_datasource_local
- - environment.{{ ENVIRONMENT_MODEL_INVENTORY_NAME }}
-
- node_name: {{ HOSTNAME_CFG01 }}
- retry: {count: 1, delay: 1}
- skip_fail: false
-
-- description: Modify cluster model for testing purposes
- cmd: |
- set -e;
- apt-get -y install python-virtualenv python-pip build-essential python-dev libssl-dev;
- pip install git+https://github.com/dis-xcom/reclass-tools;
-
- # Enable 'root' user
- reclass-tools add-key classes system.openssh.server.team.all /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml --merge
- node_name: {{ HOSTNAME_CFG01 }}
- retry: {count: 1, delay: 1}
- skip_fail: false
-
-- description: "[EXPERIMENTAL] Upload 'environment' to {{ HOSTNAME_CFG01 }}"
- upload:
- local_path: {{ config.salt_deploy.environment_template_dir }}
- remote_path: /tmp/environment/
- node_name: {{ HOSTNAME_CFG01 }}
- skip_fail: false
-
-- description: "[EXPERIMENTAL] Remove linux.network.interface object from the cluster/system models and use fixed 'environment' model instead"
- cmd: |
- apt-get -y install python-virtualenv python-pip build-essential python-dev libssl-dev;
- pip install git+https://github.com/dis-xcom/reclass-tools;
- reclass-tools del-key parameters.linux.network.interface /srv/salt/reclass/classes/cluster/;
- reclass-tools del-key parameters.linux.network.interface /srv/salt/reclass/classes/system/;
- reclass-tools del-key parameters.linux.network.interface /usr/share/salt-formulas/reclass/;
-
- #if ! reclass-tools get-key 'classes' /srv/salt/reclass/nodes/{{ HOSTNAME_CFG01 }}.yml | grep -q "environment.{{ ENVIRONMENT_MODEL_INVENTORY_NAME }}$"; then
- # reclass-tools add-key 'classes' 'environment.{{ ENVIRONMENT_MODEL_INVENTORY_NAME }}' /srv/salt/reclass/nodes/{{ HOSTNAME_CFG01 }}.yml --merge ;
- #fi;
-
- node_name: {{ HOSTNAME_CFG01 }}
- retry: {count: 1, delay: 5}
- skip_fail: false
-
-- description: "[EXPERIMENTAL] Create environment model for virtual environment"
- cmd: |
- set -e;
- ln -s '/tmp/environment/environment_template/{{ '{# interfaces #}' }}' '/tmp/environment/environment_template/{{ '{{ cookiecutter._env_name }}' }}/';
- ln -s '/tmp/environment/environment_template/{{ '{# roles #}' }}' '/tmp/environment/environment_template/{{ '{{ cookiecutter._env_name }}' }}/';
- reclass-tools render --template-dir /tmp/environment/environment_template/ \
- --output-dir /srv/salt/reclass/classes/environment/ \
- --context /tmp/environment/environment_inventory/{{ ENVIRONMENT_MODEL_INVENTORY_NAME }}.yaml \
- --env-name {{ ENVIRONMENT_MODEL_INVENTORY_NAME }}
- node_name: {{ HOSTNAME_CFG01 }}
- retry: {count: 1, delay: 5}
- skip_fail: false
+{{ SHARED.MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL() }}
{{ 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"') }}
diff --git a/tcp_tests/templates/shared-salt.yaml b/tcp_tests/templates/shared-salt.yaml
index 78ecf85..9fcbb83 100644
--- a/tcp_tests/templates/shared-salt.yaml
+++ b/tcp_tests/templates/shared-salt.yaml
@@ -165,29 +165,8 @@
{%- endmacro %}
-{%- macro MACRO_GENERATE_COOKIECUTTER_MODELS(IS_CONTRAIL_LAB=false) %}
-{############################################################}
-- description: "[EXPERIMENTAL] Upload 'environment' to {{ HOSTNAME_CFG01 }}"
- upload:
- local_path: {{ config.salt_deploy.environment_template_dir }}
- remote_path: /tmp/environment/
- node_name: {{ HOSTNAME_CFG01 }}
- skip_fail: false
-
-- description: "[EXPERIMENTAL] Upload cookiecutter-templates context to {{ HOSTNAME_CFG01 }}"
- upload:
- local_path: {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
- local_filename: salt-context-cicd_oss.yaml
- remote_path: /tmp/environment/
- node_name: {{ HOSTNAME_CFG01 }}
-
-- description: "[EXPERIMENTAL] Upload environment inventory to {{ HOSTNAME_CFG01 }}"
- upload:
- local_path: {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
- local_filename: salt-context-environment.yaml
- remote_path: /tmp/environment/
- node_name: {{ HOSTNAME_CFG01 }}
-
+{%- macro MACRO_GENERATE_COOKIECUTTER_MODEL(IS_CONTRAIL_LAB=false) %}
+{###################################################################}
- description: Create cluster model from cookiecutter templates
cmd: |
set -e;
@@ -238,54 +217,12 @@
classes:
- system.openssh.server.team.all
- cluster.{{ LAB_CONFIG_NAME }}.infra.config
- - environment.{{ ENVIRONMENT_MODEL_INVENTORY_NAME }}.reclass_datasource_local
- - environment.{{ ENVIRONMENT_MODEL_INVENTORY_NAME }}
EOF
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 1}
skip_fail: false
-- description: "[EXPERIMENTAL] Remove linux.network.interface object from the cluster/system models and use fixed 'environment' model instead"
- cmd: |
- set -e;
- apt-get -y install python-virtualenv python-pip build-essential python-dev libssl-dev;
- pip install git+https://github.com/dis-xcom/reclass-tools;
- reclass-tools del-key parameters.linux.network.interface /srv/salt/reclass/classes/cluster/;
- reclass-tools del-key parameters.linux.network.interface /srv/salt/reclass/classes/system/;
- reclass-tools del-key parameters.linux.network.interface /usr/share/salt-formulas/reclass/;
-
- #if ! reclass-tools get-key 'classes' /srv/salt/reclass/nodes/{{ HOSTNAME_CFG01 }}.yml | grep -q "environment.{{ ENVIRONMENT_MODEL_INVENTORY_NAME }}$"; then
- # reclass-tools add-key 'classes' 'environment.{{ ENVIRONMENT_MODEL_INVENTORY_NAME }}' /srv/salt/reclass/nodes/{{ HOSTNAME_CFG01 }}.yml --merge ;
- #fi;
-
- node_name: {{ HOSTNAME_CFG01 }}
- retry: {count: 1, delay: 5}
- skip_fail: false
-
-- description: "Workaround for PROD-14756: all roles must use service.keepalived.cluster.single with the default 'VIP' instance"
- cmd: |
- set -e;
- find /srv/salt/reclass/classes/cluster/ -type f -exec sed -i 's/system.keepalived.*/service.keepalived.cluster.single/g' {} +
- find /srv/salt/reclass/classes/system/ -type f -exec sed -i 's/system.keepalived.*/service.keepalived.cluster.single/g' {} +
-
- node_name: {{ HOSTNAME_CFG01 }}
- retry: {count: 1, delay: 5}
- skip_fail: false
-
-- description: "[EXPERIMENTAL] Create environment model for virtual environment"
- cmd: |
- set -e;
- ln -s '/tmp/environment/environment_template/{{ '{# interfaces #}' }}' '/tmp/environment/environment_template/{{ '{{ cookiecutter._env_name }}' }}/';
- ln -s '/tmp/environment/environment_template/{{ '{# roles #}' }}' '/tmp/environment/environment_template/{{ '{{ cookiecutter._env_name }}' }}/';
- reclass-tools render --template-dir /tmp/environment/environment_template/ \
- --output-dir /srv/salt/reclass/classes/environment/ \
- --context {{ ENVIRONMENT_CONTEXT_PATH }} \
- --env-name {{ ENVIRONMENT_MODEL_INVENTORY_NAME }}
- node_name: {{ HOSTNAME_CFG01 }}
- retry: {count: 1, delay: 5}
- skip_fail: false
-
- description: Modify generated model and reclass-system if necessary
cmd: |
set -e;
@@ -316,6 +253,72 @@
{%- endmacro %}
+{%- macro MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL() %}
+{########################################################}
+- description: "[EXPERIMENTAL] Upload 'environment' to {{ HOSTNAME_CFG01 }}"
+ upload:
+ local_path: {{ config.salt_deploy.environment_template_dir }}
+ remote_path: /tmp/environment/
+ node_name: {{ HOSTNAME_CFG01 }}
+ skip_fail: false
+
+- description: "[EXPERIMENTAL] Upload cookiecutter-templates context to {{ HOSTNAME_CFG01 }}"
+ upload:
+ local_path: {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
+ local_filename: {{ CLUSTER_CONTEXT_NAME }}
+ remote_path: /tmp/environment/
+ node_name: {{ HOSTNAME_CFG01 }}
+
+- description: "[EXPERIMENTAL] Upload environment inventory to {{ HOSTNAME_CFG01 }}"
+ upload:
+ local_path: {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
+ local_filename: {{ ENVIRONMENT_CONTEXT_NAME }}
+ remote_path: /tmp/environment/
+ node_name: {{ HOSTNAME_CFG01 }}
+
+- description: "[EXPERIMENTAL] Remove linux.network.interface object from the cluster/system models and use fixed 'environment' model instead"
+ cmd: |
+ set -e;
+ apt-get -y install python-virtualenv python-pip build-essential python-dev libssl-dev;
+ pip install git+https://github.com/dis-xcom/reclass-tools;
+ reclass-tools del-key parameters.linux.network.interface /srv/salt/reclass/classes/cluster/;
+ reclass-tools del-key parameters.linux.network.interface /srv/salt/reclass/classes/system/;
+ reclass-tools del-key parameters.linux.network.interface /usr/share/salt-formulas/reclass/;
+
+ if ! reclass-tools get-key 'classes' /srv/salt/reclass/nodes/{{ HOSTNAME_CFG01 }}.yml | grep -q "environment.{{ ENVIRONMENT_MODEL_INVENTORY_NAME }}$"; then
+ reclass-tools add-key 'classes' 'environment.{{ ENVIRONMENT_MODEL_INVENTORY_NAME }}.reclass_datasource_local' /srv/salt/reclass/nodes/_generated/{{ HOSTNAME_CFG01 }}.yml --merge ;
+ reclass-tools add-key 'classes' 'environment.{{ ENVIRONMENT_MODEL_INVENTORY_NAME }}' /srv/salt/reclass/nodes/_generated/{{ HOSTNAME_CFG01 }}.yml --merge ;
+ fi;
+
+ node_name: {{ HOSTNAME_CFG01 }}
+ retry: {count: 1, delay: 5}
+ skip_fail: false
+
+- description: "Workaround for PROD-14756: all roles must use service.keepalived.cluster.single with the default 'VIP' instance"
+ cmd: |
+ set -e;
+ find /srv/salt/reclass/classes/cluster/ -type f -exec sed -i 's/system.keepalived.*/service.keepalived.cluster.single/g' {} +
+ find /srv/salt/reclass/classes/system/ -type f -exec sed -i 's/system.keepalived.*/service.keepalived.cluster.single/g' {} +
+
+ node_name: {{ HOSTNAME_CFG01 }}
+ retry: {count: 1, delay: 5}
+ skip_fail: false
+
+- description: "[EXPERIMENTAL] Create environment model for virtual environment"
+ cmd: |
+ set -e;
+ ln -s '/tmp/environment/environment_template/{{ '{# interfaces #}' }}' '/tmp/environment/environment_template/{{ '{{ cookiecutter._env_name }}' }}/';
+ ln -s '/tmp/environment/environment_template/{{ '{# roles #}' }}' '/tmp/environment/environment_template/{{ '{{ cookiecutter._env_name }}' }}/';
+ reclass-tools render --template-dir /tmp/environment/environment_template/ \
+ --output-dir /srv/salt/reclass/classes/environment/ \
+ --context {{ ENVIRONMENT_CONTEXT_PATH }} \
+ --env-name {{ ENVIRONMENT_MODEL_INVENTORY_NAME }}
+ node_name: {{ HOSTNAME_CFG01 }}
+ retry: {count: 1, delay: 5}
+ skip_fail: false
+{%- endmacro %}
+
+
{%- macro MACRO_CONFIGURE_RECLASS(FORMULA_SERVICES='') %}
{#######################################################}
- description: Configure reclass