Some notes
Get formulas from https://github.com/saltstack-formulas/ e.g. for HAProxyhttps://github.com/saltstack-formulas/haproxy-formula
Steps below is condensed (and includes more explicit commands than on this page https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html)
To use curl
Unzip Add to salt Master file_roots sudo vi /etc/salt/master
Restart Salt Master
Run state e.g. for haproxy
Salt States
Backup folder
Set variable to latest filename
Include Another state
Say we have a service stop state in a file called service/stop.sls
stop_service:
service.dead:
- name: service
If we are in the same folder and want to include it, we include it usings its filename (with any directories in front)
However in the require step we just include the id name (can also have idnetifies like service: pkg: etc)
include:
- service.stop
upgrade_archive_unpacked:
archive.extracted:
- name: {{ pillar['root_dir'] }}/{{ pillar['service']['upgrade'] }}
- source: {{ pillar['service']['source'] }}
- source_hash: {{ pillar['service']['source_hash'] }}
- user: {{ pillar['user'] }}
- group: {{ pillar['group'] }}
- overwrite: True
- enforce_ownership_on: {{ pillar['root_dir'] }}
- enforce_toplevel: False
- options: "--strip-components=1"
- require:
- stop_service
Rollback to backup