Skip to content

Commit 68a9459

Browse files
committed
feat: generate edge connect files
1 parent 1392aae commit 68a9459

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

playbook/project/agent.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
- name: Gather server info
33
hosts: micado
44
gather_facts: True
5-
5+
tags:
6+
- always
67
pre_tasks:
78
- name: (MiCADO) Check target is a micado-control plane
89
k8s:
@@ -33,6 +34,32 @@
3334
register: registries_content
3435
when: registries_file.stat.exists
3536

37+
- name: Write edge registry and script to localhost
38+
hosts: localhost
39+
connection: local
40+
gather_facts: False
41+
tags:
42+
- never
43+
- edge-files
44+
tasks:
45+
- name: Write registries.yaml to localhost
46+
ansible.builtin.copy:
47+
content: "{{ hostvars['micado']['registries_content']['content'] | b64decode }}"
48+
dest: "../../../registries.yaml"
49+
when: hostvars['micado']['registries_file'].stat.exists
50+
51+
- name: Write k3s agent install script
52+
ansible.builtin.copy:
53+
content: |
54+
#!/bin/bash
55+
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION={{ packages.k3s_version }} INSTALL_K3S_EXEC="agent" sh -s - \
56+
--server "https://{{ hostvars['micado']['ansible_host'] }}:6443" \
57+
--node-name YOUR_UNIQUE_EDGE_HOSTNAME \
58+
--token "{{ hostvars['micado']['k3s_token']['content'] | b64decode | trim }}" \
59+
--node-external-ip YOUR_EDGE_PUBLIC_IP
60+
dest: "../../../connect_edge.sh"
61+
mode: '0755'
62+
3663
- name: Join agents
3764
hosts: agents
3865
gather_facts: False

0 commit comments

Comments
 (0)