Description: Here I have explained, What is Ansible? How to install Ansible on Centos? How to install HTTP using Ansible on the client machine?
What is Ansible?
Ansible is an open-source automation software written in Python which is used to deploy software application on client node without an agent.
How to install Ansible on Centos?
Setup:
- Ansible Machine [54.166.147.149]
- Remote Host [54.209.250.129]
- Update the System with the latest packages and security patches using below command
- Install the EPEL repository to install required packages
# wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# yum install epel-release-latest-7.noarch.rpm# yum update -y
Copy SSH key from ansible server to the remote host machine using below command
- Install Ansible and other required packages using below command
- Verify ansible version using below command
- Now I am going to create ssh-key and copy it to remote host to manage it using ansible
You will be prompted to provide name and the password for key pair fill the details. Once you filled name and password SSH key file will create
Copy SSH key from ansible server to the remote host machine using below command
# ssh-copy-id ec2-user@Ansible_Client_IP_Address
OR
Copy id_rsa.pub file content to all Ansible client-machine from .ssh directory
# cd .ssh
# cat id_rsa.pub
Configure Ansible Host
- Open Ansible host file from the location /etc/ansible/hosts and add an entry as follow
[webserver]
172.31.28.116
Install Apache on Ansible Host
- Create runbook on Ansible server as follow
# vi playbook2.yaml---- hosts: webserverremote_user: roottasks:- name: ensure apache is at the latest versionyum: name=httpd state=latest
- Run playbook using below command
No comments:
Post a Comment