mirror of
https://github.com/geerlingguy/ansible-role-kubernetes.git
synced 2025-08-29 13:47:06 +02:00
Separate file for cilium client install
This commit is contained in:
parent
b7c414d243
commit
002506d18d
52
tasks/cilium-client-setup.yml
Normal file
52
tasks/cilium-client-setup.yml
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
---
|
||||||
|
- name: Check if Cilium CLI has already been Installed.
|
||||||
|
stat:
|
||||||
|
path: /usr/local/bin/cilium
|
||||||
|
register: cilium_init_stat
|
||||||
|
when:
|
||||||
|
- kubernetes_pod_network.cni == 'cilium'
|
||||||
|
|
||||||
|
- name: Install Cilium CLI
|
||||||
|
when:
|
||||||
|
- kubernetes_pod_network.cni == 'cilium'
|
||||||
|
- not cilium_init_stat.stat.exists
|
||||||
|
block:
|
||||||
|
- name: Get Cilium CLI version
|
||||||
|
shell: curl -s https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt
|
||||||
|
register: cilium_cli_version
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Set CLI architecture
|
||||||
|
set_fact:
|
||||||
|
cli_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}"
|
||||||
|
|
||||||
|
- name: Download Cilium CLI
|
||||||
|
get_url:
|
||||||
|
url: "https://github.com/cilium/cilium-cli/releases/download/{{ cilium_cli_version.stdout }}/cilium-linux-{{ cli_arch }}.tar.gz"
|
||||||
|
dest: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz"
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
- name: Download Cilium CLI checksum
|
||||||
|
get_url:
|
||||||
|
url: "https://github.com/cilium/cilium-cli/releases/download/{{ cilium_cli_version.stdout }}/cilium-linux-{{ cli_arch }}.tar.gz.sha256sum"
|
||||||
|
dest: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz.sha256sum"
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
- name: Verify Cilium CLI checksum
|
||||||
|
shell: sha256sum --check /tmp/cilium-linux-{{ cli_arch }}.tar.gz.sha256sum
|
||||||
|
args:
|
||||||
|
chdir: /tmp
|
||||||
|
|
||||||
|
- name: Extract Cilium CLI
|
||||||
|
unarchive:
|
||||||
|
src: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz"
|
||||||
|
dest: /usr/local/bin
|
||||||
|
remote_src: true
|
||||||
|
|
||||||
|
- name: Remove downloaded files
|
||||||
|
file:
|
||||||
|
path: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz{{ item }}"
|
||||||
|
state: absent
|
||||||
|
loop:
|
||||||
|
- ''
|
||||||
|
- '.sha256sum'
|
@ -83,56 +83,6 @@
|
|||||||
state: link
|
state: link
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
|
||||||
- name: Check if Cilium CLI has already been Installed.
|
|
||||||
stat:
|
|
||||||
path: /usr/local/bin/cilium
|
|
||||||
register: cilium_init_stat
|
|
||||||
|
|
||||||
- name: Install Cilium CLI
|
|
||||||
when:
|
|
||||||
- kubernetes_pod_network.cni == 'cilium'
|
|
||||||
- not cilium_init_stat.stat.exists
|
|
||||||
block:
|
|
||||||
- name: Get Cilium CLI version
|
|
||||||
shell: curl -s https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt
|
|
||||||
register: cilium_cli_version
|
|
||||||
changed_when: false
|
|
||||||
|
|
||||||
- name: Set CLI architecture
|
|
||||||
set_fact:
|
|
||||||
cli_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}"
|
|
||||||
|
|
||||||
- name: Download Cilium CLI
|
|
||||||
get_url:
|
|
||||||
url: "https://github.com/cilium/cilium-cli/releases/download/{{ cilium_cli_version.stdout }}/cilium-linux-{{ cli_arch }}.tar.gz"
|
|
||||||
dest: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz"
|
|
||||||
mode: '0644'
|
|
||||||
|
|
||||||
- name: Download Cilium CLI checksum
|
|
||||||
get_url:
|
|
||||||
url: "https://github.com/cilium/cilium-cli/releases/download/{{ cilium_cli_version.stdout }}/cilium-linux-{{ cli_arch }}.tar.gz.sha256sum"
|
|
||||||
dest: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz.sha256sum"
|
|
||||||
mode: '0644'
|
|
||||||
|
|
||||||
- name: Verify Cilium CLI checksum
|
|
||||||
shell: sha256sum --check /tmp/cilium-linux-{{ cli_arch }}.tar.gz.sha256sum
|
|
||||||
args:
|
|
||||||
chdir: /tmp
|
|
||||||
|
|
||||||
- name: Extract Cilium CLI
|
|
||||||
unarchive:
|
|
||||||
src: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz"
|
|
||||||
dest: /usr/local/bin
|
|
||||||
remote_src: true
|
|
||||||
|
|
||||||
- name: Remove downloaded files
|
|
||||||
file:
|
|
||||||
path: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz{{ item }}"
|
|
||||||
state: absent
|
|
||||||
loop:
|
|
||||||
- ''
|
|
||||||
- '.sha256sum'
|
|
||||||
|
|
||||||
- name: Write Cilium Helm values to file
|
- name: Write Cilium Helm values to file
|
||||||
copy:
|
copy:
|
||||||
dest: "/tmp/cilium_helm.yaml"
|
dest: "/tmp/cilium_helm.yaml"
|
||||||
|
@ -34,6 +34,12 @@
|
|||||||
path: /etc/kubernetes/admin.conf
|
path: /etc/kubernetes/admin.conf
|
||||||
register: kubernetes_init_stat
|
register: kubernetes_init_stat
|
||||||
|
|
||||||
|
# Set up Cilium Client.
|
||||||
|
- include_tasks: cilium-client-setup.yml
|
||||||
|
when:
|
||||||
|
- kubernetes_pod_network.cni == 'cilium'
|
||||||
|
- kubernetes_role == 'control_plane'
|
||||||
|
|
||||||
# Set up control plane.
|
# Set up control plane.
|
||||||
- include_tasks: control-plane-setup.yml
|
- include_tasks: control-plane-setup.yml
|
||||||
when: kubernetes_role == 'control_plane'
|
when: kubernetes_role == 'control_plane'
|
||||||
|
Loading…
Reference in New Issue
Block a user