after spending hrs on this and that, looks like its a bug somewhere in
2.1.1.0
I have updated to 2.2 devel and its is now passing the parameters correctly.
Regards
James H
On Friday, 5 August 2016 22:32:28 UTC+10, James Hong wrote:
>
> Hi Everyone
>
> I've just updated my Ansible to 2.1.1.0 to see if problem I had would go
> away, but now I face different problem
>
> I am trying to pass a variable to "included" playbooks and it does not
> seems to be passing it.
>
> - name: ec2 launch web server
> include: ec2_launch.yml
> vars:
> environment_name: "fullweb01"
> ami_name: "Windows_Server-2012-R2_RTM-English-64Bit-Base*"
> dns_name: "fullweb01.inator.com.au"
> vpc_subnet_id: "subnet-2b8c344e"
> - name: debug
> hosts: "local"
> connection: local
> tasks:
> - debug: msg="{{(instance_password.results|first).win_password}}"
> - set_fact:
> target_ip: "{{(ec2.instances | first).private_ip}}"
> target_password:
> "{{(instance_password.results|first).win_password}}"
> - debug: msg="{{target_ip}}"
> - debug: msg="{{target_password}}"
> - name: rename windows host - web server
> include: windows_rename_host.yml
> vars:
> host_name: "fullweb01"
> host_password: "{{target_password}}"
> target: "fullweb01"
> host_ip: "{{target_ip}}"
>
>
> get error
>
> "msg" : the field 'args' has an invalid value, which appears to include a
> variable that is undefined. The error was: {{target_password}}:
> 'target_password' is undefined.
>
> *- debug: msg="{{target_password}}"* is showing valid password, but
> playbook windows_rename_host.yml is erroring out.
>
> Im running this on python 2.6.10, pywinrm 0.2.0
>
> *same playbook is working on python 2.6.7, ansible 2.1.0.0*
>
> Is this a bug on 2.1.1.0 ?
>
> Thanks
> James H
>
> ===windows_rename_host.yml===
>
> - name: rename host
> hosts: "{{target}}"
> gather_facts: False
> tasks:
> - set_fact:
> ansible_port: 5986
> ansible_connection: winrm
> ansible_user: Administrator
> ansible_winrm_server_cert_validation: ignore
> ansible_host: "{{host_ip}}"
> ansible_password: "{{host_password}}"
> - name: rename host
> raw: Rename-Computer -NewName "{{host_name}}"
> - name: Restart machine
> raw: sleep 10;Restart-Computer -Force
> - name: Waiting for server to come back
> local_action: wait_for
> host={{ ansible_play_hosts|first }}
> state=started
> delay=60
> timeout=60
> with_items: "{{ansible_play_hosts|first}}"
>
>
> ======error========
>
> task path:
> /Users/username/ansible/ansible-full-deploy/windows_rename_host.yml:5
> fatal: [fullweb01]: FAILED! => {"failed": true, "msg": "the field 'args' has
> an invalid value, which appears to include a variable that is undefined. The
> error was: {{target_password}}: 'target_password' is undefined\n\nThe error
> appears to have been in
> '/Users/username/ansible/ansible-full-deploy/windows_rename_host.yml': line
> 5, column 5, but may\nbe elsewhere in the file depending on the exact syntax
> problem.\n\nThe offending line appears to be:\n\n tasks:\n - set_fact:\n
> ^ here\n"}
>
>
--
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/435b9956-d575-4824-b290-5ffe9532cc38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.