Is it possible to specify a password for the SSH connection in Ansible (the initial connection not the one for sudo) in a non-interactive way (ie. in config file or a command)?
The configuration file in Ansible has the option ask_pass to prompt user to input the password (works ok), but I would like to hardcode the default Raspberry Pi’s password (which is “raspberry” on the original image) for the purpose of unattended configuration of new Pis.
You mean a parameter in the playbook? Never thought it was possible, but I tried your suggestion and it did not work. I got the following (I am using 1.9.4 now):
`
ERROR: ansible_ssh_pass is not a legal parameter in an Ansible task or handler
`
The link you mentioned is however a description of the parameters for the inventory file. And it works, but I forgot to mention that I do not want to use the inventory file and provide the IP address of the destination machine as a command-line parameter (that’s why I asked this question - if the “syntax with comma” would allow passing parameters, I could do it).
Summary of my goal (initial configuration only, before I upload the ssh keys with Ansible):
pass the destination IP address as a command-line parameter for ansible-playbook command
hardcode user name “pi” (now in ansible.cfg)
hardcode password 'raspberry" (in ansible.cfg, as a command-line parameter or elsewhere, but not in the inventory file which I do not intend to use)