|
|
| f | Ansible | f | Ansible |
| ######## | | ######## |
| n | | n | |
| | | |
| how to install on command and control server | | how to install on command and control server |
| ============================================ | | ============================================ |
| | | |
| /etc/ansible/group_vars/all | | /etc/ansible/group_vars/all |
| n | | n | This is a special group that matches all hosts and groups |
| This file holds variables for all hosts. | | and holds variables for all hosts. |
| For example, this *all* file causes ansible to use the root SSH user: | | |
| | | |
| n | .. code-block:: yml | n | |
| | | |
| n | | n | |
| | | Behavioral inventory variables and parameters |
| | | ================================================ |
| | | |
| | | Sometimes you always want to set specific Ansible/SSH/settings for a |
| | | host, group of hosts, or all hosts. |
| | | |
| | | For example, this *all* file causes ansible to use the root SSH user: |
| | | |
| | | .. code-block:: yml |
| | | |
| --- | | --- |
| ansible_ssh_user: root | | ansible_ssh_user: root |
| | | |
| t | df | t | Here is a list of other behavioral inventory parameters which may be set in a ho |
| | | st_vars or group_vars files: |
| | | http://docs.ansible.com/intro_inventory.html#list-of-behavioral-inventory-parame |
| | | ters |
| | | |
| | | |
|
|
| f | Ansible | f | Ansible |
| ######## | | ######## |
| n | | n | |
| | | |
| how to install on command and control server | | how to install on command and control server |
| ============================================ | | ============================================ |
| | | |
| df | | df |
| t | | t | |
| | | |
| how to prepare remote hosts | | how to prepare remote hosts |
| ============================= | | ============================= |
|
|
| f | Ansible | f | Ansible |
| ######## | | ######## |
| n | | n | |
| how to install on command and control server | | how to install on command and control server |
| ============================================ | | ============================================ |
| This directory may hold one YAML file for each group. These files are used to p | | This directory may hold one YAML file for each group. These files are used to p |
| ass group specific variables. | | ass group specific variables. |
| | | |
| n | | n | /etc/ansible/group_vars/all |
| | | This file holds variables for all hosts. |
| | | For example, this *all* file causes ansible to use the root SSH user: |
| | | |
| t | | t | .. code-block:: yml |
| | | |
| | | --- |
| | | ansible_ssh_user: root |
| | | |
| | | df |
| how to prepare remote hosts | | how to prepare remote hosts |
| ============================= | | ============================= |
|
|
| f | Ansible | f | Ansible |
| ######## | | ######## |
| n | | n | |
| how to install on command and control server | | how to install on command and control server |
| ============================================ | | ============================================ |
| Ansible assumes SSH keys, but may also use passwords, which is invoked with the | | Ansible 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 su | | `--ask-pass` flag. Invoke the `--ask-sudo-pass` flag if you need to supply a su |
| do password. | | do password. |
| | | |
| t | | t | ansible configuration files |
| | | ============================= |
| | | |
| | | By default ansible looks to */etc/ansible* for its configurations. In this sect |
| | | ion we document some of the configuration files ansible works with. |
| | | |
| | | /etc/ansible/hosts |
| | | This file lists all ansible managed hosts and group mappings. |
| | | |
| | | /etc/ansible/host_vars |
| | | This directory may hold one YAML file for each host. These files are used to p |
| | | ass host specific variables. |
| | | |
| | | /etc/ansible/group_vars |
| | | This directory may hold one YAML file for each group. These files are used to p |
| | | ass group specific variables. |
| | | |
| | | |
| how to prepare remote hosts | | how to prepare remote hosts |
|
|
| ansible all --ask-pass -f 20 -a "uptime" | | ansible all --ask-pass -f 20 -a "uptime" |
| | | |
| t | | t | give path to a private key |
| | | |
| | | .. code-block:: bash |
| | | |
| | | ansible tutorial_nodes --private-key=id_rsa -m shell -a 'free -m' |
| | | |
| | | |
| | | |
|
|
| f | Ansible | f | Ansible |
| ######## | | ######## |
| n | | n | |
| | | |
| | | |
| how to install on command and control server | | how to install on command and control server |
| ============================================ | | ============================================ |
| virtualenv .env | | virtualenv .env |
| | | |
| n | source the environment scripts and install the rest of the dependencies into the | n | source the environment scripts |
| python virtualenv | | |
| | | |
| .. code-block:: bash | | .. code-block:: bash |
| source ./hacking/env-setup | | source ./hacking/env-setup |
| source ./.env/bin/activate | | source ./.env/bin/activate |
| t | pip install paramiko PyYAML jinja2 httplib2 | t | |
| | | install ansible and dependencies into python virtualenv |
| | | |
| | | .. code-block:: bash |
| | | |
| | | python setup.py develop |
| | | |
| create an ansible hosts file in /etc/ansible/hosts | | create an ansible hosts file in /etc/ansible/hosts |
|
|
| ######## | | ######## |
| | | |
| n | First step install ansible on your command and control server (laptop or worksta | n | |
| tion, lol). The next section shows the process I used on Fedora. | | |
| | | |
| n | how to install | n | |
| =================== | | how to install on command and control server |
| | | ============================================ |
| | | |
| | | First step install Ansible on your command and control server (laptop or worksta |
| | | tion, lol). |
| | | This section shows the process I used on Fedora. |
| | | |
| install system dependancy | | install system dependancy |
| | | |
| | | |
| t | | t | how to prepare remote hosts |
| | | ============================= |
| | | |
| | | Ansible requires that remote hosts have an SSH service running, and that your pu |
| | | blic `SSH key` is setup. |
| | | Ansible also requires that all remote hosts have Python 2.4.x and the python JSO |
| | | N 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 syst |
| | | em. |
| | | |
| | | |
| | | |
|
|
| ansible all --ask-pass -m setup | | ansible all --ask-pass -m setup |
| | | |
| t | | t | change the amount of parallel forks, (default is 5) |
| | | |
| | | .. code-block:: bash |
| | | |
| | | ansible all --ask-pass -f 20 -a "uptime" |
| | | |
| | | |
| | | |
| | | |
|
|
| | | |
| sudo mkdir /etc/ansible | | sudo mkdir /etc/ansible |
| t | sudo echo "127.0.0.1" > /etc/ansible/hosts | t | sudo vim /etc/ansible/hosts |
| | | |
| | | put your targets into */etc/ansible/hosts* for example |
| | | |
| | | .. code-block:: bash |
| | | |
| | | 127.0.0.1 |
| | | |
| and test! | | and test! |
|
|
| | | |
| source ./hacking/env-setup | | source ./hacking/env-setup |
| n | source ./env/bin/activate | n | source ./.env/bin/activate |
| pip install paramiko PyYAML jinja2 httplib2 | | pip install paramiko PyYAML jinja2 httplib2 |
| | | |
| | | |
| | | |
| t | | t | |
| | | |
| quick notes | | quick notes |
| ============ | | ============ |
|
|
| | | |
| Ansible assumes SSH keys, but may also use passwords, which is invoked with the | | Ansible 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 su | | `--ask-pass` flag. Invoke the `--ask-sudo-pass` flag if you need to supply a su |
| do password. | | do password. |
| t | | t | |
| | | |
| | | quick notes |
| | | ============ |
| | | |
| | | run arbitary commands |
| | | |
| | | .. code-block:: bash |
| | | |
| | | ansible all --ask-pass -a "uptime" |
| | | |
| | | get all facts |
| | | |
| | | .. code-block:: bash |
| | | |
| | | ansible all --ask-pass -m setup |
| | | |
| | | |
|
|
| ansible all -m ping --ask-pass | | ansible all -m ping --ask-pass |
| | | |
| t | | t | Ansible 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 su |
| | | do password. |
|
|
| ######## | | ######## |
| | | |
| t | First step install ansible on your command and control server. The next section | t | First step install ansible on your command and control server (laptop or worksta |
| shows the process I used on Fedora. | | tion, lol). The next section shows the process I used on Fedora. |
| | | |
| how to install | | how to install |
|
|
| pip install paramiko PyYAML jinja2 httplib2 | | pip install paramiko PyYAML jinja2 httplib2 |
| | | |
| t | | t | create an ansible hosts file in /etc/ansible/hosts |
| | | |
| | | .. code-block:: bash |
| | | |
| | | sudo mkdir /etc/ansible |
| | | sudo echo "127.0.0.1" > /etc/ansible/hosts |
| | | |
| | | and test! |
| | | |
| | | .. code-block:: bash |
| | | |
| | | ansible all -m ping --ask-pass |
| | | |
|
|
| =================== | | =================== |
| | | |
| n | :: | n | install system dependancy |
| | | |
| | | .. code-block:: bash |
| | | |
| sudo yum -y install sshpass | | sudo yum -y install sshpass |
| | | |
| n | :: | n | clone the git repo and create python virtualenv |
| | | |
| | | .. code-block:: bash |
| | | |
| git clone git://github.com/ansible/ansible.git | | git clone git://github.com/ansible/ansible.git |
| cd ansible | | cd ansible |
| virtualenv .env | | virtualenv .env |
| | | |
| t | :: | t | source the environment scripts and install the rest of the dependencies into the |
| | | python virtualenv |
| | | |
| | | .. code-block:: bash |
| | | |
| source ./hacking/env-setup | | source ./hacking/env-setup |
| source ./env/bin/activate | | source ./env/bin/activate |
|
|
| t | | t | Ansible |
| | | ######## |
| | | |
| | | First step install ansible on your command and control server. The next section |
| | | shows the process I used on Fedora. |
| | | |
| | | how to install |
| | | =================== |
| | | |
| | | :: |
| | | sudo yum -y install sshpass |
| | | |
| | | :: |
| | | git clone git://github.com/ansible/ansible.git |
| | | cd ansible |
| | | virtualenv .env |
| | | |
| | | :: |
| | | source ./hacking/env-setup |
| | | source ./env/bin/activate |
| | | pip install paramiko PyYAML jinja2 httplib2 |
| | | |