Ok then, for the past few months I have been trying to get my Linux skills up to speed so that I can get involved in the technology. My present work has nothing to do with Linux and in all likelihood what I learn in terms of Linux will never be helpful in what I do. However it might be helpful in life! (ahh so philosophical!)
So after going about learning a bunch of videos at Linux Academy, which I completely recommend by the way, I wanted to get into the world of Ansible. Why you may ask? Well its just plain fun (such a geek!). So I initially tried to get Ansible to work with Windows and winrm and I failed miserably! I spent like 2 whole days I couldn't get it to work, so I just gave up on the Windows bit and concentrated on managing the Linux boxes!
So in this post I will try to outline the steps I did to get Anisble working in my lab with mainly Centos boxes!
Machine name: Oracle
Machine Names: Neo, Trinity and Morpheus
Installing ansible on the control server (Oracle)
I am logged in as root and I will run the setup using this account
RUN AN UPDATE
# yum update && yum upgrade -y
# yum install wget
Since this is CentOS we need to download the repo and install it from that.
Install Python and misc tools
# yum install python
# yum install python-pip
# pip install --upgrade pip
# pip install markupsafe
# pip install xmltodict
# pip install pywinrm
# yum install ansible -y
Confirm the installation
# ansible --version
you should see something like
ansible 18.104.22.168 config file = /etc/ansible/ansible.cfg configured module search path = Default w/o overrides
CONFIGURE TO USE SSH KEYS WITH THE REMOTE HOSTS
Another things you would need to do is setup SSH key based authentication to the remote hosts from your control server. .
The SSH Key based authentication is really easy to setup, All you need to do is on the control server issue the below commands.
# ssh-keygen -t rsa
# Enter the file in which to save the key (Press enter to accept the default location)
# Enter a passphrase (You can choose to leave it blank if this is a test environment or else enter something in)
After the key has been created with a conformation screen you need to copy this key to all the remote hosts that you plan to manage using the below command.
# ssh-copy-id root@neo
Type yes on the next prompt and then eventually enter a password for the remote machine to get the keys copied over. After the keys have been copied perform a SSH to the remote machine and this time it should ask you for the pass phrase and once you enter that it will let you in.