Understanding relationship between -K & become vs ansible_ssh_user & ansible_ssh_pass

I am creating a simple playbook to add the current user’s public key onto the remote host. My playbook fails with error “Failed to connect to the host via ssh: Permission denied”.

I am running the playbook as non-root, and I can succesfully ssh to the remote host as root. I run the following script with -K and enter the become password when prompted.

Hi,

  1. You are correct but to be more precise, -K is the become password while -k is the user password
  2. You are correct; just to add that become is a privilege escalation, meaning you still connect as X and then sudo as root on the managed node
  3. ansible_user and ansible_password will peer with -k, not -K
  • That None user is strange, is that an actual user ? I suggest you specify remote_user = [ user you log with on the remote system ]