Sunday, July 11, 2021

Copy pub key to remote servers using ssh-copy-id


for user in ansible root

do

for server in `cat server.txt`;  

do  

     sshpass -p "password" ssh-copy-id -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa.pub ${user}@$server  

done

done

Sunday, November 10, 2019

Setup ansible environment with the following directory structure.




Tuesday, September 3, 2019

Use Git Grep to Replace Strings in Files in Your Git Repository

On Linux:

git grep -l 'original_text' | xargs sed -i 's/original_text/new_text/g'
On Mac:

git grep -l 'original_text' | xargs sed -i '' -e 's/original_text/new_text/g'
I needed to change a string in a bunch of files and I used the command above using git grep to do it. Worked like a charm.

The -l argument to git grep only returns the file names and not the location in the file like it usually does.

The -e argument is needed with the sed portion on OSX as stated by asmeurer in the comments

Wednesday, January 9, 2019

Ansible Troubleshooting Tips


ansible-config dump --only-changed

Sunday, January 6, 2019

How to make SSH agent running in the background

============================================================

ssh-agent: It is an authentication agent which handles all the private keys password. ssh-agent command initiates a ssh agent background program which we will be used later to store private keys password.You will notice the below output on terminal. Add the output in .bash_profile to always load it automatically.

SSH_AUTH_SOCK=/tmp/ssh-D6wit2Nad0zP/agent.7180; export SSH_AUTH_SOCK;
SSH_AGENT_PID=7181; export SSH_AGENT_PID;
echo Agent pid 7181;

Tuesday, January 1, 2019

After Provisioning the VM you need to install few packages like below

yum install kernel-devel
yum install gcc*



EPEL Repositories

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

( or )

yum -y install epel-release


Ansible Tower Releases

https://releases.ansible.com/ansible-tower/setup/
subscription-manager repos --disable=rhel-7-server-optional-rpms