Register Ansible variable property

Question:

Using Ansible I’m having a problem registering a variable the way I want. Using the implementation below I will always have to call .stdout on the variable – is there a way I can do better?

My playbook:
Note the unwanted use of .stdout – I just want to be able to use the variable directly without calling a propery…?

The output when I execute the playbook:

Any help or insights appreciated – thank you 🙂

Answer:

If I understood it right you want to assign deploy_dir.stdout to a variable that you can use without stdout key. It can be done with set_fact module:

Leave a Reply