New security rule is implemented to add passcode to your ssh private key.
This messed up running ansible jobs.
You have to generate new key, update to your all systems.
Verify if ssh-key has password set up or not
$ ssh-keygen -y -f ~jay/.ssh/id-rsa-pub
if it does not prompt you for password, you have to re-create the key.
to create the key with password run the following command
$ ssh-keygen -n [passphrase]
now, you have to update your key to all servers.
If you have your home dire shared, you are good. This is the case at my env.
Once you copy your keys, now, time to run ansible commands, it will fail until you supply your passphrase.
There might be many different ways to do this but I used ssh-agent
$ eval $(ssh-agent)
$ ssh-add ~jay/id-rsa
you enter the passphrase
it will be in memory so you can run all ansible commands without supplying the passphrase.
$ cat my_hosts
lsdv.eg.com
lsdk.eg.com
lsdm.eg.com
lsdn.eg.com
$ ansible -i my_hosts all -m yum -a "state=present name=/repo/apps/code/code.12.2-234.el7.x86_64.rpm" -b -K
$ ansible -i my_hosts all -a "rpm -qa code" -b -K
$ ansible -i my_hosts all -a "aide --init" -b -K
$ ansible -i my_hosts all -a "cp -a /var/tmp/resolv.conf /etc/resolv.conf" -b -K
$ ansible -i my_hosts all -a "ls -lh /etc/resolv.conf" -b -K
Tuesday, March 16, 2021
Ansible - Generating ssh key with passphrage and executing the commands
Subscribe to:
Post Comments (Atom)
Git branch show detached HEAD
Git branch show detached HEAD 1. List your branch $ git branch * (HEAD detached at f219e03) 00 2. Run re-set hard $ git reset --hard 3. ...
-
snmpconfig command allow you to managge snmpv1/v3 agent configuration on SAN switch. Event trap level is mapped with event severity level....
-
Firmware upgrade on HPE SuperDom Flex 280 - prerequisites tasks a. Set up repo b. Upload firmware to your webserver 1. For foundation so...
-
Disabling the Telnet protocol on Brocade SAN switches By default, telnet is enabled on Brocade SAN switches. As part of security hardening o...
No comments:
Post a Comment