Преглед изворни кода

Remove machine config apply from upgrade

Applying the machine config during upgrade is not necessary as this is
handled by MCO when machine config changes occur because MCD is already
running on the host.
Russell Teague пре 5 година
родитељ
комит
52d5a6382c

+ 0 - 87
roles/openshift_node/tasks/apply_machine_config.yml

@@ -1,87 +0,0 @@
----
-- name: Create temp directory
-  tempfile:
-    state: directory
-  register: temp_dir
-
-- name: Get worker machine config name
-  command: >
-    oc get machineconfigpool worker
-    --config={{ openshift_node_kubeconfig_path }}
-    --output=jsonpath='{.status.configuration.name}'
-  delegate_to: localhost
-  register: oc_get
-  until:
-  - oc_get.stdout is defined
-  - oc_get.stdout != ''
-  retries: 36
-  delay: 5
-
-- name: Set l_worker_machine_config_name
-  set_fact:
-    l_worker_machine_config_name: "{{ oc_get.stdout }}"
-
-- name: Get worker ignition config
-  command: >
-    oc get machineconfig {{ l_worker_machine_config_name }}
-    --config={{ openshift_node_kubeconfig_path }}
-    --output=json
-  delegate_to: localhost
-  register: oc_get
-  until:
-  - oc_get.stdout is defined
-  - oc_get.stdout != ''
-  retries: 36
-  delay: 5
-
-- name: Write worker ignition config to file
-  copy:
-    content: "{{ (oc_get.stdout | from_json).spec.config }}"
-    dest: "{{ temp_dir.path }}/worker_ignition_config.json"
-
-- name: Get machine-config-operator image
-  command: >
-    oc get daemonset machine-config-daemon
-    --config={{ openshift_node_kubeconfig_path }}
-    --namespace=openshift-machine-config-operator
-    --output=jsonpath='{.spec.template.spec.containers[?(@.name=="machine-config-daemon")].image}'
-  delegate_to: localhost
-  register: oc_get
-  until:
-  - oc_get.stdout is defined
-  - oc_get.stdout != ''
-  retries: 36
-  delay: 5
-
-- name: Set l_mcd_image fact
-  set_fact:
-    l_mcd_image: "{{ oc_get.stdout }}"
-
-- name: Apply machine config
-  command: "podman run {{ podman_mounts }} {{ podman_flags }} {{ mcd_command }}"
-  vars:
-    podman_flags: "--privileged --rm --entrypoint=/usr/bin/machine-config-daemon -ti {{ l_mcd_image }}"
-    podman_mounts: "-v /:/rootfs -v /var/run/dbus:/var/run/dbus -v /run/systemd:/run/systemd"
-    mcd_command: "start --node-name {{ ansible_nodename | lower }} --once-from {{ temp_dir.path }}/worker_ignition_config.json --skip-reboot"
-
-- name: Remove temp directory
-  file:
-    path: "{{ temp_dir.path }}"
-    state: absent
-
-- name: Reboot the host and wait for it to come back
-  reboot:
-  #  reboot_timeout: 600  # default, 10 minutes
-
-- name: Wait for nodes to report ready
-  command: >
-    oc get node {{ ansible_nodename | lower }}
-    --config={{ openshift_node_kubeconfig_path }}
-    --output=jsonpath='{.status.conditions[?(@.type=="Ready")].status}'
-  delegate_to: localhost
-  run_once: true
-  register: oc_get
-  until:
-  - oc_get.stdout == "True"
-  retries: 36
-  delay: 5

+ 16 - 2
roles/openshift_node/tasks/upgrade.yml

@@ -28,8 +28,22 @@
 # Upgrade Node Packages
 - import_tasks: install.yml
 
-# Apply machine config
-- import_tasks: apply_machine_config.yml
+- name: Reboot the host and wait for it to come back
+  reboot:
+  #  reboot_timeout: 600  # default, 10 minutes
+
+- name: Wait for nodes to report ready
+  command: >
+    oc get node {{ ansible_nodename | lower }}
+    --config={{ openshift_node_kubeconfig_path }}
+    --output=jsonpath='{.status.conditions[?(@.type=="Ready")].status}'
+  delegate_to: localhost
+  run_once: true
+  register: oc_get
+  until:
+  - oc_get.stdout == "True"
+  retries: 36
+  delay: 5
 
 # Run the openshift_node_pre_uncordon_hook if defined
 - block: