Forming a state module
State modules are more structured than most other kinds of modules, but as you'll soon see, that actually makes them easier to write.
Determining state
There is a set of operations that a state module must take in order to perform its job, and as those operations are done, there is certain data that is stored. Let's start off with a pseudo piece of code, and explain each component in turn:
def __virtual__(): ''' Only load if the necesaary modules available in __salt__ ''' if 'module.function' in __salt__: return True return False def somestate(name): ''' Achieve the desired state nane The name of the item to achieve statefulness ''' ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''} if <item is already in the desired state>...