Difference between revisions of "SaltStack Install"
Jump to navigation
Jump to search
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | # Simple client install for latest | ||
+ | Debian Based (Ubuntu) | ||
+ | ``` | ||
+ | sudo apt update && sudo apt install -y curl && curl -L https://bootstrap.saltstack.com -o install_salt.sh && sudo sh install_salt.sh -P -x python3 | ||
+ | ``` | ||
+ | Redhat Based | ||
+ | ``` | ||
+ | sudo yum install -y curl && curl -L https://bootstrap.saltstack.com -o install_salt.sh && sudo sh install_salt.sh -P -x python3 | ||
+ | ``` | ||
+ | |||
# Examples using LXD | # Examples using LXD | ||
- https://repo.saltstack.com/ | - https://repo.saltstack.com/ | ||
Line 5: | Line 15: | ||
``` | ``` | ||
lxc launch ubuntu:18.04 salt | lxc launch ubuntu:18.04 salt | ||
− | lxc exec | + | lxc exec salt -- script /dev/null -c "curl -L https://bootstrap.saltstack.com -o install_salt.sh" |
− | lxc exec | + | lxc exec salt -- 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 | ||
+ | ``` | ||
Line 14: | Line 41: | ||
``` | ``` | ||
lxc launch ubuntu:18.04 sftp3 | lxc launch ubuntu:18.04 sftp3 | ||
− | lxc exec | + | lxc exec haproxy1 -- script /dev/null -c "curl -L https://bootstrap.saltstack.com -o install_salt.sh" |
− | lxc exec | + | lxc exec haproxy1 -- script /dev/null -c "sudo sh install_salt.sh -P -x python3 -D" |
``` | ``` | ||
Line 27: | Line 54: | ||
/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: <myuser> | ||
+ | - fullname: Salt Tester account | ||
+ | - password: "<mypass in sha1 format>" | ||
+ | - uid: 11001 | ||
+ | # - gid_from_name: True | ||
+ | # - gid: 11001 | ||
+ | - home: /home/<myuser> | ||
+ | - 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 |
Latest revision as of 14:26, 5 August 2020
Simple client install for latest
Debian Based (Ubuntu)
sudo apt update && sudo apt install -y curl && curl -L https://bootstrap.saltstack.com -o install_salt.sh && sudo sh install_salt.sh -P -x python3
Redhat Based
sudo yum install -y curl && curl -L https://bootstrap.saltstack.com -o install_salt.sh && sudo sh install_salt.sh -P -x python3
Examples using LXD
Master
lxc launch ubuntu:18.04 salt lxc exec salt -- script /dev/null -c "curl -L https://bootstrap.saltstack.com -o install_salt.sh" lxc exec salt -- 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 haproxy1 -- script /dev/null -c "curl -L https://bootstrap.saltstack.com -o install_salt.sh" lxc exec haproxy1 -- 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: <myuser> - fullname: Salt Tester account - password: "<mypass in sha1 format>" - uid: 11001 # - gid_from_name: True # - gid: 11001 - home: /home/<myuser> - 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