瀏覽代碼

updating rzone serial upon change

Grega Bremec 3 年之前
父節點
當前提交
d36c89b70f

+ 19 - 3
roles/deploy-infra/tasks/main.yml

@@ -38,9 +38,25 @@
     state: present
   register: zoneupdate
 
-# TODO
-#- name: Extract the serial if rzone was updated
-#- name: Bump up the serial if rzone was updated
+- name: Extract the serial if rzone was updated
+  shell: grep -i serial /var/named/50.168.192.in-addr.arpa.zone | awk '{ print $1 }'
+  register: rzone_serial_result
+  when: zoneupdate.changed
+
+- name: Bump up the serial if rzone was updated
+  set_fact:
+    rzone_serial: "{{ rzone_serial_result.stdout | int + 1 }}"
+  when: zoneupdate.changed
+
+- name: Update the serial number of reverse DNS zone
+  lineinfile:
+    path: /var/named/50.168.192.in-addr.arpa.zone
+    regexp: "(?i); serial"
+    line: "		{{ rzone_serial }} ; serial"
+    state: present
+  when: zoneupdate.changed
+  notify:
+    - reload_named
 
 - name: Delegate the new zone to utility from bastion
   delegate_to: bastion.lab.example.com

+ 7 - 0
roles/prep-work/defaults/main.yml

@@ -0,0 +1,7 @@
+---
+ocp_maj: "4.9"
+ocp_z: "4.9.11"
+rhcos_ver: "4.9.0"
+cinst_ver: "latest"
+butane_ver: "latest"
+...

File diff suppressed because it is too large
+ 17 - 0
roles/prep-work/files/install-config.yaml


+ 7 - 0
roles/prep-work/tasks/main.yml

@@ -0,0 +1,7 @@
+---
+# Deploying:
+#  - PXE config
+#  - install-config.yaml
+#  - network customization
+- name: 
+...

+ 35 - 0
roles/prep-work/templates/netcfg.bu.j2

@@ -0,0 +1,35 @@
+variant: openshift
+version: 4.9.0
+metadata:
+  name: 01-master-network-ens3
+  labels:
+    machineconfiguration.openshift.io/role: master
+storage:
+  files:
+    - path: /etc/NetworkManager/system-connections/ens3.nmconnection
+      mode: 0600
+      overwrite: true
+      contents:
+        inline: |
+          [connection]
+          id=ens3
+          type=ethernet
+          interface-name=ens3
+
+          [ethernet]
+          mtu=1500
+
+          [ipv4]
+          address1={{ node.ip }}/24,192.168.50.254
+          dns=192.168.50.254;
+          method=manual
+
+          [ipv6]
+          method=disabled
+
+    - path: /etc/hostname
+      mode: 0644
+      overwrite: true
+      contents:
+        inline: |
+          {{ node.name }}.{{ node.cluster }}.example.com

+ 8 - 0
roles/prep-work/templates/pxe-sno.j2

@@ -0,0 +1,8 @@
+default menu.c32
+prompt 0
+timeout 86400
+menu title **** OpenShift {{ ocp_z }} Cluster "{{ cluster_name }}" PXE Menu ****
+
+label Install CoreOS {{ rhcos_ver }} for a {{ role }} node
+ kernel {{ images_url }}/rhcos-{{ rhcos_ver }}-x86_64-live-kernel-x86_64
+ append ip={{ node.ip }}::192.168.50.254:255.255.255.0:{{ node.name }}.{{ node.cluster }}.example.com:ens3:none:192.168.50.254 rd.neednet=1 console=tty0 initrd={{ images_url }}/rhcos-{{ rhcos_ver }}-x86_64-live-initramfs.x86_64.img,{{ images_url }}/rhcos-{{ rhcos_ver }}-x86_64-live-rootfs.x86_64.img ignition.config.url={{ ignitions_url }}/{{ cluster_name }}/{{ role }}.ign random.trust_cpu=on ignition.firstboot ignition.platform.id=metal

+ 31 - 0
roles/prep-work/vars/main.yml

@@ -0,0 +1,31 @@
+---
+ignitions_directory: /var/www/html/openshift4/ignitions/
+binaries_directory: /var/www/html/openshift4/binaries/
+images_directory: /var/www/html/openshift4/images/
+
+boot_host: http://192.168.50.254:8080
+
+ignitions_url: "{{ boot_host }}/openshift4/ignitions"
+binaries_url: "{{ boot_host }}/openshift4/binaries"
+images_url: "{{ boot_host }}/openshift4/images"
+
+cluster:
+  sno1:
+    n_compute: 1
+    customizations: {}
+  sno2:
+    n_compute: 1
+    customizations: {}
+
+vms:
+  - mac: 01-52-54-00-00-32-12
+    name: node
+    role: SNO
+    cluster: sno1
+    ip: 192.168.50.18
+  - mac: 01-52-54-00-00-32-1e
+    name: node
+    role: SNO
+    cluster: sno2
+    ip: 192.168.50.19
+...

Some files were not shown because too many files changed in this diff