Created
November 27, 2013 18:36
-
-
Save renoirb/7680862 to your computer and use it in GitHub Desktop.
Separating a secret pillar repository, and spreading SSL certificates among hosts.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## in /etc/salt/master.d/pillars.conf | |
pillar_roots: | |
base: | |
- /srv/pillar | |
- /srv/private/pillar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## In /srv/pillar/top.sls | |
base: | |
'db*': | |
- backup | |
- rsync.shares | |
- rsync.backup | |
- monitor.db | |
- mysql | |
'db1*': | |
- mysql.db1 # Each db host has its own file that way |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## In /srv/private/pillar/mysql/init.sls | |
mysql: | |
ssl: | |
ca-cert.pem: | | |
-----BEGIN CERTIFICATE----- | |
... | |
-----END CERTIFICATE----- | |
ca-key.pem: | | |
-----BEGIN RSA PRIVATE KEY----- | |
... | |
-----END RSA PRIVATE KEY----- | |
{% if grains['host'] == 'db8' %} | |
server.pem: | | |
-----BEGIN CERTIFICATE----- | |
... | |
-----END CERTIFICATE----- | |
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## In /srv/salt/mysql/certificates.sls: | |
/etc/mysql/certs: | |
file.managed: | |
- user: mysql | |
- group: mysql | |
- mode: 750 | |
/etc/mysql/server.pem: | |
file.managed: | |
- user: mysql | |
- group: mysql | |
- mode: 640 | |
- contents: {{ salt['pillar.get']('mysql:ssl:server.pem') }} | |
/etc/mysql/ca-key.pem: | |
file.managed: | |
- user: mysql | |
- group: mysql | |
- mode: 640 | |
- contents: {{ salt['pillar.get']('mysql:ssl:ca-key.pem') }} | |
/etc/mysql/ca-cert.pem: | |
file.managed: | |
- user: mysql | |
- group: mysql | |
- mode: 640 | |
- contents: {{ salt['pillar.get']('mysql:ssl:ca-cert.pem') }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I made a better version here: https://gist.github.com/renoirb/7728455