Ansible: Setup and Install ansible on Centos 7

From Define Wiki
Revision as of 12:28, 7 February 2017 by David (talk | contribs) (Created page with "== Basic Setup == ** 4 Nodes on vScaler each with Centos 7 image (1 system with floating IP access / all nodes on internal private network) ** SSH keys setup between hosts fo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Basic Setup

    • 4 Nodes on vScaler each with Centos 7 image (1 system with floating IP access / all nodes on internal private network)
    • SSH keys setup between hosts for both users: centos/root
    • SSH in to all nodes to prevent prompt about host authticity
    • /etc/hosts setup on all nodes

Install and Configure Ansible

  • Install ansible on the server (not needed on clients)
# Install the RPMs
yum -y install epel-release 
yum -y install ansible
  • Setup hosts for ansible
# in the file: /etc/ansible/hosts
# this assumes all servers are part of the same group: servers
[servers]
#at1 ansible_ssh_host=192.168.1.27 (this is our server and does not need to be in there) 
at2 ansible_ssh_host=192.168.1.28
at3 ansible_ssh_host=192.168.1.30
at4 ansible_ssh_host=192.168.1.29
  • Check and make sure ansible can talk to all the hosts
[root@ansible-test-1 ~]# ansible -m ping all 
at2 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
at4 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
at3 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}