diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 904ab9b..4fec8aa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -89,7 +89,6 @@ jobs: webserver: '${{ env.WEBSERVER }}' container: '${{ env.CONTAINER }}' dns: '${{ env.DNS }}' - dns_cloudflare_email: '${{ secrets.CLOUDFLARE_EMAIL }}' dns_cloudflare_apitoken: '${{ secrets.CLOUDFLARE_TOKEN }}' rolename: '${{ env.ROLE_NAME }}' - name: Remove Hetzner server diff --git a/README.md b/README.md index d3c7218..eb2fc5c 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,15 @@ all: ## Configuration -Make sure to provide the email and API token for Cloudflare via StackHead CLI configuration file: +Make sure to provide the API token for Cloudflare via StackHead CLI configuration file. + +You can generate an API token [in your Cloudflare profile](https://dash.cloudflare.com/profile/api-tokens). +Make sure to grant `write` permissions to DNS on Zone level. ```yaml config: deployment: getstackhead.stackhead_dns_cloudflare: - cloudflare_email: my@email.address cloudflare_api_token: MY-API-TOKEN ``` @@ -45,7 +47,6 @@ or Ansible inventory: ```yaml stackhead__config_deployment: getstackhead.stackhead_dns_cloudflare: - cloudflare_email: my@email.address cloudflare_api_token: MY-API-TOKEN ``` diff --git a/tasks/steps/deploy.yml b/tasks/steps/deploy.yml index c55d6f9..4be939a 100644 --- a/tasks/steps/deploy.yml +++ b/tasks/steps/deploy.yml @@ -3,7 +3,6 @@ - name: Check Cloudflare credentials assert: that: - - module.config.cloudflare_email|d("") != "" - module.config.cloudflare_api_token|d("") != "" - name: "Create A record for domain {{ item.domain }}" cloudflare_dns: @@ -11,8 +10,7 @@ record: "{{ item.domain|getstackhead.stackhead.subdomain|d('@', true) }}" type: A value: "{{ ansible_ssh_host }}" - account_email: "{{ module.config.cloudflare_email }}" - account_api_token: "{{ module.config.cloudflare_api_token }}" + api_token: "{{ module.config.cloudflare_api_token }}" proxied: no solo: yes state: present diff --git a/tasks/steps/destroy.yml b/tasks/steps/destroy.yml index b97e67c..522dadc 100644 --- a/tasks/steps/destroy.yml +++ b/tasks/steps/destroy.yml @@ -3,7 +3,6 @@ - name: Check Cloudflare credentials assert: that: - - module.config.cloudflare_email|d("") != "" - module.config.cloudflare_api_token|d("") != "" - name: "Remove A record for domain {{ item.domain }}" cloudflare_dns: @@ -11,8 +10,7 @@ record: "{{ item.domain|getstackhead.stackhead.subdomain|d('@', true) }}" type: A value: "{{ ansible_ssh_host }}" - account_email: "{{ module.config.cloudflare_email }}" - account_api_token: "{{ module.config.cloudflare_api_token }}" + api_token: "{{ module.config.cloudflare_api_token }}" state: absent when: item.dns.provider|d('') == 'cloudflare' with_items: "{{ app_config.domains }}" # item.domain