DevOps Project: Jenkins CI/CD for Kubernetes Deployments

  DevOps Tech Hub

116 Followers

Ansible Installation Guide



1. Install Ansible Package

[root@~]#amazon-linux-extras install ansible2

2. Verify Ansible version

 [root@~]#ansible --version
ansible 2.9.9
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.18 (default, Aug 27 2020, 21:22:52) [GCC 7.3.1 20180712 (Red Hat 7.3.1-9)]
[root@~]#

3. Install python pip package

[root@~]#yum install python-pip -y 

4. Install docker-py library for python

[root@~]#pip install docker-py  

5. Run Playbook using Ansible

 [root@ip-172-31-1-167 ~]# ansible-playbook play.yaml

[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit
localhost does not match 'all'

PLAY [localhost] ******************************************************************************

TASK [Gathering Facts] ************************************************************************
ok: [localhost]

TASK [Pull .war artifact from Artifactory] ****************************************************
ok: [localhost]

TASK [Log into DockerHub] *********************************************************************
ok: [localhost]

TASK [Pull Tomcat  Container Image] ***********************************************************
ok: [localhost]

TASK [Build image and with build args] ********************************************************
ok: [localhost]

TASK [Push to docker hub] *********************************************************************
ok: [localhost]

PLAY RECAP ************************************************************************************
localhost                  : ok=6    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

[root@ip-172-31-1-167 ~]#


Previous Next