Difference between revisions of "SaltStack Notes"

From UVOO Tech Wiki
Jump to navigation Jump to search
(Created page with "``` {% for file in '/etc/ssl/private/' + fqdn + '.key', '/etc/ssl/private/' + fqdn + '.crt' %} {{ file }}: file.managed: - source: "salt://application1/{{ file }}"...")
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
https://stackoverflow.com/questions/17049277/how-can-i-dump-pillar-data-that-will-be-send-to-minion
 +
 +
```
 +
salt-run fileserver.file_list saltenv=dev
 +
```
 +
 +
set timeout
 +
```
 +
sudo salt -t 120 '*.haproxy' state.apply haproxy
 +
```
 +
 
```
 
```
 
{% for file in  
 
{% for file in  

Latest revision as of 04:00, 27 May 2020

https://stackoverflow.com/questions/17049277/how-can-i-dump-pillar-data-that-will-be-send-to-minion

salt-run fileserver.file_list saltenv=dev

set timeout

sudo salt -t 120 '*.haproxy' state.apply haproxy
{% for file in 
  '/etc/ssl/private/' + fqdn + '.key', 
  '/etc/ssl/private/' + fqdn + '.crt'
%}
{{ file }}:
  file.managed:
  - source: "salt://application1/{{ file }}"
  - user: root
  - group: ssl-cert
  - mode: 0740
{% endfor %}
Complex:

{% for file in [
  { 'src': '/etc/ssl/private/' + fqdn + '.key', 'dst': '/etc/ssl/private/' + fqdn + '.key', 'group': 'ssl-cert'},
  { 'src': '/etc/ssl/private/' + fqdn + '.crt', 'dst': '/etc/ssl/private/' + fqdn + '.crt', 'group': 'ssl-cert'},
  { 'src': '/etc/nginx/sites-available/application2.conf.j2', 'dst': '/etc/nginx/sites-available/' + fqdn + '.conf', 'group': 'www-data' }
  ]
%}
{{ file.dst }}:
  file.managed:
  - source: "salt://application2/{{ file.src }}"
  - user: root
  - group: "{{ file.group }}"
  - mode: 0740
{% endfor %}