Difference between revisions of "SaltStack Install"
Jump to navigation
Jump to search
Line 44: | Line 44: | ||
/srv/salt/dev/top.sls | /srv/salt/dev/top.sls | ||
``` | ``` | ||
− | dev: | + | |
− | 'haproxy*.uvoo.io': | + | base: |
+ | '*.uvoo.io.dev' | ||
+ | - base | ||
+ | haproxy: | ||
+ | 'haproxy*.uvoo.io.dev': | ||
- haproxy | - haproxy | ||
``` | ``` | ||
+ | |||
+ | /srv/salt/dev/init.sls | ||
+ | ``` | ||
+ | include: | ||
+ | - base.users | ||
+ | ``` | ||
+ | |||
+ | /srv/salt/dev/users.sls | ||
+ | ``` | ||
+ | staff: | ||
+ | group.present: | ||
+ | - gid: 11000 | ||
+ | - system: False | ||
+ | busktest: | ||
+ | user.present: | ||
+ | - name: busktest | ||
+ | - fullname: Salt Tester account | ||
+ | - password: "$6$IUhZiRrq$46sC1b5LgEMCBew/S46BNwOsPvhGEcXRBhxqTfCjAEDh2JDYvhc8GelkMgRZgj8x3wRe6wgfXRc88aO2E8T5m." | ||
+ | - uid: 11001 | ||
+ | # - gid_from_name: True | ||
+ | # - gid: 11001 | ||
+ | - home: /home/busktest | ||
+ | - shell: /bin/bash | ||
+ | - groups: | ||
+ | - staff | ||
+ | {% if grains['os_family'] == 'Debian' -%} | ||
+ | - sudo | ||
+ | {% else %} | ||
+ | - wheel | ||
+ | {% endif %} | ||
+ | - require: | ||
+ | - pkg: vim | ||
+ | vim: | ||
+ | pkg: | ||
+ | - installed | ||
+ | ``` | ||
+ | |||
salt -l debug 'myhost.uvoo.io' state.apply saltenv=dev test=True | salt -l debug 'myhost.uvoo.io' state.apply saltenv=dev test=True |
Revision as of 05:03, 13 April 2020
Examples using LXD
Master
lxc launch ubuntu:18.04 salt lxc exec sftp3 -- script /dev/null -c "curl -L https://bootstrap.saltstack.com -o install_salt.sh" lxc exec sftp3 -- script /dev/null -c "sudo sh install_salt.sh -M -x python3 -D"
/etc/salt/master.d/main.conf
file_roots: dev: - /srv/salt/dev qa: - /srv/salt/qa prod: - /srv/salt/prod base: - /srv/salt/base
Restart service
sudo systemctl restart salt-master
Minion
lxc launch ubuntu:18.04 sftp3 lxc exec sftp3 -- script /dev/null -c "curl -L https://bootstrap.saltstack.com -o install_salt.sh" lxc exec sftp3 -- script /dev/null -c "sudo sh install_salt.sh -P -x python3 -D"
Create envs
mkdir /srv/salt/dev mkdir /srv/salt/qa mkdir /srv/salt/prod
/srv/salt/dev/top.sls
<br />base: '*.uvoo.io.dev' - base haproxy: 'haproxy*.uvoo.io.dev': - haproxy
/srv/salt/dev/init.sls
include: - base.users
/srv/salt/dev/users.sls
staff: group.present: - gid: 11000 - system: False busktest: user.present: - name: busktest - fullname: Salt Tester account - password: "$6$IUhZiRrq$46sC1b5LgEMCBew/S46BNwOsPvhGEcXRBhxqTfCjAEDh2JDYvhc8GelkMgRZgj8x3wRe6wgfXRc88aO2E8T5m." - uid: 11001 # - gid_from_name: True # - gid: 11001 - home: /home/busktest - shell: /bin/bash - groups: - staff {% if grains['os_family'] == 'Debian' -%} - sudo {% else %} - wheel {% endif %} - require: - pkg: vim vim: pkg: - installed
salt -l debug 'myhost.uvoo.io' state.apply saltenv=dev test=True