Ansible Task 1 (configuring Docker)

  • set up one manager node and one managed node
  • install ansible in managed node by pip3 install ansible
  • configure the ip managed node in a txt file and add that file to ansible config file at /etc/ansible/ansible.cfg
  • check if all the managed nodes are pingable by
    ansible all -m ping
  • In this file we write all our ip addresses of managed nodes.
    ansible_user: The user name to use when connecting to the host.
    ansible_ssh_pass: managed node password for ssh connection.
  • file: myhosts.txt
    location: /etc/myhosts.txt
  • inventory: where all are host ips are stored
    host_key_checking: it auto saves the ssh key for first time connection.
  • File: ansible.cfg
    Location: /etc/ansible/ansible.cfg
  • Step 1: we define on which set of hosts we want to run the ansible playbook.
  • we have set a variable docker for docker full name with version which we will install on our manged node
  • Step 2 : adding a yum repo of docker-ce and installing docker
    Note: we have to write full name of docker with version for community edition.
  • Installing docker and printing std output
  • Step 3: installing python so that we can use pip3 module from python.
    Installing python module of docker from pip3. it is necessary for proper functioning of docker.
  • Starting the docker service permanently
  • Stoping and disabling the firewalld of rhel
  • copying our webapp code from managed node to managed node.
  • Step 4 : pulling a docker image from docker hub
  • launching a docker container named “httpd_webserver”
  • mounting /var/www/html/ from host to container
  • exposing port 81 for outside connectivity
  • port forwarding port 81 -> 80
  • finally printing full details of container just like (docker inspect httpd_webserver)




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Why Your Python Version (or other apps) Don’t Work on the Apple MacBook M1

Software Deployment Strategies Part 2

Event Driven Microservice for dummies

Alibaba Cloud ApsaraDB for Redis: Your Best Bet to Optimize Application Performance at Minimum Cost

from Buffer

CKA : Upgrading kubeadm clusters

Java Coding Problems Review

Keeping Pace With What’s New in Java 14

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


More from Medium

Remote connect AWS windows EC2 without exposing public IP with Omniedge

Scheduling the Follow up emails using Power Automate — part 1

5G Apps on hyperscalers Marketplace

Launch Container Without Using Docker Tool .