Scenarios

Add text in multiple line

name: Save Result
  copy:
    dest: "output/playbookresult"
    content: |-
      <div data-gb-custom-block data-tag="for">

      

<div data-gb-custom-block data-tag="if" data-0='playbookresult'>

      {{ '###' }}{{ host }}{{ '###' }}
      {{ hostvars[host]['playbookresult'] }}
      {{ '' }}
      

</div>

      

</div>

  delegate_to: localhost

Matching text in variable

Get length of variable

  • testresult.stdout_lines | length

Checking text in variable and using multiple conditions

Accessing data from outside source using lookup plugin

Using vault as vairable

Creating list of items

Setting default value

  • "{{ ansible_ssh_host|default(ansible_host)|default(inventory_hostname) }}"

Trimming space in each item of a list

  • "{{output.stdlines_out[0] | map('trim') | list }}"

Read Data from file

Set fact based on data type:

Last updated