Skip to content

Instantly share code, notes, and snippets.

@zlanich
Created August 11, 2016 01:18
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 zlanich/a6204d4ff7b61e8e0880396795fec541 to your computer and use it in GitHub Desktop.
Save zlanich/a6204d4ff7b61e8e0880396795fec541 to your computer and use it in GitHub Desktop.
# Infrastrucutre Data Example:
infrastructure:
name: Some Infrastructure
id: 123
enabled_environments:
- staging
- development
backups: true
size_resources:
mem: 512MB
cores: 1
hdd: 20GB
high_availability:
enabled: true
web_nodes: 2
load_balancers: 1
caching: true
platform: wordpress
sites:
somesite.com:
multisite: false
docroot: /var/www
envs:
- staging:
domain: somesite.stag.almost.online
- development:
domain: somesite.dev.almost.online
# Insert Infrastructure data into Mongo under its ID:
db.pillar.insert({
_id: 'inf-123',
mongo_pillar: {
< the data above >
}})
# Orchestration (psuedo code):
Ex. 2 webs nodes + lb with template inf-<inf id>-role-<role num>:
var pillar = salt ‘inf-123’ pillar.items
salt-run state.orchestrate orch.ha_web_setup pillar = pillar
## ...loops run, nodes are created for a given infrastrucutre orchestraion...
## Creates:
inf-123-webserver-1
inf-123-webserver-2
inf-123-loadbalancer-1
# Highstate
## Salt passes these to Mongo Pillar Module:
inf-123-webserver-1
inf-123-webserver-2
inf-123-loadbalancer-1
ext_pillar:
- mongo: { … re_pattern: inf-\d+-\w+-\d+ … }
# Would these pillars match up?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment