ansible

Automate oracle client installation using ansible

We can use the power of ansible to automate the oracle client installation task on multiple servers.In this article, we will explain how we will achieve this by executing an ansible playbook from ansible control node.   Ansible control node  is any machine where ansible tool is installed.    IMPORTANT POINTS: oracle 19c client will […]

How to create host configuration report using ansible-cmdb

ansible-cmdb tool can be used to create system configuration report of your host inventory in different formats like html,csv, json,sql etc.  Let’s go through the below demonstration . Lets say you have hundreds of servers and you can want to generate a report that has server overview details like cpu,mem,disk usage,server type,cpu type etc of […]

How to encrypt ansible inventory file using ansible-vault

If you have hardcoded your host credentials in your inventory file, then it is strongly advised to encrypt that file with proper passcode. In this example, we will see how to do that. 1. Check the inventory file: $ cat preprod_hosts linux_host1 ansible_host=192.289.86.60 ansible_connection=ssh ansible_user=root ansible_ssh_pass=dbatest@123 linux_host2 ansible_host=192.289.86.61 ansible_connection=ssh ansible_user=root ansible_ssh_pass=dbatest@123 linux_host3 ansible_host=192.289.86.62 ansible_connection=ssh ansible_user=root […]

Ansible script to run script on remote server and fetch the output

REQUIREMENT: Write an ansible script ,that will 1. Copy the script collect_info.sh to all the hosts. 1. Run the shell script ( collect_info.sh ) , against the hosts mentioned in host file. 2. Script will be run as root user. 3. The output file of the script ( will be like collect*txt) need to be […]

how to Print execution time of tasks in ansible

Suppose you are running a ansible playbook with multiple tasks and want to print execution time of each task, then do the below changes. Lets see the below sample playbook execution . In this ouput we dont know how much it took for each task execution. [root@ans_scripts]# ansible-playbook playbook_copyfile_multi.yml -i /etc/ansible/inventory.txt PLAY [copy files to […]