DevOps Classroom Series – 16/Dec/2020

Push Based Vs Pull Based CM

  • In PUll Based CM, on the nodes we need to install software agents of CM Server who will be responsible for communication Preview
  • In Push based CM, no agents are required on the nodes.
  • In Push based CM, CM Server needs to have
    • a list of nodes to communicate
    • credentials to login
    • Communication Protocol (SSH/Winrm) enabled on nodes Preview
  • In both pull based and push based CM, we would have the following properties
    • Idempotance: Result of execution of the script should be same (desired state) irrespective of execution count.
  • Advantages of Push based CM
    • Simpler to use
    • Control over the entire system
    • No agents are required to be installed on nodes
  • Advantages of Pull Based CM
    • Easier to Scale
    • No need of credentials of nodes

Installing Ansible:

  • Ansible is written in Python, To run ansible we need python to be installed on Ansible Control Server (CM Server) and also nodes

  • Ansible Control Server can be installed on

    • Linux
    • FreeBSD
    • macOS
  • Nodes can be

    • Linux
    • Free BSD
    • MacOS
    • Windows
    • Network Switches
    • Routers
  • Lets install ansible based on the below architecture Preview

  • Configure Windows Terminal Refer Here

  • Installing ansible on

  • Lets create a ubuntu vm

  • Login in to the ubuntu instance and execute the following commands

sudo apt update
sudo apt install software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt install ansible -y
python --version
ansible --version

Preview

  • Create an ubuntu 18 node in aws/azure as mentioned above
  • The only requirement for any machine to be ansible node is python should be installed.
  • For today lets try to install the same version of python as in ansible control server.
sudo apt update
sudo apt install software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt install python -y

Preview

  • Now we have node and ansible control server ready, so lets try to understand what ansible does to connect to a node
    • Ansible needs to have ipaddress/dns name of the node in a file which is referred as inventory
    • Ansible needs the credentials of the node (username & password) or (username and key)
  • So lets create a inventory is
172.31.45.255
  • Now create a file called as inventory in /home/ubuntu/inventory with the following content
172.31.45.255
  • At this moment lets run the test command to verify if ansible can communicate with the node
ansible -i inventory -m ping all

Preview

  • Lets understand how ansible works and resolve the error in the next class

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin