Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##################
- #### PLAYBOOK ####
- ##################
- ---
- - hosts: localhost
- gather_facts: False
- vars:
- db_instances:
- - { name: "ferrari", dns: "www.ferrari.com" }
- - { name: "yahoo", dns: "www.yahoo.com" }
- - { name: "microsoft", dns: "www.microsoft.com" }
- tasks:
- - name: dig each host
- command: dig +short CNAME {{ item.dns }}
- with_items: "{{ db_instances }}"
- register: db_cnames
- - name: Print cname_record_sets values
- debug:
- var: item.stdout
- loop: '{{db_cnames.results}}'
- - name: template file
- template:
- src: '{{playbook_dir}}/before.txt'
- dest: '{{playbook_dir}}/after.txt'
- ##############
- # before.txt #
- ##############
- {% for item in db_cnames.results %}
- - server: {{ item.stdout }}
- {% endfor %}
- #############
- # after.txt #
- #############
- - server: dkehzmrflhws1.cloudfront.net.
- - server: atsv2-fp.wg1.b.yahoo.com.
- - server: www.microsoft.com-c-3.edgekey.net.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement