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

41 views
Skip to first unread message

Stephen Eaton

unread,
Oct 1, 2020, 8:57:58 AM10/1/20
to Ansible Project
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

Stephen Eaton

unread,
Oct 1, 2020, 9:12:26 AM10/1/20
to ansible...@googlegroups.com

Doh!!!!!

 

‘-k’ was the culprit

 

…ill just crawl back under my rock….

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/Yo_gX6NbZp8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/87c122d0-218a-4765-84eb-a62739cc6549n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages