The end-goal is to get the variables loaded into your ansible run. How
about separating out your task into two distinct activities:
1. Fetching the file from S3 *on the machine where you are doing the
ansible run*, and loading variables from it
2. Uploading a copy of the file to the remote host's home directory as
well (if that is part of your requirements)
Just my two cents.
On Tuesday, 28 October 2014 00:40:09 UTC-5, vikram patil wrote:
>
> 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
>
>
>
>
>
>
>
>
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/317426fe-72da-42eb-80ea-2fdb19e1641c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.