From 3f787adc0e5136d015aabd1341be4ba2db391818 Mon Sep 17 00:00:00 2001 From: djpbessems Date: Sun, 24 Apr 2022 19:19:32 +0200 Subject: [PATCH] Switch to module over command --- playbook.yml | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/playbook.yml b/playbook.yml index a31262e..fca5b27 100644 --- a/playbook.yml +++ b/playbook.yml @@ -142,17 +142,15 @@ dest: /var/lib/rancher/k3s/server/manifests/kube-vip.yml - name: Initial node -- Wait for ??? - # ansible.builtin.pause: - # seconds: 300 - ansible.builtin.shell: - cmd: kubectl get pod -A + kubernetes.core.get_info: + kind: pod register: pod_state with_sequence: count=5 loop_control: pause: 10 ignore_errors: yes - ansible.builtin.debug: - msg: "{{ pod_state | json_query('results[*].stdout') }}" + var: "{{ pod_state.results }}" delegate_to: "{{ ansible_play_hosts[0] }}" run_once: true @@ -177,27 +175,6 @@ K3S_TOKEN: "{{ cluster.token }}" # (hostvars[ansible_play_hosts[0]]).cluster.token K3S_URL: "{{ 'https://' + ( cluster.virtualip | ansible.utils.ipaddr('address') ) + ':6443' }}" - rescue: - - - name: Initial node -- Wait for ??? - ansible.builtin.shell: - cmd: kubectl get pod -A - register: pod_state - with_sequence: count=5 - loop_control: - pause: 10 - ignore_errors: yes - - ansible.builtin.debug: - msg: "{{ pod_state | json_query('results[*].stdout') }}" - - - - name: Debug systemd unit - ansible.builtin.shell: - cmd: systemctl status k3s -l --no-pager; journalctl -u k3s.service --no-pager - register: debug - - ansible.builtin.debug: - var: debug.stdout - when: inventory_hostname != ansible_play_hosts[0] - name: Deploy applications