Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

Commit

Permalink
fix: drop cloudflare email
Browse files Browse the repository at this point in the history
  • Loading branch information
saitho committed Mar 10, 2021
1 parent d693f6f commit 75db92f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: [email protected]
cloudflare_api_token: MY-API-TOKEN
```
Expand All @@ -45,7 +47,6 @@ or Ansible inventory:
```yaml
stackhead__config_deployment:
getstackhead.stackhead_dns_cloudflare:
cloudflare_email: [email protected]
cloudflare_api_token: MY-API-TOKEN
```
Expand Down
4 changes: 1 addition & 3 deletions tasks/steps/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
- 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:
zone: "{{ item.domain|getstackhead.stackhead.domain }}"
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
Expand Down
4 changes: 1 addition & 3 deletions tasks/steps/destroy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
- 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:
zone: "{{ item.domain|getstackhead.stackhead.domain }}"
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

0 comments on commit 75db92f

Please sign in to comment.