Add task to fail if full_domain already exists
This commit is contained in:
parent
ebe6a3cbd7
commit
8fbbbbdd7f
@ -6,6 +6,16 @@
|
||||
- vars/k8s-vars.yml
|
||||
|
||||
tasks:
|
||||
- name: Check if domain exists
|
||||
community.digitalocean.digital_ocean_domain_facts:
|
||||
oauth_token: "{{ do_api_token }}"
|
||||
register: existing_domains
|
||||
|
||||
- name: Fail if domain already exists
|
||||
fail:
|
||||
msg: "Domain {{ full_domain }} already exists."
|
||||
when: full_domain in existing_domains.data | map(attribute='name') | list
|
||||
|
||||
- name: Create a domain
|
||||
community.digitalocean.digital_ocean_domain:
|
||||
state: present
|
||||
|
Loading…
Reference in New Issue
Block a user