On Mon, 23 Nov 2020 23:51:28 -0800 (PST)
Mike Cavedon <[email protected]> wrote:

> - name: Delete/link properties
>   hosts: emissary
>   remote_user: remoteUser
>    tasks:
>     - name: Link all properties files
> ...
> The task executes as user 'ec2-user' when I'm expecting it to be 
> 'remoteUser':
> ...
> *01:11:53* <172.17.70.215> ESTABLISH SSH CONNECTION FOR USER: *ec2-user*

Variables will override playbook keywords. See "Precedence categories"
https://docs.ansible.com/ansible/latest/reference_appendices/general_precedence.html#precedence-categories

There must be a variable *ansible_user* or *ansible_ssh_user* or
environment *ANSIBLE_REMOTE_USER* with the value *ec2-user*

See "ssh connection plugin"
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/ssh_connection.html#ansible-builtin-ssh-connect-via-ssh-client-binary

For example, the playbook below

  shell> cat pb.yml
  - hosts: test_01
    remote_user: remoteUser
    tasks:
      - debug:
          var: ansible_user

gives (abridged)

  shell> ANSIBLE_REMOTE_USER=admin ansible-playbook pb.yml
  
  ok: [test_01] => 
    ansible_user: admin

-- 
Vladimir Botka

-- 
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/20201124093214.2aa49762%40gmail.com.

Attachment: pgpVjreNk78S6.pgp
Description: OpenPGP digital signature

Reply via email to