Requisites / difference between 'require and require_in' in SaltStack:
The Salt requisite system is used to create relationships between states. You can find more details about Requisites on here
require:
* This is the most basic requisite which allows us to specify that one state requires another state to be run successfully first.
* Also ensures correct ordering and the requiring states runs only if the required state ran successfully.
Ex:
# cat req.sls
require_check: # REQUIRING STATE
cmd.run:
- name: echo FIRST
- require:
- cmd: require_check1
require_check1: # REQUIRED STATE
cmd.run:
- name: echo SECOND
If the REQUIRED STATE not successful:
require_in:
* Requisites of this form( _in ) force other states to depend on the state that contains the requisite.
* The requiring states run first and then run the required state if requiring state run succcessful.
Ex:
# cat req.sls
require_check: # REQUIRING STATE
cmd.run:
- name: echo FIRST
- require_in:
- cmd: require_check1
require_check1: # REQUIRED STATE
cmd.run:
- name: echo SECOND
If the REQUIRING STATE not successful:
◄ > : - ) ►
require:
* This is the most basic requisite which allows us to specify that one state requires another state to be run successfully first.
* Also ensures correct ordering and the requiring states runs only if the required state ran successfully.
Ex:
# cat req.sls
require_check: # REQUIRING STATE
cmd.run:
- name: echo FIRST
- require:
- cmd: require_check1
require_check1: # REQUIRED STATE
cmd.run:
- name: echo SECOND
If the REQUIRED STATE not successful:
require_in:
* Requisites of this form( _in ) force other states to depend on the state that contains the requisite.
* The requiring states run first and then run the required state if requiring state run succcessful.
Ex:
# cat req.sls
require_check: # REQUIRING STATE
cmd.run:
- name: echo FIRST
- require_in:
- cmd: require_check1
require_check1: # REQUIRED STATE
cmd.run:
- name: echo SECOND
If the REQUIRING STATE not successful:
◄ > : - ) ►
Comments
Post a Comment