How do I stop ansible-playbook asking for ssh password??

Hi All,

I’m trying to bootstrap some remote VMs (ubuntu1804) that are not physically managed by me and have only been given ssh accesses as root via ssh keys only i.e. no password. I can confirm this works, i.e. I can ssh in as root with no password from my cli

using ansible 2.10.1 on macOS under python 3.8

I want to bootstrap these machines to get them onto our CI/CD pipeline

I’m using the playbook I normally bootstrap however ansible-playbook keeps prompting for a password in this case.

ansible-playbook bootstrap.yml -k -extra-vars="hosts=x.x.x.x remote_user=root"

I have also tried passing my ssh private key using ‘–private-key’ parameter to no avail.

also added ask_pass=False to my local ansible.cfg to no avail

I’ve successfully used this on other vms in the past that I physically manage however I just use the root password and then my bootstrap playbook does does the rest.

local ansible.cfg

[defaults]
roles_path=roles
ask_pass=false

transport=ssh

my playbook bootstrap.yml is:

  • name: Bootstrap remote server for CI
    hosts: ‘{{ hosts }}’
    remote_user: ‘{{ user }}’
    gather_facts: no

roles:

  • role: bootstrap

Thanks

Stephen

Doh!!!

‘-k’ was the culprit

…ill just crawl back under my rock….