Control Node:
- CentOS 7
- Ansible 2.1
Remote Node:
- Windows 7
- Powershell 3
I'm running a powershell script (from my playbook) that returns a number
via stdout. How do I assign the result (*6999*) to my playbook variable
named machineId?
Here's my playbook...
---
- name: deploy
hosts: windows
vars:
machineId: none
tasks:
- name: get machine id
script: machineId.ps1
register: out
- debug: var=out
Here's what I get when I run the play book...
*[ansmgr@dhcp1-60-20 playbooks]$ ansible-playbook deploy.ymlPLAY [deploy
new software version] *********************************************TASK
[setup]
*******************************************************************ok:
[ADS-6999]TASK [get machine id]
**********************************************************changed:
[ADS-6999]TASK [debug]
*******************************************************************ok:
[ADS-6999] => { "out": { "changed": true, "rc": 0,
"stderr": "", "stdout": "6999\n", "stdout_lines":
[ "6999" ] }}PLAY RECAP
*********************************************************************ADS-6999
: ok=3 changed=1 unreachable=0 failed=0 *
--
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/3868b415-e116-4ac4-8e46-4cfc887cb30b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.