<https://stackoverflow.com/posts/75256471/timeline>
I have a trouble with my tasks and can't find solution. Maybe u can help
me) I need to loop this tasks if
*"{{country_info_loop}} != {{region}}"*
but if
*"{{country_info_loop}} == {{region}}"*
then stop it.
*- **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:*
* - "{{ ssh_public_key.data.ssh_key.id }}"*
* 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}}"*
* id: "{{ my_droplet.data.droplet.id }}"*
* 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 (
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/6c8f237b-2657-471c-84af-fa0484db8bf1n%40googlegroups.com.