Oh, Thanks, yes that was what I needed.  Actually here is what I did in my 
playbook...

    script: machineId.ps1
    register: result
  - set_fact: machineId={{result.stdout_lines}}



On Tuesday, May 24, 2016 at 1:59:51 PM UTC-5, skinnedknuckles wrote:
>
> 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/c71325eb-4e5d-4301-9365-010a73fd461f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to