Hello All,
I am trying to setup ansible script which fetches config file from S3 and stores on remote node in home directory for User. In next task I would like to include_vars from this file but somehow include_vars fails to find file on remote machine as it always looks in
my local machine.
-
hosts: XYZcompute.amazonaws.com
connection: ssh
remote_user: ubuntu
gather_facts: False
vars:
remote_env:
…
roles: -
python
-
uwsgi
tasks: -
shell: echo $HOME
register: USER_HOME
ignore_errors: True -
name: Access file from s3
s3: bucket=MYBUCKET object={{CONFIGURATION_ENV}}.yml dest=~/{{CONFIGURATION_ENV}}.yml mode=get force=true
environment: remote_env
- name: “Loading vars”
include_vars: ‘~/{{CONFIGURATION_ENV}}.yml’
delegate_to: XYZ.compute.amazonaws.com
lets say I am invoking above playbook from user vikram include_vars fails saying
file could not read: /home/vikram/production.yml
but I want ansible to load variables from /home/ubuntu/production.yml
-Vikram