Ansible Filter Casting: Difference between revisions
Jump to navigation
Jump to search
(Created page with "=External= * https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#forcing-the-data-type =Internal= * Ansible Concepts * Ans...") |
|||
Line 7: | Line 7: | ||
=Overview= | =Overview= | ||
<font color=darkgray>TODO https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#forcing-the-data-type</font> | <font color=darkgray>TODO https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#forcing-the-data-type</font> | ||
=Use Cases= | |||
====Set As Boolean whether an Installation Happened of Not==== | |||
<code>brew_install_result</code> is a variable registered by a Homebrew module and it has a <code>brew_install_result.changed</code> field that is set by the module execution. The value is "true" or "false". The code below cast that value to Boolean: | |||
<syntaxhighlight lang='yaml'> | |||
- name: Setting Update Fact | |||
set_fact: | |||
brew_formula_or_cask_updated: "{{ brew_install_result.changed | bool}}" | |||
</syntaxhighlight> |
Latest revision as of 19:28, 5 July 2021
External
Internal
Overview
TODO https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#forcing-the-data-type
Use Cases
Set As Boolean whether an Installation Happened of Not
brew_install_result
is a variable registered by a Homebrew module and it has a brew_install_result.changed
field that is set by the module execution. The value is "true" or "false". The code below cast that value to Boolean:
- name: Setting Update Fact
set_fact:
brew_formula_or_cask_updated: "{{ brew_install_result.changed | bool}}"