diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 3123470..916201f 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -3,23 +3,17 @@ hosts: all become: true vars: - dns_container_name: "cloudflare-dns" - dns_image_version: "latest" - dns_volume_config: "/tmp" dns_domains: auth: - scopedToken: ${MOLECULE_CF_TOKEN:-} + scopedToken: "${MOLECULE_CF_TOKEN:-}" domains: - - name: foo.example.com + - name: "${MOLECULE_CF_DOMAIN_NAME:-}" type: A proxied: true create: true - zoneId: ${MOLECULE_CF_ZONEID:-} + zoneId: "${MOLECULE_CF_ZONE_ID:-}" + pre_tasks: - - name: create default directory - file: - path: "{{ swag_data }}/nginx/site-confs" - state: directory - name: Update apt cache. apt: update_cache=yes cache_valid_time=600 when: ansible_os_family == 'Debian' @@ -29,3 +23,7 @@ - requests roles: - role: laurivan.cloudflare_ddns + post_tasks: + - name: Update apt cache. + apt: update_cache=yes cache_valid_time=600 + when: ansible_os_family == 'Debian' diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 291dc02..ea33a15 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -17,6 +17,7 @@ provisioner: name: ansible playbooks: converge: ${MOLECULE_PLAYBOOK:-converge.yml} + cleanup: ../shared/cleanup.yml verifier: name: ansible lint: | diff --git a/molecule/shared/cleanup.yml b/molecule/shared/cleanup.yml new file mode 100644 index 0000000..0565db2 --- /dev/null +++ b/molecule/shared/cleanup.yml @@ -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 \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index 3e1ff5e..4f7a764 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -12,7 +12,7 @@ - configuration - name: Create the Dynamic DNS container - docker_container: + community.docker.docker_container: name: "{{ dns_container_name }}" image: "joshava/cloudflare-ddns:{{ dns_image_version }}" recreate: yes