Ansible v1.9.4
I have a playbook that I launch with:
$ ansible-playbook build.yml
build.yml includes set_os.yml (just a set of tasks) that launches some ec2 instances. build.yml looks like this.
- name: Build stuff
hosts: localhost
sudo: False
gather_facts: False
tasks:
- include: set_os.yml
- include: build_soft.yml
In the file set_os.yml, I set the remote user like this:
- set_fact:
ruser: ubuntu
When I include build_soft.yml above (a new play), I want to use that remote user to login and configure the new EC2 instance like so:
---
- name: Configure the EC2 instance
hosts: ec2hosts
gather_facts: true
remote_user: "{{ ruser }}"
tasks:
- do something......
Since "set_fact" definitions are supposed to work between plays (?), I assume it will still be defined, but I always get this error when build_soft.yml executes:
GATHERING FACTS ***************************************************************
<33.34.115.33> ESTABLISH CONNECTION FOR USER: {{ ruser }}
<33.34.115.33> REMOTE_MODULE setup
<33.34.115.33> EXEC ssh -C -tt -vvv -F ../config/sshconfig -o ControlPersist=15m -o ControlPath="/someuser/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o IdentityFile="mykey.pem" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User={{ ruser }} -o ConnectTimeout=10 33.34.115.33 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1448039631.2-14623163715246 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1448039631.2-14623163715246 && echo $HOME/.ansible/tmp/ansible-tmp-1448039631.2-14623163715246'
fatal: [33.34.115.33] => SSH Error: command-line line 0: garbage at end of line; "ruser".
Any ideas?
-J