Last active
August 29, 2015 14:00
-
-
Save ryan-lane/f423b87c5dabcc24301d to your computer and use it in GitHub Desktop.
Salt states example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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