Commit c665bf96bb285a6f2c440671a555577192e263dc
make a mess
Michael Williams committed on 12/23/2017, 11:43:02 AMParent: 1f985742f731df43e79685fdfd3fd08824f86588
Files changed
INSTALL.md | changed |
example/salt/pillar/agents.sls | changed |
example/salt/pillar/cloud.sls | changed |
example/salt/pillar/base.sls | added |
salt/state/cloud.sls | added |
salt/state/master | added |
salt/state/master.sls | added |
salt/state/minion | added |
salt/state/minion.sls | added |
salt/state/salt.sls | added |
salt/state/top.sls | added |
INSTALL.md | ||
---|---|---|
@@ -17,36 +17,42 @@ | ||
17 | 17 … | ``` |
18 | 18 … | |
19 | 19 … | --- |
20 | 20 … | |
21 … | +generate ssh key | |
22 … | + | |
23 … | +```shell | |
24 … | +ssh-keygen -t rsa -b 8192 | |
25 … | +``` | |
26 … | + | |
27 … | +upload to GitHub (or git provider): https://github.com/settings/keys | |
28 … | + | |
29 … | +--- | |
30 … | + | |
21 | 31 … | update master config |
22 | 32 … | |
23 | 33 … | ```shell |
24 | -ssh-keygen -t rsa -b 8192 | |
25 | 34 … | nano /etc/salt/master |
26 | 35 … | ``` |
27 | 36 … | |
28 | -``` | |
37 … | +```yaml | |
29 | 38 … | fileserver_backend: |
30 | 39 … | - git |
31 | -gitfs_remotes: | |
32 | - - git@github.com:ahdinosaur/butt-as-a-service | |
40 … | + | |
33 | 41 … | gitfs_privkey: /root/.ssh/id_rsa |
34 | 42 … | gitfs_pubkey: /root/.ssh/id_rsa.pub |
35 | -gitfs_root: salt/state | |
43 … | +gitfs_remotes: | |
44 … | + - git@github.com:ahdinosaur/butt-as-a-service: | |
45 … | + - root: salt/state | |
36 | 46 … | |
47 … | +ext_pillar_privkey: /root/.ssh/id_rsa | |
48 … | +ext_pillar_pubkey: /root/.ssh/id_rsa.pub | |
37 | 49 … | ext_pillar: |
38 | 50 … | - git: |
39 | 51 … | - master git@github.com:${user}/${repo}: |
40 | 52 … | - root: salt/pillar |
41 | - - privkey: /root/.ssh/id_rsa | |
42 | - - pubkey: /root/.ssh/id_rsa.pub | |
43 | 53 … | ``` |
44 | 54 … | |
45 | -```yml | |
46 | -master: 127.0.0.1 | |
47 | -``` | |
48 | - | |
49 | 55 … | --- |
50 | 56 … | |
51 | 57 … | update minion config |
52 | 58 … |
example/salt/pillar/agents.sls | ||
---|---|---|
@@ -1,7 +1,4 @@ | ||
1 | 1 … | agents: |
2 | - - type: person | |
3 | - name: Mikey | |
4 | 2 … | - type: bot |
5 | - name: ${name} | |
6 | - url: ${url} | |
7 | - cloud_profile: ssb-pub | |
3 … | + name: salt.butt.nz | |
4 … | + service: pub |
example/salt/pillar/cloud.sls | ||
---|---|---|
@@ -1,9 +1,20 @@ | ||
1 | 1 … | cloud: |
2 … | + ssh_key_name: salt | |
3 … | + ssh_key_file: /root/.ssh/id_rsa | |
4 … | + | |
2 | 5 … | minion: |
3 | 6 … | master: salt.butt.nz |
4 | 7 … | |
5 | 8 … | providers: |
6 | - scaleway_butt: | |
7 | - access_key: ${access_key} | |
8 | - token: ${token} | |
9 … | + scaleway: | |
9 | 10 … | driver: scaleway |
11 … | + access_key: 26e74568-4f7e-4e40-bd97-7717b9909319 | |
12 … | + token: ba41a1d2-a0c2-4590-af5c-4fa80ce078b0 | |
13 … | + key_filename: /root/.ssh/id_rsa | |
14 … | + | |
15 … | + profiles: | |
16 … | + scaleway_small: | |
17 … | + image: Debian Stretch (9.0) | |
18 … | + location: par1 | |
19 … | + commercial_type: VC1S | |
20 … | + enable_ipv6: True |
example/salt/pillar/base.sls | ||
---|---|---|
@@ -1,0 +1,5 @@ | ||
1 … | +master: salt.butt.nz | |
2 … | +git_pubkey: /root/.ssh/id_rsa | |
3 … | +git_privkey: /root/.ssh/id_rsa.pub | |
4 … | +pillar_git: git@github.com:ahdinosaur/salt.butt.nz | |
5 … | +state_git: git@github.com:ahdinosaur/butt-as-a-service |
salt/state/cloud.sls | ||
---|---|---|
@@ -1,0 +1,35 @@ | ||
1 … | +{% set roles_by_service = { | |
2 … | + 'hub': [ | |
3 … | + 'master' | |
4 … | + ], | |
5 … | + 'pub': [ | |
6 … | + 'minion' | |
7 … | + ] | |
8 … | +%} | |
9 … | +{% set agents = salt['pillar.get']('agents', []) %} | |
10 … | +{% for agent in agents %} | |
11 … | + | |
12 … | +{% if agent.type == 'bot' %} | |
13 … | + | |
14 … | +{% set size = agent.size || 'small' %} | |
15 … | +{% set profile = salt['pillar.get']('cloud.profiles_' + size, []) %} | |
16 … | + | |
17 … | +{{agent.name}}: | |
18 … | + cloud.present: | |
19 … | + - script: bootstrap-salt | |
20 … | + - script_args: -P git v2017.7.2 | |
21 … | + {% for key, value in profile.items() %} | |
22 … | + - {{ key }}: {{ value }} | |
23 … | + {% endfor %} | |
24 … | + - minion: | |
25 … | + grains: | |
26 … | + env: production | |
27 … | + roles: | |
28 … | + - salt | |
29 … | + {% for role in roles_by_service[agent.service] %} | |
30 … | + - {{ role }} | |
31 … | + {% endfor %} | |
32 … | + | |
33 … | +{% endif %} | |
34 … | + | |
35 … | +{% endfor %} |
salt/state/master | ||
---|---|---|
@@ -1,0 +1,15 @@ | ||
1 … | +fileserver_backend: | |
2 … | + - git | |
3 … | + | |
4 … | +gitfs_privkey: {{ pillar['git_privkey'] }} | |
5 … | +gitfs_pubkey: {{ pillar['git_pubkey'] }} | |
6 … | +gitfs_remotes: | |
7 … | + - {{ pillar['state_git'] }}: | |
8 … | + - root: salt/state | |
9 … | + | |
10 … | +gitfs_privkey: {{ pillar['git_privkey'] }} | |
11 … | +gitfs_pubkey: {{ pillar['git_pubkey'] }} | |
12 … | +ext_pillar: | |
13 … | + - git: | |
14 … | + - master {{pillar_git}: | |
15 … | + - root: salt/pillar |
salt/state/master.sls |
---|
salt/state/minion |
---|
salt/state/minion.sls |
---|
salt/state/salt.sls | ||
---|---|---|
@@ -1,0 +1,22 @@ | ||
1 … | +{% set roles = salt['grains.get']('roles', []) %} | |
2 … | +{% if 'salt' in roles %} | |
3 … | + | |
4 … | +{% for salt in ['master', 'minion'] %} | |
5 … | +{% if salt in roles %} | |
6 … | + | |
7 … | +/etc/salt/{{salt}}: | |
8 … | + file.managed: | |
9 … | + - source: salt://{{salt}} | |
10 … | + - user: root | |
11 … | + - group: root | |
12 … | + - mode: 644 | |
13 … | + - template: jinja | |
14 … | + - defaults: | |
15 … | + git_pubkey: /root/.ssh/id_rsa | |
16 … | + git_privkey: /root/.ssh/id_rsa.pub | |
17 … | + state_git: git@github.com:ahdinosaur/butt-as-a-service | |
18 … | + | |
19 … | +{% endif %} | |
20 … | +{% endfor %} | |
21 … | + | |
22 … | +{% endif %} |
Built with git-ssb-web