Last active
December 10, 2021 16:44
-
-
Save arnisoph/364fa5de5541d8952958 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# cat << EOF > /etc/salt/master | |
autosign_file: /etc/salt/autosign.conf | |
file_roots: | |
base: | |
- /srv/salt/states | |
reactor: | |
- salt/minion/*/start: | |
- /srv/salt/reactor/basic.sls | |
- salt/job/*/ret/*: | |
- /srv/salt/reactor/job_ret.sls | |
- frontend/loadbalancer/pool/update: | |
- /srv/salt/reactor/lb_pool_update.sls | |
EOF | |
# cat << EOF > /etc/salt/minion | |
master: 10.10.13.100 | |
log_level: debug | |
EOF |
This file contains hidden or 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
# echo '*.saltbox.local.inovex.de' > /etc/salt/autosign.conf |
This file contains hidden or 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
# mkdir -p /srv/salt/{states,reactor} | |
# cat << EOF > /srv/salt/reactor/basic.sls | |
log_new_minion: | |
local.cmd.run: | |
- name: log new minion | |
- tgt: 'master*' | |
- arg: | |
- 'echo "[{{ data['id'] }}][minion started] A new Minion has (re)born on $(date). Say hello to him ({{ tag }})" >> /tmp/salt.reactor.log' | |
tell_minion_to_install_software: | |
local.state.sls: | |
- name: tell minion to install software | |
- tgt: {{ data['id'] }} | |
- arg: | |
- webserver | |
EOF | |
# cat << EOF > /srv/salt/reactor/job_ret.sls | |
{% if data['id'] != salt['grains.get']('fqdn') or data['fun'] != 'cmd.run' %} | |
log_minion_new_job: | |
local.cmd.run: | |
- name: log minion job | |
- tgt: 'master*' | |
- arg: | |
- 'echo "[{{ data['id'] }}][ret job ] A minion just executed {{ data['fun'] }}. ({{ tag }})" >> /tmp/salt.reactor.log' | |
{% endif %} | |
EOF | |
# cat << EOF > /srv/salt/reactor/lb_pool_update.sls | |
new_httpd_frontend_added_to_pool: | |
local.cmd.run: | |
- name: new httpd frontend added to pool | |
- tgt: 'master*' | |
- arg: | |
- 'echo "[{{ data['id'] }}][new httpd ] Adding new webserver ({{ data['data']['new_web_server_ip'] }}:80) to loadbalancer ({{ tag }})" >> /tmp/salt.reactor.log' | |
EOF |
This file contains hidden or 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
# cat << EOF > /srv/salt/states/webserver.sls | |
#!jinja|yaml | |
httpd: | |
pkg: | |
- installed | |
file: | |
- managed | |
- name: /etc/httpd/conf/httpd.conf | |
- user: root | |
- group: root | |
- mode: 644 | |
service: | |
- running | |
- watch: | |
- file: httpd | |
httpd_pool_update: | |
event: | |
- wait | |
- name: frontend/loadbalancer/pool/update | |
- data: | |
new_web_server_ip: {{ salt['grains.get']('ip4_interfaces')['enp0s8'][0] }} | |
- watch: | |
- service: httpd | |
EOF |
This file contains hidden or 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
[minion1.saltbox.local.inovex.de][minion started] A new Minion has (re)born on Sat Sep 19 19:19:13 CEST 2015. Say hello to him (salt/minion/minion1.saltbox.local.inovex.de/start) | |
[minion1.saltbox.local.inovex.de][ret job ] A minion just executed mine.update. (salt/job/20150919191915617342/ret/minion1.saltbox.local.inovex.de) | |
[minion1.saltbox.local.inovex.de][new httpd ] Adding new webserver (10.10.13.101:80) to loadbalancer (frontend/loadbalancer/pool/update) | |
[minion1.saltbox.local.inovex.de][ret job ] A minion just executed state.sls. (salt/job/20150919191913799905/ret/minion1.saltbox.local.inovex.de) | |
[minion1.saltbox.local.inovex.de][minion started] A new Minion has (re)born on Sat Sep 19 19:20:20 CEST 2015. Say hello to him (salt/minion/minion1.saltbox.local.inovex.de/start) | |
[minion1.saltbox.local.inovex.de][minion started] A new Minion has (re)born on Sat Sep 19 19:30:30 CEST 2015. Say hello to him (salt/minion/minion1.saltbox.local.inovex.de/start) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment