Hello everyone, I am new to ansible but I am really enjoying it. I am trying to create a playbook to spin up new droplets (servers) at DigitalOcean. I have the following playbook put together and I need a little help.
My first task "Create new staging droplets" works very well, but I need to create a DNS record for each server that is created and I am not sure how to go about this. I am starting to think that using a "with_items" dictionary isn't the best way to go about this. In the end, I just need to make a call with the digital_ocean_domain module for each server with its newly assigned IP address. Can someone help steer me in the right direction? --- - hosts: 127.0.0.1 connection: local gather_facts: false tasks: - name: "Create new staging droplets" digital_ocean: > state=present command=droplet name={{ item.hostname }} client_id=XXXXXXXXXXXXXXXXXXXXXXXXX api_key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX size_id={{ item.size }} region_id=4 image_id=1505447 private_networking=true wait_timeout=500 unique_name=yes ssh_key_ids=XXXXXXX with_items: - { hostname: 'stage-web01.testsite.com', size: '66'} - { hostname: 'stage-app01.testsite.com', size: '66'} - { hostname: 'stage-db01.testsite.com', size: '66'} register: droplet - name: "Create DNS Entries" digital_ocean_domain: > state=present client_id=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX api_key=XXXXXXXXXXXXXXXXXXXXXXXXXXXX name={{ droplet.name }}.testsite.com ip={{ droplet.ip_address }} I appreciate it, Andrew -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAK_p-gycd7-bFDxXdJLvS-j7ftX0y8WC1U_j5wTxtWm2WOF%2Buw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.