Hello
As a part of another project, I have written a playbook:
---
- hosts: localhost
vars:
tdict:
zones:
- example.com
- example.org
- example.net
soafields:
- nameserver
- admin
- serial
- refresh
- retry
- expire
- ttl
soarecords_dict:
tasks:
- name: read soa record into dict
set_fact:
tdict: "{{ tdict | combine( {item :
lookup('dig',item,'qtype=SOA')|split } )}}"
loop:
"{{ zones }}"
- debug:
msg: "{{ tdict.keys() | list }}"
- set_fact:
soarecords_dict: "{{ soarecords_dict | combine ({item :
dict(soafields| zip(tdict[item]))}) }}"
loop:
"{{ tdict.keys() |list }}"
- name: output soa records
debug:
var: soarecords_dict
this works, but if possible, I want to get rid of temporary tdict part,
meaning that I will set soarecords_dict variable directly from oneliner.
doable?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/c55933e7-c2ea-4a71-a901-1e041764b41en%40googlegroups.com.