I apologize for this type of response, because they bug me a lot. It's when someone says, "I want to do X. How do I do X?" And the responder say, "You should want Y!"
I don't see an option in Ansible to read the ssh_pass from a file. However, native ssh itself can be made to run the script named in the SSH_ASKPASS environment variable, using its output as the ssh password. Perhaps that can be made to do what you describe. I haven't done that myself. I don't know if the paramiko ssh implementation supports that either. But what you describe — "I don't want to type a password every time…" — is better achieved by setting up and using ssh keys. I encourage you to look into that solution. Picky unrelated stuff: * Your "hosts.yaml" inventory isn't a YAML file. Looks like the "ini" format to me. * People seem to enjoy sticking host variables into inventories. There are other ways to associated such data with hosts. My personal preference is to limit inventories to listing hosts and associating them through groups, putting anything else somewhere else. But maybe that's just me. On Thursday, December 14, 2023 at 2:41:41 AM UTC-5 Sameer Modak wrote: > Hello Team, > > how to encrypt ssh_pass password without asking any more password. I dont > want to type password everytime i run the ad hoc command like > ansible -i hosts.yaml -m shell -a "ulimit -a". I dont want to put the > password everytime i just want to hide or obscure or salt the below > password > > hosts.yaml has below all:vars > > > [all:vars] > > ansible_ssh_common_args='-o StrictHostKeyChecking=no' > > ansible_connection=ssh > > ansible_port=22 > > ansible_user=sam > > ansible_ssh_pass=abc@123 > > > > Now i want to hide ansible_ssh_pass variable or encrypt/salt this value > thats it . > > > how do i do that. I m ok even if i store that in plaintext and reference > here . > > im fine evenits base64 just should not be in plain in hosts.yaml. > > > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/255e77e4-52e6-4035-b767-5c81b66d201en%40googlegroups.com.
