list1
- value1
- value2
- debug:
msg: "{{var1}}"
label value1
label value2
- set_fact:
var1: |+
"{{'label ' ~ list1[0]}}"
"{{'label ' ~ list1[1]}}"
- set_fact:
var1:
"{{'label ' ~ list1 | join('\n')}}"
label value1
value2
---
- hosts: localhost
tasks:
- name: set first fact
set_fact:
list1:
- value1
- value2
- name: set second fact
set_fact:
var1: "{{ list1 | map('regex_replace', '^(.*)$','label \\1') | list }} "
- name: print second fact
debug:
var: var1
Whatever works is what counts.
Thanks,
-Mark
--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/ansible-project/lAKvHcdvCrw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
ansible-proje...@googlegroups.com.
To post to this group, send email to
ansible...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/3f8bb125-1b2c-4961-b04c-2cc39e6827d4%40googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.