Ansible Convert List to String – techbeatly
www.techbeatly.com › ansible-convert-list-to-stringNov 26, 2021 · --- - name: List to String Conversion hosts: localhost vars: my_list: - "apple" - "mango" - "orange" tasks: - name: Print the List debug: msg: "{{ my_list }}" - name: Concatenate a list to string set_fact: my_string: "{{ my_list | join(',') }}" - name: Print the String debug: msg: "{{ my_string }}" Sample execution $ ansible-playbook site.yml PLAY [List to String Conversion] ***** TASK [Gathering Facts] ***** ok: [localhost] TASK [Print the List] ***** ok: [localhost] => { "msg": [ "apple ...
Data manipulation — Ansible Documentation
docs.ansible.com › ansible › latestDec 21, 2021 · Data manipulation . In many cases, you need to do some complex operation with your variables, while Ansible is not recommended as a data processing/manipulation tool, you can use the existing Jinja2 templating in conjunction with the many added Ansible filters, lookups and tests to do some very complex transformations.