Add custom cleanup.

This commit is contained in:
Laur Ivan 2022-08-26 01:20:32 +02:00
parent 9239f0a83b
commit c1e8693547
4 changed files with 20 additions and 11 deletions

View File

@ -3,23 +3,17 @@
hosts: all hosts: all
become: true become: true
vars: vars:
dns_container_name: "cloudflare-dns"
dns_image_version: "latest"
dns_volume_config: "/tmp"
dns_domains: dns_domains:
auth: auth:
scopedToken: ${MOLECULE_CF_TOKEN:-} scopedToken: "${MOLECULE_CF_TOKEN:-}"
domains: domains:
- name: foo.example.com - name: "${MOLECULE_CF_DOMAIN_NAME:-}"
type: A type: A
proxied: true proxied: true
create: true create: true
zoneId: ${MOLECULE_CF_ZONEID:-} zoneId: "${MOLECULE_CF_ZONE_ID:-}"
pre_tasks: pre_tasks:
- name: create default directory
file:
path: "{{ swag_data }}/nginx/site-confs"
state: directory
- name: Update apt cache. - name: Update apt cache.
apt: update_cache=yes cache_valid_time=600 apt: update_cache=yes cache_valid_time=600
when: ansible_os_family == 'Debian' when: ansible_os_family == 'Debian'
@ -29,3 +23,7 @@
- requests - requests
roles: roles:
- role: laurivan.cloudflare_ddns - role: laurivan.cloudflare_ddns
post_tasks:
- name: Update apt cache.
apt: update_cache=yes cache_valid_time=600
when: ansible_os_family == 'Debian'

View File

@ -17,6 +17,7 @@ provisioner:
name: ansible name: ansible
playbooks: playbooks:
converge: ${MOLECULE_PLAYBOOK:-converge.yml} converge: ${MOLECULE_PLAYBOOK:-converge.yml}
cleanup: ../shared/cleanup.yml
verifier: verifier:
name: ansible name: ansible
lint: | lint: |

View File

@ -0,0 +1,10 @@
---
- name: Destroy created docker image
hosts: localhost
connection: local
gather_facts: false
tasks:
- name: "destroy the docker container"
community.docker.docker_container:
name: "cloudflare-dns"
state: absent

View File

@ -12,7 +12,7 @@
- configuration - configuration
- name: Create the Dynamic DNS container - name: Create the Dynamic DNS container
docker_container: community.docker.docker_container:
name: "{{ dns_container_name }}" name: "{{ dns_container_name }}"
image: "joshava/cloudflare-ddns:{{ dns_image_version }}" image: "joshava/cloudflare-ddns:{{ dns_image_version }}"
recreate: yes recreate: yes