Set variable according to result of another variable?

35 views
Skip to first unread message

John Oliver

unread,
Feb 2, 2015, 2:52:11 PM2/2/15
to ansible...@googlegroups.com
If I:

- name: Copy SSL cert
  copy: src={{ ansible_hostname if ansible_hostname in valid_hosts else ('test') }}.crt
        dest=/etc/pki/tls/certs/
        mode=0644

How can I capture the name of the certificate that was actually copied for action in another task?

Giovanni Tirloni

unread,
Feb 3, 2015, 6:43:03 AM2/3/15
to ansible...@googlegroups.com
register: cert_copy

- debug: var=cert_copy

http://docs.ansible.com/playbooks_variables.html#registered-variables

Giovanni
Reply all
Reply to author
Forward
0 new messages