4

I am new to Ansible and a bit stuck.

I have a python script that returns true or false.

I run this python script via ansible task.

I am trying to debug the value returned by running the py script. Additionally I would want to run another task only if the value returned is true.

Ansible Task below:

---
- name: Check XML against XSD
  become: yes
  shell: /usr/bin/python3 check.py
  args:
    chdir: "/var/www/html/det/scripts/"
  register: result
  tags: schema_check

- debug: var =schema_check.stdout
    msg: "Testing..."
    verbosity: 2

And the python script check.py

result = true
print(result)
1

1 Answer 1

3

The issue here is you are registering the output as result, while in the debug task you are calling schema_check, which is the name of the tag.

Furthermore debug can only have either the var or the msg property, not both at the same time.

- debug:
    var: result.stdout

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .