ansible-instantaneous-server-communication

JSON

rev 16  |  foxhop  |  1404837977000  |  JSON

rev 15
rev 16
f1Ansiblef1Ansible
2########2########
n3 n
4 
5how to install on command and control server3how to install on command and control server
6============================================4============================================
7270
73/etc/ansible/group_vars/all71/etc/ansible/group_vars/all
nn72 This is a special group that matches all hosts and groups 
74 This file holds variables for all hosts.73 and holds variables for all hosts.
75 For example, this *all* file causes ansible to use the root SSH user:
7674
n77  .. code-block:: ymln
7875
nn76 
77Behavioral inventory variables and parameters
78================================================
79 
80Sometimes you always want to set specific Ansible/SSH/settings for a
81host, group of hosts, or all hosts.
82 
83For example, this *all* file causes ansible to use the root SSH user:
84 
85 .. code-block:: yml
86 
79    ---87   ---
80    ansible_ssh_user: root88   ansible_ssh_user: root
81    89    
t82dft90Here is a list of other behavioral inventory parameters which may be set in a ho
 >st_vars or group_vars files:
91http://docs.ansible.com/intro_inventory.html#list-of-behavioral-inventory-parame
 >ters
8392
8493
rev 15  |  foxhop  |  1404819355000  |  JSON

rev 14
rev 15
f1Ansiblef1Ansible
2########2########
nn3 
4 
3how to install on command and control server5how to install on command and control server
4============================================6============================================
79    81    
80df82df
tt83 
84 
81how to prepare remote hosts85how to prepare remote hosts
82=============================86=============================
rev 14  |  foxhop  |  1404819327000  |  JSON

rev 13
rev 14
f1Ansiblef1Ansible
2########2########
n3 n
4how to install on command and control server3how to install on command and control server
5============================================4============================================
70 This directory may hold one YAML file for each group. These files are used to p69 This directory may hold one YAML file for each group. These files are used to p
>ass group specific variables.>ass group specific variables.
7170
nn71/etc/ansible/group_vars/all
72 This file holds variables for all hosts.
73 For example, this *all* file causes ansible to use the root SSH user:
7274
tt75  .. code-block:: yml
76 
77    ---
78    ansible_ssh_user: root
79    
80df
73how to prepare remote hosts81how to prepare remote hosts
74=============================82=============================
rev 13  |  foxhop  |  1404818912000  |  JSON

rev 12
rev 13
f1Ansiblef1Ansible
2########2########
nn3 
3how to install on command and control server4how to install on command and control server
4============================================5============================================
55Ansible assumes SSH keys, but may also use passwords, which is invoked with the 56Ansible 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.
5657
tt58ansible configuration files
59=============================
60 
61By default ansible looks to */etc/ansible* for its configurations.  In this sect
 >ion we document some of the configuration files ansible works with.
62 
63/etc/ansible/hosts
64 This file lists all ansible managed hosts and group mappings.
65 
66/etc/ansible/host_vars
67 This directory may hold one YAML file for each host.  These files are used to p
 >ass host specific variables.
68 
69/etc/ansible/group_vars
70 This directory may hold one YAML file for each group. These files are used to p
 >ass group specific variables.
71 
5772
58how to prepare remote hosts73how to prepare remote hosts
rev 12  |  foxhop  |  1404818613000  |  JSON

rev 11
rev 12
85 ansible all --ask-pass -f 20 -a "uptime" 85 ansible all --ask-pass -f 20 -a "uptime" 
8686
tt87give path to a private key
88 
89.. code-block:: bash
90 
91 ansible tutorial_nodes --private-key=id_rsa -m shell -a 'free -m'
92 
8793
8894
rev 11  |  foxhop  |  1404817698000  |  JSON

rev 10
rev 11
f1Ansiblef1Ansible
2########2########
n3 n
4 
5 
6how to install on command and control server3how to install on command and control server
7============================================4============================================
24 virtualenv .env21 virtualenv .env
2522
n26source the environment scripts and install the rest of the dependencies into then23source the environment scripts
> python virtualenv 
2724
28.. code-block:: bash25.. code-block:: bash
30 source ./hacking/env-setup27 source ./hacking/env-setup
31 source ./.env/bin/activate 28 source ./.env/bin/activate 
t32 pip install paramiko PyYAML jinja2 httplib2t29 
30install ansible and dependencies into python virtualenv 
31 
32.. code-block:: bash
33 
34 python setup.py develop
33  35  
34create an ansible hosts file in /etc/ansible/hosts36create an ansible hosts file in /etc/ansible/hosts
rev 10  |  foxhop  |  1400060191000  |  JSON

rev 9
rev 10
2########2########
33
n4First step install ansible on your command and control server (laptop or workstan
>tion, lol).  The next section shows the  process I used on Fedora. 
54
n6how to installn5 
7===================6how to install on command and control server
7============================================
8 
9First step install Ansible on your command and control server (laptop or worksta
 >tion, lol).  
10This section shows the  process I used on Fedora.
811
9install system dependancy12install system dependancy
5154
5255
tt56how to prepare remote hosts
57=============================
58 
59Ansible requires that remote hosts have an SSH service running, and that your pu
 >blic `SSH key` is setup.
60Ansible 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.
61 
5362
5463
rev 9  |  foxhop  |  1399468506000  |  JSON

rev 8
rev 9
68 ansible all --ask-pass -m setup68 ansible all --ask-pass -m setup
6969
tt70change the amount of parallel forks, (default is 5)
71 
72.. code-block:: bash
73 
74 ansible all --ask-pass -f 20 -a "uptime" 
75 
76 
77 
70 78 
rev 8  |  foxhop  |  1399375134000  |  JSON

rev 7
rev 8
3434
35 sudo mkdir /etc/ansible35 sudo mkdir /etc/ansible
t36 sudo echo "127.0.0.1" > /etc/ansible/hostst36 sudo vim /etc/ansible/hosts
37 
38put your targets into */etc/ansible/hosts* for example
39 
40.. code-block:: bash
41 
42 127.0.0.1
3743
38and test!44and test!
rev 7  |  foxhop  |  1399374999000  |  JSON

rev 6
rev 7
2626
27 source ./hacking/env-setup27 source ./hacking/env-setup
n28 source ./env/bin/activate n28 source ./.env/bin/activate 
29 pip install paramiko PyYAML jinja2 httplib229 pip install paramiko PyYAML jinja2 httplib2
30  30  
4545
4646
tt47 
48 
47quick notes49quick notes
48============50============
rev 6  |  foxhop  |  1399239700000  |  JSON

rev 5
rev 6
4343
44Ansible assumes SSH keys, but may also use passwords, which is invoked with the 44Ansible 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.
tt45 
46 
47quick notes
48============
49 
50run arbitary commands
51 
52.. code-block:: bash
53 
54 ansible all --ask-pass -a "uptime"
55 
56get all facts
57 
58.. code-block:: bash
59 
60 ansible all --ask-pass -m setup
61 
62 
rev 5  |  foxhop  |  1399225955000  |  JSON

rev 4
rev 5
42 ansible all -m ping --ask-pass42 ansible all -m ping --ask-pass
4343
tt44Ansible 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.
rev 4  |  foxhop  |  1399225378000  |  JSON

rev 3
rev 4
2########2########
33
t4First step install ansible on your command and control server.  The next sectiont4First 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.
55
6how to install6how to install
rev 3  |  foxhop  |  1399225339000  |  JSON

rev 2
rev 3
29 pip install paramiko PyYAML jinja2 httplib229 pip install paramiko PyYAML jinja2 httplib2
30  30  
tt31create an ansible hosts file in /etc/ansible/hosts
32 
33.. code-block:: bash
34 
35 sudo mkdir /etc/ansible
36 sudo echo "127.0.0.1" > /etc/ansible/hosts
37 
38and test!
39 
40.. code-block:: bash
41 
42 ansible all -m ping --ask-pass
43 
rev 2  |  foxhop  |  1399225129000  |  JSON

rev 1
rev 2
7===================7===================
88
n9:: n9install system dependancy
10 
11.. code-block:: bash
12 
10 sudo yum -y install sshpass13 sudo yum -y install sshpass
1114
n12::n15clone the git repo and create python virtualenv
16 
17.. code-block:: bash
18 
13 git clone git://github.com/ansible/ansible.git19 git clone git://github.com/ansible/ansible.git
14 cd ansible20 cd ansible
15 virtualenv .env21 virtualenv .env
1622
t17::t23source the environment scripts and install the rest of the dependencies into the
 > python virtualenv
24 
25.. code-block:: bash
26 
18 source ./hacking/env-setup27 source ./hacking/env-setup
19 source ./env/bin/activate 28 source ./env/bin/activate 
rev 1  |  foxhop  |  1399224887000  |  JSON

empty
rev 1
tt1Ansible
2########
3 
4First step install ansible on your command and control server.  The next section
 > shows the  process I used on Fedora.
5 
6how to install
7===================
8 
9:: 
10 sudo yum -y install sshpass
11 
12::
13 git clone git://github.com/ansible/ansible.git
14 cd ansible
15 virtualenv .env
16 
17::
18 source ./hacking/env-setup
19 source ./env/bin/activate 
20 pip install paramiko PyYAML jinja2 httplib2
21