I have a trouble with my tasks and can't find solution. Maybe u can help me)
I need to loop this tasks if
- name: Start Check...
block:
- name: Create a new Droplet
community.digitalocean.digital_ocean_droplet:
state: present
oauth_token: "{{oauth_token}}"
name: "{{drop_name}}"
size: s-1vcpu-1gb
region: "{{region}}"
image: "ubuntu-18-04-x64"
wait_timeout: 500
ssh_keys:
project: project01
tags: "{{tag}}"
register: my_droplet
# Retrieve geolocation data of a host's IP address
- name: Get IP geolocation data
ansible.builtin.shell: whois {{ (my_droplet.data.droplet.networks.v4 | selectattr('type', 'equalto', 'public')).0.ip_address | default('<none>', true) }} | grep Country
register: country_info
- set_fact:
country_info_loop: "{{country_info}}"
- name: Delete if not our region
community.digitalocean.digital_ocean_droplet:
state: absent
oauth_token: "{{oauth_token}}"
project: project01
wait_timeout: 500
when: "{{country_info_loop}} != {{region}}"
include_tasks didn't works with loop/until etc. Because loop can't find my variables. And i don't know how i can loop this all (