Skip to content

Commit d544eb7

Browse files
authored
Rename poorly-named DNS variables (#61)
* Rename poorly-named DNS variables The naming of the variables that describe the DNS zone to which we're adding records (dns_tld_external), the name of the domain part of the FQDN (cluster_vars.dns_zone_external), and the name of the domain part of the cloud-internal FQDN (dns_zone_internal) is very poor, and leads to misunderstandings. dns_tld_external --> cluster_vars.dns_nameserver_zone dns_zone_internal --> cluster_vars.dns_cloud_internal_domain dns_zone_external --> cluster_vars.dns_user_domain * Update fields in line with review comments
1 parent 59a0a48 commit d544eb7

File tree

13 files changed

+76
-59
lines changed

13 files changed

+76
-59
lines changed

EXAMPLE/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ ansible-playbook -u <username> --private-key=/home/<user>/.ssh/<rsa key> cluster
6666
+ `-e app_name=<nginx>` - Normally defined in `group_vars/<clusterid>/cluster_vars.yml`. The name of the application cluster (e.g. 'couchbase', 'nginx'); becomes part of cluster_name
6767
+ `-e app_class=<proxy>` - Normally defined in `group_vars/<clusterid>/cluster_vars.yml`. The class of application (e.g. 'database', 'webserver'); becomes part of the fqdn
6868
+ `-e release_version=<v1.0.1>` - Identifies the application version that is being deployed.
69-
+ `-e dns_tld_external=<test.example.com>` - Normally defined in `group_vars/<clusterid>/cluster_vars.yml`.
7069
+ `-e clean=[current|retiring|redeployfail|_all_]` - Deletes VMs in `lifecycle_state`, or `_all_`, as well as networking and security groups
7170
+ `-e do_package_upgrade=true` - Upgrade the OS packages (not good for determinism)
7271
+ `-e reboot_on_package_upgrade=true` - After updating packages, performs a reboot on all nodes.

EXAMPLE/group_vars/_skel/cluster_vars.yml

+17-15
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ gcp_credentials_json: "{{ lookup('file', gcp_credentials_file) | default({'proje
77
app_name: "test" # The name of the application cluster (e.g. 'couchbase', 'nginx'); becomes part of cluster_name.
88
app_class: "test" # The class of application (e.g. 'database', 'webserver'); becomes part of the fqdn
99

10-
dns_tld_external: "" # Top-level domain for external access. gcloud dns needs a trailing '.'. Leave blank if no external DNS (use IPs only)
11-
1210
beats_target_hosts: [] # The destination hosts for e.g. filebeat/ metricbeat logs
1311

1412
## Vulnerability scanners - Tenable and/ or Qualys cloud agents:
@@ -42,14 +40,15 @@ cluster_name: "{{app_name}}-{{buildenv}}" # Identifies the cluster within
4240
#cluster_vars:
4341
# type: &cloud_type "aws"
4442
# image: "ami-0964eb2dc8b836eb6" # eu-west-1, 18.04, amd64, hvm-ssd, 20200430. Ubuntu images can be located at https://cloud-images.ubuntu.com/locator/
45-
# region: &region "eu-west-1"
46-
# dns_zone_internal: "{{_region}}.compute.internal" # eu-west-1, us-west-2
47-
# dns_zone_external: "{%- if dns_tld_external -%}{{_cloud_type}}-{{_region}}.{{app_class}}.{{buildenv}}.{{dns_tld_external}} {%- endif -%}"
43+
# region: &region "eu-west-1" # eu-west-1, us-west-2
44+
# dns_cloud_internal_domain: "{{_region}}.compute.internal" # The cloud-internal zone as defined by the cloud provider (e.g. GCP, AWS)
45+
# dns_nameserver_zone: &dns_nameserver_zone "" # The zone that dns_server will operate on. gcloud dns needs a trailing '.'. Leave blank if no external DNS (use IPs only)
46+
# dns_user_domain: "{%- if _dns_nameserver_zone -%}MY.OTHER.PREFIXES.{{_dns_nameserver_zone}}{%- endif -%}" # A user-defined _domain_ part of the FDQN, (if more prefixes are required before the dns_nameserver_zone)
4847
# dns_server: "" # Specify DNS server. nsupdate, route53 or clouddns. If empty string is specified, no DNS will be added.
48+
# route53_private_zone: true # Only used when cluster_vars.type == 'aws'. Defaults to true if not set.
4949
# assign_public_ip: "yes"
5050
# inventory_ip: "public" # 'public' or 'private', (private in case we're operating in a private LAN). If public, 'assign_public_ip' must be 'yes'
5151
# instance_profile_name: ""
52-
# route53_private_zone: true # Only used when cluster_vars.type == 'aws'. Defaults to true if not set.
5352
# custom_tagslabels: {inv_resident_id: "abc", inv_proposition_id: "def"}
5453
# secgroups_existing: []
5554
# secgroup_new:
@@ -67,12 +66,13 @@ cluster_name: "{{app_name}}-{{buildenv}}" # Identifies the cluster within
6766
# sandbox:
6867
# hosttype_vars:
6968
# sys: {vms_by_az: {a: 1, b: 1, c: 1}, flavor: t3a.nano, version: "{{sys_version | default('')}}", auto_volumes: []}
70-
# #sysnobeats: {vms_by_az: {a: 1, b: 1, c: 1}, skip_beat_install:true, flavor: t3a.nano, version: "{{sysnobeats_version | default('')}}", auto_volumes: []
71-
# #sysdisks: {vms_by_az: {a: 1, b: 1, c: 1}, flavor: t3a.nano, version: "{{sysdisks_version | default('')}}", auto_volumes: [{"device_name": "/dev/sdb", mountpoint: "/var/log/mysvc", fstype: "ext4", "volume_type": "gp2", "volume_size": 2, ephemeral: False, encrypted: True, "delete_on_termination": true, perms: {owner: "root", group: "sudo", mode: "775"} }, {"device_name": "/dev/sdc", mountpoint: "/var/log/mysvc2", fstype: "ext4", "volume_type": "gp2", "volume_size": 2, ephemeral: False, encrypted: True, "delete_on_termination": true}, {"device_name": "/dev/sdd", mountpoint: "/var/log/mysvc3", fstype: "ext4", "volume_type": "gp2", "volume_size": 2, ephemeral: False, encrypted: True, "delete_on_termination": true}]}
72-
# #hostnvme_multi: {vms_by_az: {a: 1, b: 1, c: 1}, flavor: i3en.2xlarge, auto_volumes: [], nvme: {volumes: [{mountpoint: "/var/log/mysvc", fstype: ext4, volume_size: 2500}, {mountpoint: "/var/log/mysvc2", fstype: ext4, volume_size: 2500}]} } }
73-
# #hostnvme_lvm: {vms_by_az: {a: 1, b: 1, c: 1}, flavor: i3en.2xlarge, auto_volumes: [], nvme: {volumes: [{mountpoint: "/var/log/mysvc", fstype: ext4, volume_size: 2500}, {mountpoint: "/var/log/mysvc", fstype: ext4, volume_size: 2500}], lvmparams: {vg_name: "vg0", lv_name: "lv0", lv_size: "+100%FREE"} } }
74-
# #hostssd: {vms_by_az: {a: 1, b: 1, c: 0}, flavor: c3.large, auto_volumes: [{device_name: "/dev/sdb", mountpoint: "/var/log/mysvc", fstype: "ext4", "volume_type": "gp2", "volume_size": 2, ephemeral: False, encrypted: True, "delete_on_termination": true}]}
75-
# #hosthdd: {vms_by_az: {a: 1, b: 1, c: 0}, flavor: h1.2xlarge, auto_volumes: [{device_name: "/dev/sdb", mountpoint: "/var/log/mysvc", fstype: "ext4", "volume_type": "gp2", "volume_size": 2, ephemeral: False, encrypted: True, "delete_on_termination": true}]}
69+
# # sysnobeats: {vms_by_az: {a: 1, b: 0, c: 0}, skip_beat_install:true, flavor: t3a.nano, version: "{{sysnobeats_version | default('')}}", auto_volumes: []
70+
# # sysdisks: {vms_by_az: {a: 1, b: 0, c: 0}, flavor: t3a.nano, version: "{{sysdisks_version | default('')}}", auto_volumes: [{"device_name": "/dev/sdb", mountpoint: "/var/log/mysvc", fstype: "ext4", "volume_type": "gp2", "volume_size": 2, ephemeral: False, encrypted: True, "delete_on_termination": true, perms: {owner: "root", group: "sudo", mode: "775"} }, {"device_name": "/dev/sdc", mountpoint: "/var/log/mysvc2", fstype: "ext4", "volume_type": "gp2", "volume_size": 3, ephemeral: False, encrypted: True, "delete_on_termination": true}, {"device_name": "/dev/sdd", mountpoint: "/var/log/mysvc3", fstype: "ext4", "volume_type": "gp2", "volume_size": 2, ephemeral: False, encrypted: True, "delete_on_termination": true}]}
71+
# # sysdisks_snapshot: {vms_by_az: {a: 1, b: 1, c: 0}, flavor: t3a.nano, auto_volumes: [{"snapshot_tags": {"tag:backup_id": "57180566894481854905"}, "device_name": "/dev/sdb", mountpoint: "/data", fstype: "ext4", "volume_type": "gp2", "volume_size": 2, ephemeral: False, encrypted: True, "delete_on_termination": true }]}
72+
# # hostnvme_multi: {vms_by_az: {a: 1, b: 0, c: 0}, flavor: i3en.2xlarge, auto_volumes: [], nvme: {volumes: [{mountpoint: "/var/log/mysvc", fstype: ext4, volume_size: 2500}, {mountpoint: "/var/log/mysvc2", fstype: ext4, volume_size: 2500}]} }
73+
# # hostnvme_lvm: {vms_by_az: {a: 1, b: 0, c: 0}, flavor: i3en.2xlarge, auto_volumes: [], nvme: {volumes: [{mountpoint: "/var/log/mysvc", fstype: ext4, volume_size: 2500}, {mountpoint: "/var/log/mysvc", fstype: ext4, volume_size: 2500}], lvmparams: {vg_name: "vg0", lv_name: "lv0", lv_size: "+100%FREE"} } }
74+
# # hostssd: {vms_by_az: {a: 1, b: 0, c: 0}, flavor: c3.large, auto_volumes: [{device_name: "/dev/sdb", mountpoint: "/var/log/mysvc", fstype: "ext4", "volume_type": "gp2", "volume_size": 2, ephemeral: False, encrypted: True, "delete_on_termination": true}]}
75+
# # hosthdd: {vms_by_az: {a: 1, b: 0, c: 0}, flavor: h1.2xlarge, auto_volumes: [{device_name: "/dev/sdb", mountpoint: "/var/log/mysvc", fstype: "ext4", "volume_type": "gp2", "volume_size": 2, ephemeral: False, encrypted: True, "delete_on_termination": true}]}
7676
# aws_access_key: ""
7777
# aws_secret_key: ""
7878
# vpc_name: "test{{buildenv}}"
@@ -81,15 +81,16 @@ cluster_name: "{{app_name}}-{{buildenv}}" # Identifies the cluster within
8181
# termination_protection: "no"
8282
#_cloud_type: *cloud_type
8383
#_region: *region
84-
84+
#_dns_nameserver_zone: *dns_nameserver_zone
8585

8686
### GCP example
8787
#cluster_vars:
8888
# type: &cloud_type "gcp"
8989
# image: "projects/ubuntu-os-cloud/global/images/ubuntu-1804-bionic-v20200430"
9090
# region: &region "europe-west1"
91-
# dns_zone_internal: "c.{{gcp_credentials_json.project_id}}.internal"
92-
# dns_zone_external: "{%- if dns_tld_external -%}{{_cloud_type}}-{{_region}}.{{app_class}}.{{buildenv}}.{{dns_tld_external}} {%- endif -%}"
91+
# dns_cloud_internal_domain: "c.{{gcp_credentials_json.project_id}}.internal" # The cloud-internal zone as defined by the cloud provider (e.g. GCP, AWS)
92+
# dns_nameserver_zone: &dns_nameserver_zone "" # The zone that dns_server will operate on. gcloud dns needs a trailing '.'. Leave blank if no external DNS (use IPs only)
93+
# dns_user_domain: "{%- if _dns_nameserver_zone -%}MY.OTHER.PREFIXES.{{_dns_nameserver_zone}}{%- endif -%}" # A user-defined _domain_ part of the FDQN, (if more prefixes are required before the dns_nameserver_zone)
9394
# dns_server: "" # Specify DNS server. nsupdate, route53 or clouddns. If empty string is specified, no DNS will be added.
9495
# assign_public_ip: "yes"
9596
# inventory_ip: "public" # 'public' or 'private', (private in case we're operating in a private LAN). If public, 'assign_public_ip' must be 'yes'
@@ -122,3 +123,4 @@ cluster_name: "{{app_name}}-{{buildenv}}" # Identifies the cluster within
122123
#_cloud_type: *cloud_type
123124
#_region: *region
124125
#_ssh_guard_whitelist: *ssh_guard_whitelist
126+
#_dns_nameserver_zone: *dns_nameserver_zone

EXAMPLE/group_vars/test_aws_euw1/cluster_vars.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
---
22

3+
redeploy_scheme: _scheme_addallnew_rmdisk_rollback
4+
#redeploy_scheme: _scheme_addnewvm_rmdisk_rollback
5+
#redeploy_scheme: _scheme_rmvm_rmdisks_only
6+
37
app_name: "test" # The name of the application cluster (e.g. 'couchbase', 'nginx'); becomes part of cluster_name.
48
app_class: "test" # The class of application (e.g. 'database', 'webserver'); becomes part of the fqdn
59

6-
dns_tld_external: "" # Top-level domain for external access. gcloud dns needs a trailing '.'. Leave blank if no external DNS (use IPs only)
10+
beats_target_hosts: [] # The destination hosts for e.g. filebeat/ metricbeat logs
711

812
## Vulnerability scanners - Tenable and/ or Qualys cloud agents:
913
cloud_agent:
@@ -35,14 +39,15 @@ cluster_name: "{{app_name}}-{{buildenv}}" # Identifies the cluster within
3539
cluster_vars:
3640
type: &cloud_type "aws"
3741
image: "ami-0964eb2dc8b836eb6" # eu-west-1, 18.04, amd64, hvm-ssd, 20200430. Ubuntu images can be located at https://cloud-images.ubuntu.com/locator/
38-
region: &region "eu-west-1"
39-
dns_zone_internal: "{{_region}}.compute.internal" # eu-west-1, us-west-2
40-
dns_zone_external: "{%- if dns_tld_external -%}{{_cloud_type}}-{{_region}}.{{app_class}}.{{buildenv}}.{{dns_tld_external}} {%- endif -%}"
42+
region: &region "eu-west-1" # eu-west-1, us-west-2
43+
dns_cloud_internal_domain: "{{_region}}.compute.internal" # The cloud-internal zone as defined by the cloud provider (e.g. GCP, AWS)
44+
dns_nameserver_zone: &dns_nameserver_zone "" # The zone that dns_server will operate on. gcloud dns needs a trailing '.'. Leave blank if no external DNS (use IPs only)
45+
dns_user_domain: "{%- if _dns_nameserver_zone -%}{{_cloud_type}}-{{_region}}.{{app_class}}.{{buildenv}}.{{_dns_nameserver_zone}}{%- endif -%}" # A user-defined _domain_ part of the FDQN, (if more prefixes are required before the dns_nameserver_zone)
4146
dns_server: "" # Specify DNS server. nsupdate, route53 or clouddns. If empty string is specified, no DNS will be added.
47+
route53_private_zone: true # Only used when cluster_vars.type == 'aws'. Defaults to true if not set.
4248
assign_public_ip: "yes"
4349
inventory_ip: "public" # 'public' or 'private', (private in case we're operating in a private LAN). If public, 'assign_public_ip' must be 'yes'
4450
instance_profile_name: ""
45-
route53_private_zone: true # Only used when cluster_vars.type == 'aws'. Defaults to true if not set.
4651
custom_tagslabels:
4752
inv_resident_id: "myresident"
4853
inv_proposition_id: "myproposition"
@@ -68,6 +73,7 @@ cluster_vars:
6873
hosttype_vars:
6974
sys: {vms_by_az: {a: 1, b: 1, c: 1}, flavor: t3a.nano, version: "{{sys_version | default('')}}", auto_volumes: []}
7075
# sysdisks: {vms_by_az: {a: 1, b: 0, c: 0}, flavor: t3a.nano, version: "{{sysdisks_version | default('')}}", auto_volumes: [{"device_name": "/dev/sdb", mountpoint: "/var/log/mysvc", fstype: "ext4", "volume_type": "gp2", "volume_size": 2, ephemeral: False, encrypted: True, "delete_on_termination": true, perms: {owner: "root", group: "sudo", mode: "775"} }, {"device_name": "/dev/sdc", mountpoint: "/var/log/mysvc2", fstype: "ext4", "volume_type": "gp2", "volume_size": 3, ephemeral: False, encrypted: True, "delete_on_termination": true}, {"device_name": "/dev/sdd", mountpoint: "/var/log/mysvc3", fstype: "ext4", "volume_type": "gp2", "volume_size": 2, ephemeral: False, encrypted: True, "delete_on_termination": true}]}
76+
# sysdisks_snapshot: {vms_by_az: {a: 1, b: 1, c: 0}, flavor: t3a.nano, auto_volumes: [{"snapshot_tags": {"tag:backup_id": "57180566894481854905"}, "device_name": "/dev/sdb", mountpoint: "/data", fstype: "ext4", "volume_type": "gp2", "volume_size": 2, ephemeral: False, encrypted: True, "delete_on_termination": true }]}
7177
# hostnvme_multi: {vms_by_az: {a: 1, b: 0, c: 0}, flavor: i3en.2xlarge, auto_volumes: [], nvme: {volumes: [{mountpoint: "/var/log/mysvc", fstype: ext4, volume_size: 2500}, {mountpoint: "/var/log/mysvc2", fstype: ext4, volume_size: 2500}]} }
7278
# hostnvme_lvm: {vms_by_az: {a: 1, b: 0, c: 0}, flavor: i3en.2xlarge, auto_volumes: [], nvme: {volumes: [{mountpoint: "/var/log/mysvc", fstype: ext4, volume_size: 2500}, {mountpoint: "/var/log/mysvc", fstype: ext4, volume_size: 2500}], lvmparams: {vg_name: "vg0", lv_name: "lv0", lv_size: "+100%FREE"} } }
7379
# hostssd: {vms_by_az: {a: 1, b: 0, c: 0}, flavor: c3.large, auto_volumes: [{device_name: "/dev/sdb", mountpoint: "/var/log/mysvc", fstype: "ext4", "volume_type": "gp2", "volume_size": 2, ephemeral: False, encrypted: True, "delete_on_termination": true}]}
@@ -80,3 +86,4 @@ cluster_vars:
8086
termination_protection: "no"
8187
_cloud_type: *cloud_type
8288
_region: *region
89+
_dns_nameserver_zone: *dns_nameserver_zone
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
---
1+
---
2+
3+
sys_version: "1_0_0"
4+
sysdisks_version: "1_0_1"

EXAMPLE/group_vars/test_gcp_euw1/cluster_vars.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44
gcp_credentials_file: "{{ lookup('env','GCP_CREDENTIALS') | default('/dev/null', true) }}"
55
gcp_credentials_json: "{{ lookup('file', gcp_credentials_file) | default({'project_id': 'GCP_CREDENTIALS__NOT_SET','client_email': 'GCP_CREDENTIALS__NOT_SET'}, true) }}"
66

7+
redeploy_scheme: _scheme_addallnew_rmdisk_rollback
8+
#redeploy_scheme: _scheme_addnewvm_rmdisk_rollback
9+
#redeploy_scheme: _scheme_rmvm_rmdisks_only
10+
711
app_name: "test" # The name of the application cluster (e.g. 'couchbase', 'nginx'); becomes part of cluster_name.
812
app_class: "test" # The class of application (e.g. 'database', 'webserver'); becomes part of the fqdn
913

10-
dns_tld_external: "" # Top-level domain for external access. gcloud dns needs a trailing '.'. Leave blank if no external DNS (use IPs only)
14+
beats_target_hosts: [] # The destination hosts for e.g. filebeat/ metricbeat logs
1115

1216
## Vulnerability scanners - Tenable and/ or Qualys cloud agents:
1317
cloud_agent:
@@ -40,8 +44,9 @@ cluster_vars:
4044
type: &cloud_type "gcp"
4145
image: "projects/ubuntu-os-cloud/global/images/ubuntu-1804-bionic-v20200430"
4246
region: &region "europe-west1"
43-
dns_zone_internal: "c.{{gcp_credentials_json.project_id}}.internal"
44-
dns_zone_external: "{%- if dns_tld_external -%}{{_cloud_type}}-{{_region}}.{{app_class}}.{{buildenv}}.{{dns_tld_external}} {%- endif -%}"
47+
dns_cloud_internal_domain: "c.{{gcp_credentials_json.project_id}}.internal" # The cloud-internal zone as defined by the cloud provider (e.g. GCP, AWS)
48+
dns_nameserver_zone: &dns_nameserver_zone "" # The zone that dns_server will operate on. gcloud dns needs a trailing '.'. Leave blank if no external DNS (use IPs only)
49+
dns_user_domain: "{%- if _dns_nameserver_zone -%}{{_cloud_type}}-{{_region}}.{{app_class}}.{{buildenv}}.{{_dns_nameserver_zone}}{%- endif -%}" # A user-defined _domain_ part of the FDQN, (if more prefixes are required before the dns_nameserver_zone)
4550
dns_server: "" # Specify DNS server. nsupdate, route53 or clouddns. If empty string is specified, no DNS will be added.
4651
assign_public_ip: "yes"
4752
inventory_ip: "public" # 'public' or 'private', (private in case we're operating in a private LAN). If public, 'assign_public_ip' must be 'yes'
@@ -81,3 +86,4 @@ cluster_vars:
8186
_cloud_type: *cloud_type
8287
_region: *region
8388
_ssh_guard_whitelist: *ssh_guard_whitelist
89+
_dns_nameserver_zone: *dns_nameserver_zone

0 commit comments

Comments
 (0)