Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TransIP (transip.nl) as dns provider #177

Merged
merged 1 commit into from
Jul 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Here is an example about [_cluster.yml_](cluster-example.yml) file that contains
|cluster_name |Name of the cluster to be installed |
|public_domain |Root domain that will be used for your cluster. |
|public_ip |Override for public ip entries. defaults to `hostvars['localhost']['ansible_default_ipv4']['address']`. |
|dns_provider |DNS provider, value can be _route53_, _cloudflare_, _gcp_, _azure_ or _none_. Check __Setup public DNS records__ for more info. |
|dns_provider |DNS provider, value can be _route53_, _cloudflare_, _gcp_, _azure_,_transip_ or _none_. Check __Setup public DNS records__ for more info. |
|letsencrypt_account_email |Email address that is used to create LetsEncrypt certs. If _cloudflare_account_email_ is not present for CloudFlare DNS recods, _letsencrypt_account_email_ is also used with CloudFlare DNS account email |
|image_pull_secret|Token to be used to authenticate to the Red Hat image registry. You can download your pull secret from https://cloud.redhat.com/openshift/install/metal/user-provisioned |

Expand Down Expand Up @@ -132,6 +132,7 @@ Please configure in `cluster.yml` all necessary credentials:
|GCP|`gcp_project: project-name `<br/>`gcp_managed_zone_name: 'zone-name'`<br/>`gcp_managed_zone_domain: 'example.com.'`<br/>`gcp_serviceaccount_file: ../gcp_service_account.json` |
|Azure|`azure_client_id: 'client_id'`<br/>`azure_secret: 'key'`<br/>`azure_subscription_id: 'subscription_id'`<br/>`azure_tenant: 'tenant_id'`<br/>`azure_resource_group: 'dns_zone_resource_group'` |
|Hetzner|`hetzner_account_api_token: 93543ade82AA$73.....` <br> `hetzner_zone: domain.tld`|
|TransIP|`transip_token: eyJ0eXAiOiJKV....` <br> `transip_zone: domain.tld`|
|none|With `dns_provider: none` the playbooks will not create public dns entries. (It will skip letsencrypt too) Please create public dns entries if you want to access your cluster.|

### Optional configuration
Expand Down
40 changes: 40 additions & 0 deletions ansible/roles/letsencrypt/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,26 @@
loop: "{{ challenge_data_dns | default({}) | dict2items | subelements('value') }}"
when: le_dns_provider == "azure" and sample_com_challenge is changed

- name: Create DNS record at TransIP
uri:
url: "https://api.transip.nl/v6/domains/{{ transip_zone }}/dns"
method: POST
headers:
Authorization: "Bearer {{ transip_token }}"
body_format: json
body:
dnsEntry:
name: "{{ item.0.key | replace( transip_zone ,'') | regex_replace('\\.$', '') }}"
expire: 60
type: TXT
content: "{{ item.1 }}"
status_code: 201
register: record
loop: "{{ challenge_data_dns | default({}) | dict2items | subelements('value') }}"
when: le_dns_provider == "transip" and sample_com_challenge is changed



- name: DNS record info
debug:
msg: "{{ item.0.key }} TXT {{ item.1 }}"
Expand Down Expand Up @@ -212,6 +232,26 @@
loop: "{{ challenge_data_dns | default({}) | dict2items | subelements('value') }}"
when: le_dns_provider == "azure" and sample_com_challenge is changed


- name: Delete DNS record at TransIP
uri:
url: "https://api.transip.nl/v6/domains/{{ transip_zone }}/dns"
method: DELETE
headers:
Authorization: "Bearer {{ transip_token }}"
body_format: json
body:
dnsEntry:
name: "{{ item.0.key | replace( transip_zone , '') | regex_replace('\\.$', '') }}"
expire: 60
type: TXT
content: "{{ item.1 }}"
status_code: 204
register: record
loop: "{{ challenge_data_dns | default({}) | dict2items | subelements('value') }}"
when: le_dns_provider == "transip" and sample_com_challenge is changed


- name: Include DNS provider
include: "destroy-{{ le_dns_provider }}.yml"
when:
Expand Down
20 changes: 20 additions & 0 deletions ansible/roles/public_dns/tasks/create-transip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
- name: Create DNS record at TransIP
uri:
url: "https://api.transip.nl/v6/domains/{{ transip_zone }}/dns"
method: POST
headers:
Authorization: "Bearer {{ transip_token }}"
body_format: json
body:
dnsEntry:
name: "{{ item }}.{{ cluster_name }}"
expire: 60
type: A
content: "{{ pd_public_ip }}"
status_code: 201
with_items:
- api
- '*.apps'
tags:
- public_dns

20 changes: 20 additions & 0 deletions ansible/roles/public_dns/tasks/destroy-transip.nl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
- name: Create DNS record at TransIP
uri:
url: "https://api.transip.nl/v6/domains/{{ transip_zone }}/dns"
method: DELETE
headers:
Authorization: "Bearer {{ transip_token }}"
body_format: json
body:
dnsEntry:
name: "{{ item }}.{{ cluster_name }}"
expire: 60
type: A
content: "{{ pd_public_ip }}"
status_code: 204
with_items:
- api
- '*.apps'
tags:
- public_dns