Skip to content

Commit 8265c25

Browse files
committed
Support Azure's Corefile override mechanism
1 parent bcb799c commit 8265c25

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

roles/connect-k8s/tasks/main.yaml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
ansible.builtin.copy:
1010
dest: target/Corefile
1111
content: "{{ corefile.resources[0].data.Corefile }}"
12-
- name: Delegate AD Domain To AD
12+
- name: Delegate AD Domain to AD
1313
ansible.builtin.lineinfile:
1414
path: target/Corefile
1515
search_string: "forward {{ hostvars['sble-addc'].ansible_facts.domain }}. "
@@ -21,10 +21,28 @@
2121
apiVersion: v1
2222
kind: ConfigMap
2323
metadata:
24-
namespace: kube-system
25-
name: coredns
24+
namespace: "{{ corefile.resources[0].metadata.namespace }}"
25+
name: "{{ corefile.resources[0].metadata.name }}"
2626
data:
2727
Corefile: "{{ lookup('file', 'target/Corefile') }}"
28+
# Some Kubernetes distros (like AKS) prevent you from modifying the Corefile,
29+
# but provide a separate ConfigMap to edit. So let's provide an override too.
30+
# modifying the "main" one.
31+
- name: Update Override Corefile
32+
kubernetes.core.k8s:
33+
resource_definition:
34+
apiVersion: v1
35+
kind: ConfigMap
36+
metadata:
37+
namespace: kube-system
38+
name: coredns-custom
39+
data:
40+
sble-addc.server: |
41+
{{ hostvars['sble-addc'].ansible_facts.domain }}.:53 {
42+
errors
43+
reload
44+
forward {{ hostvars['sble-addc'].ansible_facts.domain }}. {{ hostvars['sble-addc'].vm_network_ipv4 }}
45+
}
2846
2947
- name: Update Secret-Operator Credentials
3048
kubernetes.core.k8s:

roles/create-vm/tasks/main.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@
6868
command: get_xml
6969
uri: "{{ libvirt_uri }}"
7070
register: created_vm
71-
- debug:
72-
var: created_vm
7371
# VM can have multiple NICs, extract the one we care about so we can match it against the IP address of the guest later
7472
- name: Extract VM's MAC address
7573
community.general.xml:

0 commit comments

Comments
 (0)