From ebc5ed45b1ddc5ae131da3e84af1bff4d221bd70 Mon Sep 17 00:00:00 2001 From: djpbessems Date: Wed, 20 Apr 2022 10:54:01 +0200 Subject: [PATCH] Refactor from throttle to serial --- playbook.yml | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/playbook.yml b/playbook.yml index b220f44..4b14ae5 100644 --- a/playbook.yml +++ b/playbook.yml @@ -98,24 +98,21 @@ gather_facts: false vars_files: - cluster.k3s.yml + serial: 1 tasks: - - name: Iterate over hosts - block: + - name: Install K3s binary + ansible.builtin.shell: + cmd: "curl -sfL https://get.k3s.io | sh -s - server --cluster-init --disable local-storage,traefik --tls-san {{ cluster.virtualip | ansible.utils.ipaddr('address') }}" + environment: + K3S_TOKEN: "{{ cluster.mastertoken | default('', true) }}" + K3S_URL: "{{ cluster.apiurl | default('', true) }}" - - name: Install K3s binary - ansible.builtin.shell: - cmd: "curl -sfL https://get.k3s.io | sh -s - server --cluster-init --disable local-storage,traefik --tls-san {{ cluster.virtualip | ansible.utils.ipaddr('address') }}" - environment: - K3S_TOKEN: "{{ cluster.mastertoken | default('', true) }}" - K3S_URL: "{{ cluster.apiurl | default('', true) }}" + - name: Retrieve token & reference new cluster + ansible.builtin.set_fact: + cluster: "{{ cluster | combine( { mastertoken: '{{ lookup(''file'', /var/lib/rancher/k3s/server/token) }}' }, { apiurl: 'https://{{ cluster.virtualip | ansible.utils.ipaddr(''address'') }}:6443' } ) }}" + when: cluster.mastertoken is not defined - - name: Retrieve token & reference new cluster - ansible.builtin.set_fact: - cluster: "{{ cluster | combine( { mastertoken: '{{ lookup(''file'', /var/lib/rancher/k3s/server/token) }}' }, { apiurl: 'https://{{ cluster.virtualip | ansible.utils.ipaddr('address') }}:6443' } ) }}" - when: cluster.mastertoken is not defined + - ansible.builtin.debug: + var: cluster - - ansible.builtin.debug: - var: cluster - - throttle: 1