This commit is contained in:
		
							
								
								
									
										16
									
								
								playbook.yml
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								playbook.yml
									
									
									
									
									
								
							| @@ -108,9 +108,19 @@ | ||||
|       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\" } ) }}" | ||||
|   - name: Reference new cluster | ||||
|     block: | ||||
|  | ||||
|     - name: Retrieve token | ||||
|       ansible.builtin.slurp: | ||||
|         src: /var/lib/rancher/k3s/server/token | ||||
|       register: k3s_token | ||||
|  | ||||
|     - ansible.builtin.debug: | ||||
|         var: k3s_token | ||||
|  | ||||
|     - name: Add to dictionary | ||||
|       cluster: "{{ cluster | combine( { 'mastertoken': k3s_token }, { 'apiurl': \"https://{{ cluster.virtualip | ansible.utils.ipaddr('address') }}:6443\" } ) }}" | ||||
|     when: cluster.mastertoken is not defined | ||||
|  | ||||
|   - ansible.builtin.debug: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user