Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ryan-lane
Last active August 29, 2015 14:00
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 ryan-lane/f423b87c5dabcc24301d to your computer and use it in GitHub Desktop.
Save ryan-lane/f423b87c5dabcc24301d to your computer and use it in GitHub Desktop.
Salt states example
# Two inconsistent and unclear ways of defining a state:
pkg.installed:
- name: mypackage
apache2:
pkg
- installed
service:
- running
- enable: True
- require:
pkg: mypackage
pkg: apache2
# Clear way of defining a state, which allows the developer to read
# the state and understand what's happening from the name. This also
# makes it clear what's occuring when the states are run:
Ensure mypackage is installed:
pkg.installed:
- name: mypackage
Ensure apache installed:
pkg.installed:
- name: apache2
Ensure apache running:
service.running:
- name: apache2
- enable: True
- require:
pkg: apache2
pkg: mypackage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment