task using raw module is always skipped with "VARIABLE NOT DEFINED!" error

563 views
Skip to first unread message

Deep18

unread,
Aug 25, 2016, 1:10:43 PM8/25/16
to Ansible Project
I am running winrm from my Mac with ansible:

here is my task thats causes a failure, don't know what variable is being referred here, any help appreciated.

My task file for the playbook with the role:

- name: check if virtualenv exists

  tags: 

    - InstallWiresharkService

    - InstallVirtualEnv

  win_stat: path="C:\\Users\\voiceqa\\venv"

  register: stat_file


- name: debug stat

  tags: InstallWiresharkService

  debug: var=stat_file.stat.exists

  

- name: install virtual environment

  tags: 

    - InstallWiresharkService

    - InstallVirtualEnv

  command: virtualenv C:\Users\voiceqa\venv

  any_errors_fatal: true

  when: not stat_file.stat.exists

  register: out


- debug:  var=out.stderr_lines

  tags: InstallWiresharkService


playbook Run output snippet at error:


ok: [10.203.189.4] => {"changed": false, "invocation": {"module_name": "win_stat"}, "stat": {"exists": false}}

Perform task: TASK: windows : debug stat (y/n/c): y


Perform task: TASK: windows : debug stat (y/n/c): ******************************


TASK [windows : debug stat] ****************************************************

task path: /Users/dnveer/p4_ws/comms/qa/common/python/projects/dlb-ansible-utils/main/dlb-ansible-utils/src/dlb_ansible_utils/playbooks/roles/windows/tasks/main.yml:10

ok: [10.203.189.4] => {

    "stat_file.stat.exists": false

}

Perform task: TASK: windows : install virtual environment (y/n/c): y


Perform task: TASK: windows : install virtual environment (y/n/c): *************


TASK [windows : install virtual environment] ***********************************

task path: /Users/dnveer/p4_ws/comms/qa/common/python/projects/dlb-ansible-utils/main/dlb-ansible-utils/src/dlb_ansible_utils/playbooks/roles/windows/tasks/main.yml:14

skipping: [10.203.189.4] => {"changed": false, "invocation": {"module_args": {"_raw_params": "virtualenv C:\\Users\\voiceqa\\venv"}, "module_name": "raw"}, "skipped": true}

Perform task: TASK: windows : debug (y/n/c): y


Perform task: TASK: windows : debug (y/n/c): ***********************************


TASK [windows : debug] *********************************************************

task path: /Users/dnveer/p4_ws/comms/qa/common/python/projects/dlb-ansible-utils/main/dlb-ansible-utils/src/dlb_ansible_utils/playbooks/roles/windows/tasks/main.yml:23

ok: [10.203.189.4] => {

    "out.stderr_lines": "VARIABLE IS NOT DEFINED!"

}

Perform task ..




Kai Stian Olstad

unread,
Aug 25, 2016, 2:55:39 PM8/25/16
to ansible...@googlegroups.com
On 25. aug. 2016 19:08, Deep18 wrote:
> - name: install virtual environment
> tags:
> - InstallWiresharkService
> - InstallVirtualEnv
> command: virtualenv C:\Users\voiceqa\venv
> any_errors_fatal: true
> when: not stat_file.stat.exists
> register: out
>
> - debug: var=out.stderr_lines
> tags: InstallWiresharkService

stderr_lines does not exist.

Run a
- debug: var=out

and you'll see what is avaialble.
stderr_lines is not one of them, but you will have out.stderr,
out.stdout and out.stdout_lines and some others.

--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages