I have a playbook that executes 'emissary_deploy.yml' as an include:
---
- include: emissary_deploy.yml
emissary_deploy contains the following:
- name: Delete/link properties
hosts: emissary
remote_user: remoteUser
tasks:
- name: Link all properties files
file: src="{{ item.src }}" dest="{{ item.dest }}" state=link
with_items:
- src: "{{ emissary_shared }}/data"
dest: "{{ new_extracted_path }}/data"
The task executes as user 'ec2-user' when I'm expecting it to be 'remoteUser':
01:11:53 TASK [Link all properties files] ***********************************************
01:11:53 task path: /var/lib/jenkins/workspace/emissary-jdk11_create_ami/emissary_deploy.yml:73
01:11:53 Using module file /var/lib/jenkins/workspace/emissary-jdk11_create_ami/ansible_env/src/ansible/lib/ansible/modules/files/file.py
01:11:53 <172.17.70.215> ESTABLISH SSH CONNECTION FOR USER: ec2-user
01:11:53 "item": {
01:11:53 "dest": "/opt/emissary-dist/data",
01:11:53 "src": "/opt/emissary-shared/data"
01:11:53 },
01:11:53 "mode": "0777",
01:11:53 "msg": "chown failed: [Errno 1] Operation not permitted: '/opt/emissary-dist/data'",
01:11:53 "owner": "ec2-user",
01:11:53 "path": "/opt/emissary-dist/data",
01:11:53 "size": 25,
01:11:53 "state": "link",
01:11:53 "uid": 500
0
01:01:44 + ansible --version
01:01:45 ansible 2.5.2 (dx-stable-2.5 88f872f238) last updated 2020/11/24 01:00:48 (GMT -400)
0
This used to work. This code hasn't been changed in years.
Thanks,
Mike