My favorites | Sign in
Project Home Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
Introduction  
An introduction to how Final State Works.
Updated Nov 25, 2012 by withorwi...@gmail.com

Introduction

Final State is configuration management software. It is, and continues to be designed around some simple core concepts.

  1. Simple Configuration
  2. Powerful
  3. Functional

The goal of the project is such that you are able to describe the final state of some "node" and Final State will attempt to make it reach that state.

Final State is based around the following usage concepts.

  1. Checks
  2. Remedies
  3. Enforcers

For example, if you want to make sure "python 2.6" is installed on a machine. An example state configuration file to achieve that would be as follows. We'll call it "python26.ini" and put it in our states.d directory.

[Settings]
name=Python
depends=Valid OS

[Check]
1=/usr/bin/python2.6 --version

[Remedy]
1=apt-get -y install python

Final State "states" are set up like the above code. You give the "state" a name, in this case "Python", and then say what other "states" it depends on, and once a node has been told to meet that state it will execute all of the lines, in sequential order in the "Check" portion of the config file. If any of the checks exit with a non zero return code, it is assumed to have failed and will then execute the Remedies in the "Remedy" section, in sequential order. Multiple dependencies can be listed on the same line, they just must be comma separated.

Once all the remedies are executed, it will run the check(s) again and see if we are now in the state as specified by the check command(s). If so, we have passed.

Here is an example main config file:

[Nodes]
node1-example=ssh root@node1.example.com
node2-example=ssh root@node2.example.com
node3-example=ssh root@node3.example.com
node4-example=ssh root@node4.example.com
node5-example=ssh root@node5.example.com

[Groups]
Production Nodes=node1-example,node2-example
Development Nodes=node3-example,node4-example
Testing Nodes=node5-example

[Final State]
Production Nodes=example state name 1
Development Nodes=example state name 2
Testing Nodes=example state name 3

[General]
statesdir=./states.d

The "Nodes" section is where you list the node name, and then the command needed to ssh successfully to the need in question. Most commonly you'll want ssh keys set up. You can specify alternate ports in the command line here if need be.

node1-example being the name, ssh root@node1.example.com being ssh command needed to gain ssh access to that node.

Next up is the "Groups" section. Here we set a group name, and then a comma separated list of node names from the "Nodes" section.

The "Final State" section is where you assign a group name, from the above group section to a final state as described in one of ini files. You can specify more than one Final State.

Powered by Google Project Hosting