pip can be called as preferred installer program. pip is package management used to install software which written in Python.

 

To know how to install and configure “Ansible” you can refer to the below links.

 

Before installing with pip let us resolve required dependencies for pip. By installing “python-setuptools” we will get “easy_install”.

# yum install python-setuptools

 

[root@ansible ~]# yum install python-setuptools 
Resolving Dependencies 
--> Running transaction check 
---> Package python-setuptools.noarch 0:0.9.8-4.el7 will be installed 
--> Processing Dependency: python-backports-ssl_match_hostname for package: python-setuptools-0.9.8-4.el7.noarch 
--> Running transaction check 
---> Package python-backports-ssl_match_hostname.noarch 0:3.4.0.2-4.el7 will be installed 
--> Processing Dependency: python-backports for package: python-backports-ssl_match_hostname-3.4.0.2-4.el7.noarch 
--> Running transaction check 
---> Package python-backports.x86_64 0:1.0-8.el7 will be installed 
--> Finished Dependency Resolution Installed:   
python-setuptools.noarch 0:0.9.8-4.el7                                   Dependency Installed:
   python-backports.x86_64 0:1.0-8.el7                                     python-backports-ssl_match_hostname.noarch 0:3.4.0.2-4.el7          Complete!

 

Now install wit “pip” being root user run the below command to install with “pip”.

# sudo easy_install pip

 

[root@ansible ~]# sudo easy_install pip 
Searching for pip Reading https://pypi.python.org/simple/pip/ Best match: pip 9.0.1 Downloading https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9 
Processing pip-9.0.1.tar.gz 
Writing /tmp/easy_install-m6_rHv/pip-9.0.1/setup.cfg 
Running pip-9.0.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-m6_rHv/pip-9.0.1/egg-dist-tmp-diQmpt 
Adding pip 9.0.1 to easy-install.pth file 
Installing pip script to /usr/bin 
Installing pip2.7 script to /usr/bin 
Installing pip2 script to /usr/bin 
Installed /usr/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg Processing dependencies for pip Finished processing dependencies for pip
[root@ansible ~] 

 

It’s time to install with “ansible” using pip installer. This will pull the required dependencies to install with “ansible”.

# sudo pip install ansible

 

# sudo pip install ansible 
Collecting ansible   Downloading ansible-2.4.3.0.tar.gz (6.5MB)     100% |################################| 6.5MB 83kB/s  Collecting jinja2 (from ansible)   Downloading Jinja2-2.10-py2.py3-none-any.whl (126kB)     100% |################################| 133kB 2.6MB/s  
Installing collected packages: MarkupSafe, jinja2, PyYAML, pyasn1, six, pycparser, cffi, bcrypt, idna, enum34, ipaddress, asn1crypto, cryptography, pynacl, paramiko, ansible   
Running setup.py install for MarkupSafe ... done   
Running setup.py install for PyYAML ... done   
Running setup.py install for pycparser ... done   
Running setup.py install for ipaddress ... done   
Running setup.py install for ansible ... done 
Successfully installed MarkupSafe-1.0 PyYAML-3.12 ansible-2.4.3.0 asn1crypto-0.24.0 bcrypt-3.1.4 cffi-1.11.5 cryptography-2.1.4 enum34-1.1.6 idna-2.6 ipaddress-1.0.19 jinja2-2.10 paramiko-2.4.0 pyasn1-0.4.2 pycparser-2.18 pynacl-1.2.1 six-1.11.0
[root@ansible ~]

 

Create an inventory file to start the testing by running a ping test.

[ansible@ansible ~]$ cat hosts
[oel7_prod]
ansiclient1.oel7.local
ansiclient2.oel7.local
ansiclient3.oel7.local
[ansible@ansible ~]$

 

Run the ansible by pointing to inventory file using “-i”.

Ansible   = command
-i        = pointing to inventory file.
-m        = module ping
oel7_prod = group of hosts

 

[ansible@ansible ~]$ ansible -i hosts -m ping oel7_prod
ansiclient2.oel7.local | SUCCESS => {     "changed": false,      "ping": "pong" } 
ansiclient3.oel7.local | SUCCESS => {     "changed": false,      "ping": "pong" } 
ansiclient1.oel7.local | SUCCESS => {     "changed": false,      "ping": "pong" }

 

We have successfully installed ansible using “pip” installer and tested by running a ping over remote servers.

 

Conclusion:

Pip method of installation is easier to follow and we will get updated packages from pip than installing ansible from yum. Subscribe to our newsletter to keep you updated.

 

Was dit antwoord nuttig? 0 gebruikers vonden dit artikel nuttig (0 Stemmen)