Skip to content

Instantly share code, notes, and snippets.

@adiroiban
Created March 15, 2013 10:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adiroiban/5168770 to your computer and use it in GitHub Desktop.
Save adiroiban/5168770 to your computer and use it in GitHub Desktop.
Idea of describing salt state for proxy minion
#
# Define remote system config as a pillar
#
gateway:
host: hostname
port: 22
protocol: ssh | telnet # uses scp/ssh or rcp/rsh
ssh_key: "/path/on/local/minion"
server_fingerpring: '34:32:a4:32:32:32:a4:32:a4'
#
# In state
#
# Generic state to copy a file on a non-salt system.
gateway-hosts:
file.proxy_present:
- name: /jffs/etc/hosts
- source: salt://bla
- target: pillars['gateway']
# Generic state to execute a remote command.
gateway-restart-ssh:
cmd.proxy_run:
- name: /etc/init.d/dropbear restart
- target: pillars['gateway']
gateway-restart-ssh:
cmd.proxy_wait:
- name: /etc/init.d/dropbear restart
- target: pillars['gateway']
- watch:
file: gateway-restart-ssh
# Generic nvram key-value state
gateway-configuration:
ddwrt.proxy_nvram: # of just ddwrt.nvram
- name: static_leases
- content: '77:45:43:43:43:43=host1=172.20.0.1= 77:45:43:43:43:43=host2=172.20.0.2='
- target: pillars['gateway']
# Specialized nvram add lease
host1-lease:
ddwrt.proxy_static_leases_present: # or just ddwrt.static_leases_present
- name: 77:45:43:43:43:43
- hostname: host1
- ip: 172.20.0.1
# Specialized nvram remove lease
host1-old-lease:
ddwrt.proxy_static_leases_absent:
- name: 77:45:43:43:43:43
- target: pillars['gateway']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment