blob: b48a61106553f086a4cef81d6932eccc2e6b58b0 [file] [log] [blame]
{# Collection of common macroses shared across openstack services #}
{%- macro MACRO_INSTALL_KEYSTONE(USE_ORCHESTRATE=true) %}
{%- if USE_ORCHESTRATE %}
- description: |
Execute salt orchestration state to configure all needed
prerequisites like creating SSH public key ant etc.
Workaround for PROD-22488, use for PROD-22535.
cmd: salt-run state.orchestrate keystone.orchestrate.deploy
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
{%- endif %}
- description: Install keystone service on primary node
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C 'I@keystone:server and *01*' state.sls keystone.server
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 2, delay: 15}
skip_fail: false
- description: Install keystone service on other nodes
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C 'I@keystone:server' state.sls keystone.server
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 2, delay: 15}
skip_fail: false
- description: Restart apache due to PROD-10477
cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*'
cmd.run "service apache2 restart"
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 15}
skip_fail: false
- description: Check apache status to PROD-10477
cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*'
cmd.run "service apache2 status"
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 15}
skip_fail: false
- description: Populate keystone services/tenants/admins
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C 'I@keystone:client' state.sls keystone.client
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 2, delay: 5}
skip_fail: false
- description: Check keystone service-list
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C "I@keystone:server" cmd.run ". /root/keystonercv3;
openstack service list"
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
{%- endmacro %}
{%- macro MACRO_INSTALL_GLANCE() %}
- description: Install glance service on primary node
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C 'I@glance:server and *01*' state.sls glance.server
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Install glance service on other nodes
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C 'I@glance:server' state.sls glance.server
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Check glance image-list
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C "I@keystone:server" cmd.run ". /root/keystonercv3;
openstack image list"
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
{%- endmacro %}
{%- macro MACRO_INSTALL_NOVA() %}
- description: Install nova service on primary node
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C "I@nova:controller and *01*" state.sls nova.controller
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Install nova service on other nodes
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C "I@nova:controller" state.sls nova.controller
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Check nova service-list
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C "I@keystone:server" cmd.run ". /root/keystonercv3;
openstack compute service list"
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Check nova list
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C "I@keystone:server" cmd.run ". /root/keystonercv3;
openstack server list"
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Create nova resources
cmd: |
if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@nova:client' match.pillar 'nova:client' ; then
salt --hard-crash --state-output=mixed --state-verbose=False -C "I@nova:client" state.sls nova.client
fi
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
{%- endmacro %}
{%- macro MACRO_INSTALL_CINDER(INSTALL_VOLUME=false) %}
- description: Install cinder on primary node
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C "I@cinder:controller and *01*" state.sls cinder
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Install cinder on other nodes
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C "I@cinder:controller" state.sls cinder
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Check cinder list
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C "I@keystone:server" cmd.run ". /root/keystonercv3;
openstack volume list"
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
{%- if INSTALL_VOLUME %}
- description: Install cinder volume, PROD-24485 set retry 2
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C 'I@cinder:volume' state.sls cinder
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 2, delay: 5}
skip_fail: false
{%- endif %}
{%- endmacro %}
{%- macro MACRO_INSTALL_NEUTRON(INSTALL_GATEWAY=true) %}
- description: Install neutron service on primary node
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C "I@neutron:server and *01*" state.sls neutron.server
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Install neutron service on other nodes
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C "I@neutron:server" state.sls neutron.server
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
{%- if INSTALL_GATEWAY %}
- description: Install neutron on gtw node
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C 'I@neutron:gateway' state.sls neutron
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Check neutron agent-list
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C 'I@keystone:server' cmd.run '. /root/keystonercv3; neutron agent-list'
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
{%- endif %}
{%- endmacro %}
{%- macro MACRO_INSTALL_HEAT() %}
- description: Install heat service on primary node
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C "I@heat:server and *01*" state.sls heat.server
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Install heat service on other nodes
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C "I@heat:server" state.sls heat.server
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Check heat service
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C 'I@keystone:server' cmd.run '. /root/keystonercv3;
openstack orchestration resource type list'
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 5, delay: 10}
skip_fail: false
{%- endmacro %}
{%- macro MACRO_INSTALL_HORIZON() %}
- description: Deploy horizon dashboard
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C 'I@horizon:server' state.sls horizon
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: true
{%- endmacro %}
{%- macro MACRO_INSTALL_DESIGNATE(INSTALL_POWERDNS=false, INSTALL_BIND=false) %}
{%- if INSTALL_POWERDNS %}
- description: Install powerdns
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C 'I@powerdns:server' state.sls powerdns.server
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
{%- endif %}
{%- if INSTALL_BIND %}
- description: Install bind
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C 'I@bind:server' state.sls bind
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
{%- endif %}
- description: Install designate on primary node
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C "I@designate:server and *01*" state.sls designate.server
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 5, delay: 10}
skip_fail: false
- description: Install designate on other nodes
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C "I@designate:server" state.sls designate
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 5, delay: 10}
skip_fail: false
{%- endmacro %}
{%- macro MACRO_INSTALL_BARBICAN() %}
- description: Install barbican server
cmd: |
salt -C 'I@barbican:server:role:primary' state.sls barbican.server;
salt -C 'I@barbican:server' state.sls barbican.server;
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
{%- endmacro %}
{%- macro MACRO_INSTALL_DOGTAG() %}
- description: Install dogtag server
cmd: |
salt -C 'I@dogtag:server:role:master' state.sls dogtag.server;
salt -C 'I@dogtag:server' state.sls dogtag.server;
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
{%- endmacro %}
{%- macro MACRO_INSTALL_IRONIC() %}
# TO DO
{%- endmacro %}
{%- macro MACRO_INSTALL_MANILA() %}
- description: Install manila-api on first node
cmd: |
salt -C 'I@manila:api and *01*' state.sls manila.api;
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Install manila-scheduler
cmd: |
salt -C 'I@manila:scheduler' state.sls manila.scheduler;
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Install manila-share
cmd: |
salt -C 'I@manila:share' state.sls manila.share;
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Check manila-services
cmd: |
salt 'ctl01*' cmd.run '. /root/keystonercv3; manila service-list'
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 3, delay: 15}
skip_fail: false
- description: Create manila type
cmd: |
salt -C "I@manila:client" state.sls manila.client
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Create CIFS and NFS share and check it status
cmd: |
salt 'ctl01*' cmd.run '. /root/keystonercv3; manila create CIFS 1 --share-type=default';
salt 'ctl01*' cmd.run '. /root/keystonercv3; manila create NFS 1 --share-type=default';
sleep 5;
salt 'ctl01*' cmd.run '. /root/keystonercv3; manila list';
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
{%- endmacro %}
{%- macro MACRO_INSTALL_OCTAVIA_API() %}
- description: Execute glance client to upload octavia image
cmd: salt -C 'I@glance:client' state.sls glance.client
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Execute neutron client to create octavia resources
cmd: salt -C 'I@neutron:client' state.sls neutron.client
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Install octavia api service on primary node
cmd: salt -C 'I@octavia:api:role:primary' state.sls octavia.api
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Install octavia api service
cmd: salt -C 'I@octavia:api' state.sls octavia.api
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
{%- endmacro %}
{%- macro MACRO_INSTALL_OCTAVIA_MANAGER() %}
- description: Update mine
cmd: salt -C 'I@neutron:client' mine.update && sleep 60
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Install octavia manager
cmd: salt -C 'I@octavia:manager' state.sls octavia.manager
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Execute octavia ca
cmd: salt -C 'I@octavia:manager' state.sls salt.minion.ca
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Execute octavia cert
cmd: salt -C 'I@octavia:manager' state.sls salt.minion.cert
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Execute octavia client
cmd: salt -C 'I@octavia:client' state.sls octavia.client
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
{%- endmacro %}
{%- macro MACRO_INSTALL_COMPUTE(CELL_MAPPING=false) %}
# Install compute node
- description: Apply formulas for compute node
cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: true
- description: Re-apply(as in doc) formulas for compute node
cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Check IP on computes
cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' cmd.run
'ip a'
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 10, delay: 30}
skip_fail: false
{%- if CELL_MAPPING %}
- description: Re-run nova for map cell mapping
cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-C "I@nova:controller and *01*" state.sls nova.controller
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
{%- endif %}
{%- endmacro %}
{%- macro MACRO_INSTALL_REDIS() %}
- description: Install redis service
cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@redis:cluster:role:master' state.sls redis &&
salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@redis:server' state.sls redis
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
{%- endmacro %}
{%- macro MACRO_INSTALL_GNOCCHI() %}
- description: Install gnocchi server
cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@gnocchi:server and *01*' state.sls gnocchi.server &&
salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@gnocchi:server' state.sls gnocchi.server
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
- description: Setup gnocchi client
cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@gnocchi:client and *01*' state.sls gnocchi.client &&
salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@gnocchi:client' state.sls gnocchi.client
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
{%- endmacro %}
{%- macro MACRO_INSTALL_PANKO() %}
- description: Install panko server
cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@panko:server and *01*' state.sls panko &&
salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@panko:server' state.sls panko
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
{%- endmacro %}
{%- macro MACRO_INSTALL_CEILOMETER() %}
- description: Install ceilometer server on first node
cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@ceilometer:server and *01*' state.sls ceilometer
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 2, delay: 5}
skip_fail: false
- description: Install ceilometer server on other nodes
cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@ceilometer:server' state.sls ceilometer
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 2, delay: 5}
skip_fail: false
{%- endmacro %}
{%- macro MACRO_INSTALL_AODH() %}
- description: Install aodh server
cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@aodh:server and *01*' state.sls aodh &&
salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@aodh:server' state.sls aodh
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: false
{%- endmacro %}
{%- macro OVERRIDE_POLICY() %}
- description: Upload policy override
upload:
local_path: {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
local_filename: overrides-policy.yml
remote_path: /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/
node_name: {{ HOSTNAME_CFG01 }}
- description: Create custom cluster control class
cmd: echo -e "classes:\n- cluster.{{ LAB_CONFIG_NAME }}.openstack.control_orig\n$(cat /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/overrides-policy.yml)" > /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/overrides-policy.yml
node_name: {{ HOSTNAME_CFG01 }}
- description: Rename control classes
cmd: mv /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control_orig.yml &&
ln -s /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/overrides-policy.yml /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml &&
salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all &&
salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
node_name: {{ HOSTNAME_CFG01 }}
{%- endmacro %}