Understanding Configuration Management with Ansible

1 min read

Cover Image for Understanding Configuration Management with Ansible

Task-01

  • Installation of Ansible on AWS EC2 (Master Node) sudo apt-add-repository ppa:ansible/ansible sudo apt update sudo apt install ansible

Task-02

  • read more about Hosts file sudo nano /etc/ansible/hosts ansible-inventory --list -y

    we need to add inventories (server host IP address and variables) to configure node servers

      [servers]
      server1 ansible_host=18.216.60.122
      server2 ansible_host=3.145.4.9
    
      [all:vars]
      ansible_python_interpreter=/usr/bin/python3
    

Task-03

  • Setup 2 more EC2 instances with the same Private keys as the previous instance (Node)

  • Copy the private key to master server where Ansible is setup

    just copy the private key i.e "<file_name>.pem" file and add it to servers ~/.ssh/ansible_key.

Try a ping command using ansible to the Nodes.

ansible all -m ping -i /home/ubuntu/hosts --private-key=~/.ssh/ansible_key

We can configure multiple server with one master server with ansible.

it ssh into the node server connects to it and complete the task which os mentioned in the variables in inventory file/

HappyLearning!!