Inheriting Common SaltStack State Parameters

There is a simple way to inherit parameters from another state:

{% set os = salt['pillar.get']('openstack:auth') %}
set-openstack-params:
  cmd.run:
    - name: ':'
    - runas: keystone
    - env:
      - OS_USERNAME: {{ os.username }}
      - OS_PASSWORD: {{ os.password }}
      - OS_PROJECT_NAME: {{ os.project_name }}
      - OS_AUTH_URL: {{ os.auth_url }}
      - OS_IDENTITY_API_VERSION: 3
      - OS_AUTH_VERSION: 3

create-service-role:
  cmd.run:
    - name: openstack role create service
    - use:
      - cmd: set-openstack-params

create-object-store-service:
  cmd.run:
    - name: |
        openstack service create \
          --name swift \
          --description "Swift Object Storage Service" \
          object-store
    - use:
      - cmd: set-openstack-params

create-service-project:
  cmd.run:
    - name: openstack project create service
    - use:
      - cmd: set-openstack-params
Posted in on
Tagged with saltstack

Comments