Skip to content

Instantly share code, notes, and snippets.

@austinpapp
Created January 16, 2017 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save austinpapp/cba5652225332919972d077734fd3e8d to your computer and use it in GitHub Desktop.
Save austinpapp/cba5652225332919972d077734fd3e8d to your computer and use it in GitHub Desktop.
civix:
symfony:
database_driver: pdo_mysql
database_host: 127.0.0.1
database_port:
database_name: civix
database_user: civix
database_password: civix
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user:
mailer_password:
locale: en
secret: secret
recaptcha_public_key: here_is_your_public_key
recaptcha_private_key: here_is_your_private_key
recaptcha_secure: false
recaptcha_locale_key: kernel.default_locale
recaptcha_enabled: true
cicero_login: aplotnikov
cicero_password: aplotnikov
android_api_key: android_api_key
android_app: app_key
ios_is_sanbox: true
ios_pem_path: /path/to/certs
ios_passphrase: passphrase
sunlightapi_token:
stripe_api_key: sk_test_vpedTPsiXZZ8SSwS4isZzHWw
stripe_publishable_key: pk_test_QUgSE3ZhORW9yoDuCkMjnaA2
domain: example.com
hostname: vagrant.local
scheme: 'http'
rabbitmq_connections:
default:
host: 'localhost'
port: 5672
user: 'guest'
password: 'guest'
vhost: '/'
lazy: true
slack_logger_token: 'xoxp'
get-parameters:
file.managed:
- name: /srv/config/parameters.yml
- mode: 644
- user: {{ user }}
- group: {{ user }}
- contents_pillar: {{ salt['pillar.get']('civix:symphony', {})|yaml }}
@xenophonf
Copy link

Using the Pillar data as given above, I wrote the following source template, which I saved as /usr/local/etc/salt/states/test.yml:

{{ salt['pillar.get']('civix:symfony', {})|yaml(False) }}

Note the use of the flow control argument to the |yaml filter, which pretty-prints the resulting YAML document instead of putting it all on one line.

Then I wrote the following SLS file, which I saved as /usr/local/etc/salt/states/test.sls:

test_config:
  file.managed:
    - name: /tmp/parameters.yml
    - source: salt://test.yml
    - template: jinja

This Works For Me!(tm)

@austinpapp
Copy link
Author

@xenophonf , fwiw i found this:

get-parameters:
  file.serialize:
    - name: /srv/config/parameters.yml
    - mode: 644
    - dataset_pillar: civix:symfony
    - formatter: yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment