I need to generate TSIG keys for use by nsupdate. dnssec-keygen creates two 
files after run:

- name: generate TSIG keys
  command: "dnssec-keygen -r /dev/urandom -a HMAC-MD5 -b 512 -n HOST 
{{item.name}}"
  args:
    chdir: '{{ bind_base_zones_path }}/tsig/{{item.name}}/'
  with_items: '{{bind_config_master_zones}}'

I need to copy the generated key in one of the files and insert it into a 
new file (named.conf.local):

- name: populate TSIG key config
  command: "grep Key {{ bind_base_zones_path 
}}/tsig/{{item.name}}/K{{item.name}}.*.private | awk '{print $2}'"
  register: 'key-{{ item.name }}'
  with_items: '{{bind_config_master_zones}}'

My problem is that the grep returns "No such file or directory" even though 
a grep locally on the system returns the key. I suspect an issue with the 
regex. The other issue is with the dynamic nature of the variables.

How can I extract the key from the files generated and copy them into the 
config file?



-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e86281fa-4436-45ef-bd56-61e37d34b05b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to