diff --git a/roles/rke2/tasks/fix_selinux.yml b/roles/rke2/tasks/fix_selinux.yml index c95e1c52e9950f054958476c58ac22e04c73e3d1..3a75286a0aec02ee54b85e651148d27990ab1cd2 100644 --- a/roles/rke2/tasks/fix_selinux.yml +++ b/roles/rke2/tasks/fix_selinux.yml @@ -1,7 +1,7 @@ -- name: Sleep for 120 seconds so that the helm operator has deployed the deamonset - ansible.builtin.wait_for: - timeout: 120 - delegate_to: localhost +#- name: Sleep for 30 seconds so that the helm operator has deployed the deamonset +# ansible.builtin.wait_for: +# timeout: 30 +# delegate_to: localhost #- name: kill the openstack ccm pods to make sure they boot in permissive mode # shell: "/var/lib/rancher/rke2/bin/kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml rollout restart -n kube-system ds openstack-cloud-controller-manager " @@ -32,12 +32,13 @@ # - kube-controller-manager # - kube-scheduler -# - name: Wait for openstack-cloud-controller deamon set to be ready -# shell: "/var/lib/rancher/rke2/bin/kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml wait --namespace=kube-system --for=condition=Ready pods --selector app=openstack-cloud-controller-manager --timeout=360s" -# register: openstack_ccm_ready -# until: openstack_ccm_ready.stout -# when: ('master' in group_names) -# ignore_errors: True +- name: Wait for openstack-cloud-controller deamon set to be ready + shell: "/var/lib/rancher/rke2/bin/kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml wait --namespace=kube-system --for=condition=Ready pods --selector app=openstack-cloud-controller-manager --timeout=360s" + register: openstack_ccm_ready + until: openstack_ccm_ready.stdout + retries: 2 + delay: 30 + ignore_errors: True - name: Enable SELinux selinux: diff --git a/roles/rke2/tasks/main.yml b/roles/rke2/tasks/main.yml index 6b4d9ecb27634673d471cc54f08860a25eff91c0..e55f44603794768ad39e2d5f8b9300f8c7c7543d 100644 --- a/roles/rke2/tasks/main.yml +++ b/roles/rke2/tasks/main.yml @@ -6,22 +6,25 @@ - block: - include_tasks: setup_host.yml - include_tasks: install_rke2.yml - when: ( not rke2_installed.stat.exists and state != 'absent' and not postinstall) or (upgrade and state != 'absent' and not postinstall ) + when: ( not rke2_installed.stat.exists and state != 'absent' ) or (upgrade and state != 'absent' ) - include_tasks: templates.yml - when: "state != 'absent' and 'master' in group_names and not postinstall " + when: "state != 'absent' and 'master' in group_names " - block: - include_tasks: registries.yml - include_tasks: config_rke2.yml - when: state != 'absent' and not postinstall + when: state != 'absent' - include_tasks: kubeconfig.yml - when: state != 'absent' and 'master' in group_names and not postinstall + when: state != 'absent' and 'master' in group_names +- name: Flush handlers + meta: flush_handlers + #This task runs only after the full installer went through and had a bit of time to boot, then starts to enforce SELinux - include_tasks: fix_selinux.yml - when: state != 'absent' and postinstall + when: state != 'absent' and 'control-plane' in group_names - name: uninstall rke2 command: rke2-uninstall.sh @@ -29,4 +32,4 @@ - include_tasks: rotate_encryption.yml - when: state != 'absent' and 'control-plane' in group_names and rotate and not postinstall + when: state != 'absent' and 'control-plane' in group_names and rotate