Założenie

Zalozylem najczarniejszy scenariusz gdy podejmowalem decyzje, ale spodziewalem sie, ze bedzie przyjemniej - i nie jest.

Nie potrafie odeprzec mysli o bledzie, choc go nie popelnilem. Gralem najczystsza mozliwa karta i moglbym byc z tego teraz zadowolony, ale czy gdybym mogl wrocic czas, to zagralbym inaczej?

salt-master-output-01

root@salt:/srv# tree . ├── formulas │   └── haproxy │   ├── init.sls │   ├── ip_addresses.sls │   └── templates │   └── ip_addresses.jinja ├── pillar │   ├── haproxy_apache2.sls │   ├── haproxy_nginx.sls │   ├── mine_network.sls │   └── top.sls └── salt └── top.sls 5 directories, 8 files root@salt:/srv# grep -v ^# /etc/salt/master | grep -v ^$ interface: 0.0.0.0 user: root auto_accept: True file_roots: base: - /srv/salt - /srv/formulas pillar_roots: base: - /srv/pillar mine_get: haproxy*: - network.* root@salt:/srv# salt-key -L Accepted Keys: apache2 haproxy2-nginx haproxy3-apache2 nginx1 nginx2 Denied Keys: Unaccepted Keys: Rejected Keys: root@salt:/srv# root@salt:/srv# find ./ -type f | xargs tail -n +1 ==> ./pillar/top.sls <== base: 'nginx* or apache*': - mine_network 'haproxy*nginx*': - haproxy_nginx 'haproxy*apache*': - haproxy_apache2 ==> ./pillar/mine_network.sls <== mine_functions: network.ip_addrs: [] ==> ./pillar/haproxy_apache2.sls <== app_server: apache2* ==> ./pillar/haproxy_nginx.sls <== app_server: nginx* ==> ./salt/top.sls <== base: 'haproxy*': - haproxy ==> ./formulas/haproxy/templates/ip_addresses.jinja <== # DO NOT CHANGE - GENERATED BY SALT {%- set app_server = pillar.get('app_server') %} {%- for server, addr in salt['mine.get'](app_server, 'network.ip_addrs').items() %} {{ addr[0] }} # {{ server }} {%- endfor %} ==> ./formulas/haproxy/ip_addresses.sls <== /tmp/ip_addresses: file.managed: - source: salt://haproxy/templates/ip_addresses.jinja - template: jinja - user: root - group: root - mode: 644 ==> ./formulas/haproxy/init.sls <== include: - .ip_addresses root@salt:/srv# salt 'haproxy*' cmd.run 'cat /tmp/ip_addresses' haproxy2-nginx: # DO NOT CHANGE - GENERATED BY SALT 192.168.122.182 # nginx1 192.168.122.183 # nginx2 haproxy3-apache2: # DO NOT CHANGE - GENERATED BY SALT 192.168.122.46 # apache2 root@salt:/srv#

1 2 3 4