{"revision": {"id": "f3e8690a-2f95-11f1-9539-e86a64d24d78", "node_id": "f3e74cbe-2f95-11f1-aa17-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Ansible\r\n########\r\nhow to install on command and control server\r\n============================================\r\n\r\nFirst step install Ansible on your command and control server (laptop or workstation, lol).  \r\nThis section shows the  process I used on Fedora.\r\n\r\ninstall system dependancy\r\n\r\n.. code-block:: bash\r\n \r\n sudo yum -y install sshpass\r\n\r\nclone the git repo and create python virtualenv\r\n\r\n.. code-block:: bash\r\n\r\n git clone git://github.com/ansible/ansible.git\r\n cd ansible\r\n virtualenv .env\r\n\r\nsource the environment scripts\r\n\r\n.. code-block:: bash\r\n\r\n source ./hacking/env-setup\r\n source ./.env/bin/activate \r\n\r\ninstall ansible and dependencies into python virtualenv \r\n\r\n.. code-block:: bash\r\n\r\n python setup.py develop\r\n  \r\ncreate an ansible hosts file in /etc/ansible/hosts\r\n\r\n.. code-block:: bash\r\n\r\n sudo mkdir /etc/ansible\r\n sudo vim /etc/ansible/hosts\r\n\r\nput your targets into */etc/ansible/hosts* for example\r\n\r\n.. code-block:: bash\r\n\r\n 127.0.0.1\r\n\r\nand test!\r\n\r\n.. code-block:: bash\r\n\r\n ansible all -m ping --ask-pass\r\n\r\nAnsible assumes SSH keys, but may also use passwords, which is invoked with the `--ask-pass` flag.  Invoke the `--ask-sudo-pass` flag if you need to supply a sudo password.\r\n\r\nansible configuration files\r\n=============================\r\n\r\nBy default ansible looks to */etc/ansible* for its configurations.  In this section we document some of the configuration files ansible works with.\r\n\r\n/etc/ansible/hosts\r\n This file lists all ansible managed hosts and group mappings.\r\n\r\n/etc/ansible/host_vars\r\n This directory may hold one YAML file for each host.  These files are used to pass host specific variables.\r\n\r\n/etc/ansible/group_vars\r\n This directory may hold one YAML file for each group. These files are used to pass group specific variables.\r\n\r\n/etc/ansible/group_vars/all\r\n This is a special group that matches all hosts and groups \r\n and holds variables for all hosts.\r\n\r\n\r\n\r\nBehavioral inventory variables and parameters\r\n================================================\r\n\r\nSometimes you always want to set specific Ansible/SSH/settings for a\r\nhost, group of hosts, or all hosts.\r\n\r\nFor example, this *all* file causes ansible to use the root SSH user:\r\n\r\n .. code-block:: yml\r\n\r\n   ---\r\n   ansible_ssh_user: root\r\n    \r\nHere is a list of other behavioral inventory parameters which may be set in a host_vars or group_vars files:\r\nhttp://docs.ansible.com/intro_inventory.html#list-of-behavioral-inventory-parameters\r\n\r\n\r\nhow to prepare remote hosts\r\n=============================\r\n\r\nAnsible requires that remote hosts have an SSH service running, and that your public `SSH key` is setup.\r\nAnsible also requires that all remote hosts have Python 2.4.x and the python JSON library (python-simplejson).  Python 2.6.x and above ship with JSON library in the stdlib, so nothing needs to be done if you are using a newer operating system.\r\n\r\n\r\n\r\nquick notes\r\n============\r\n\r\nrun arbitary commands\r\n\r\n.. code-block:: bash\r\n\r\n ansible all --ask-pass -a \"uptime\"\r\n\r\nget all facts\r\n\r\n.. code-block:: bash\r\n\r\n ansible all --ask-pass -m setup\r\n\r\nchange the amount of parallel forks, (default is 5)\r\n\r\n.. code-block:: bash\r\n\r\n ansible all --ask-pass -f 20 -a \"uptime\" \r\n\r\ngive path to a private key\r\n\r\n.. code-block:: bash\r\n\r\n ansible tutorial_nodes --private-key=id_rsa -m shell -a 'free -m'\r\n\r\n\r\n\r\n ", "source_format": "rst", "revision_number": 16, "created": 1404837977000}}