mirror of
https://github.com/techno-tim/k3s-ansible.git
synced 2025-12-26 02:32:59 +01:00
Change to FQCN with ansible-lint fixer (#553)
* Change to FQCN with ansible-lint fixer Since ansible-base 2.10 (later ansible-core), FQCN is the new way to go. Updated .ansible-lint with a production profile and removed fqcn in skip_list. Updated .yamllint with rules needed. Ran ansible-lint --fix=all, then manually applied some minor changes. * Changed octal value in molecule/ipv6/prepare.yml
This commit is contained in:
@@ -4,12 +4,12 @@
|
||||
run_once: true
|
||||
block:
|
||||
- name: Create tmp directory on first master
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: /tmp/k3s
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
mode: "0755"
|
||||
|
||||
- name: Check if Cilium CLI is installed
|
||||
ansible.builtin.command: cilium version
|
||||
@@ -19,7 +19,7 @@
|
||||
ignore_errors: true
|
||||
|
||||
- name: Check for Cilium CLI version in command output
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
installed_cli_version: >-
|
||||
{{
|
||||
cilium_cli_installed.stdout_lines
|
||||
@@ -32,11 +32,11 @@
|
||||
|
||||
- name: Get latest stable Cilium CLI version file
|
||||
ansible.builtin.get_url:
|
||||
url: "https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt"
|
||||
dest: "/tmp/k3s/cilium-cli-stable.txt"
|
||||
url: https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt
|
||||
dest: /tmp/k3s/cilium-cli-stable.txt
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
mode: "0755"
|
||||
|
||||
- name: Read Cilium CLI stable version from file
|
||||
ansible.builtin.command: cat /tmp/k3s/cilium-cli-stable.txt
|
||||
@@ -52,7 +52,7 @@
|
||||
msg: "Latest Cilium CLI version: {{ cli_ver.stdout }}"
|
||||
|
||||
- name: Determine if Cilium CLI needs installation or update
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
cilium_cli_needs_update: >-
|
||||
{{
|
||||
cilium_cli_installed.rc != 0 or
|
||||
@@ -70,15 +70,15 @@
|
||||
- name: Download Cilium CLI and checksum
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ cilium_base_url }}/cilium-linux-{{ cli_arch }}{{ item }}"
|
||||
dest: "/tmp/k3s/cilium-linux-{{ cli_arch }}{{ item }}"
|
||||
dest: /tmp/k3s/cilium-linux-{{ cli_arch }}{{ item }}
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
mode: "0755"
|
||||
loop:
|
||||
- ".tar.gz"
|
||||
- ".tar.gz.sha256sum"
|
||||
- .tar.gz
|
||||
- .tar.gz.sha256sum
|
||||
vars:
|
||||
cilium_base_url: "https://github.com/cilium/cilium-cli/releases/download/{{ cli_ver.stdout }}"
|
||||
cilium_base_url: https://github.com/cilium/cilium-cli/releases/download/{{ cli_ver.stdout }}
|
||||
|
||||
- name: Verify the downloaded tarball
|
||||
ansible.builtin.shell: |
|
||||
@@ -89,7 +89,7 @@
|
||||
|
||||
- name: Extract Cilium CLI to /usr/local/bin
|
||||
ansible.builtin.unarchive:
|
||||
src: "/tmp/k3s/cilium-linux-{{ cli_arch }}.tar.gz"
|
||||
src: /tmp/k3s/cilium-linux-{{ cli_arch }}.tar.gz
|
||||
dest: /usr/local/bin
|
||||
remote_src: true
|
||||
|
||||
@@ -98,8 +98,8 @@
|
||||
path: "{{ item }}"
|
||||
state: absent
|
||||
loop:
|
||||
- "/tmp/k3s/cilium-linux-{{ cli_arch }}.tar.gz"
|
||||
- "/tmp/k3s/cilium-linux-{{ cli_arch }}.tar.gz.sha256sum"
|
||||
- /tmp/k3s/cilium-linux-{{ cli_arch }}.tar.gz
|
||||
- /tmp/k3s/cilium-linux-{{ cli_arch }}.tar.gz.sha256sum
|
||||
|
||||
- name: Wait for connectivity to kube VIP
|
||||
ansible.builtin.command: ping -c 1 {{ apiserver_endpoint }}
|
||||
@@ -112,7 +112,7 @@
|
||||
|
||||
- name: Fail if kube VIP not reachable
|
||||
ansible.builtin.fail:
|
||||
msg: "API endpoint {{ apiserver_endpoint }} is not reachable"
|
||||
msg: API endpoint {{ apiserver_endpoint }} is not reachable
|
||||
when: ping_result.rc != 0
|
||||
|
||||
- name: Test for existing Cilium install
|
||||
@@ -125,7 +125,6 @@
|
||||
- name: Check existing Cilium install
|
||||
when: cilium_installed.rc == 0
|
||||
block:
|
||||
|
||||
- name: Check Cilium version
|
||||
ansible.builtin.command: cilium version
|
||||
register: cilium_version
|
||||
@@ -134,7 +133,7 @@
|
||||
ignore_errors: true
|
||||
|
||||
- name: Parse installed Cilium version
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
installed_cilium_version: >-
|
||||
{{
|
||||
cilium_version.stdout_lines
|
||||
@@ -145,7 +144,7 @@
|
||||
}}
|
||||
|
||||
- name: Determine if Cilium needs update
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
cilium_needs_update: >-
|
||||
{{ 'v' + installed_cilium_version != cilium_tag }}
|
||||
|
||||
@@ -191,7 +190,7 @@
|
||||
when: cilium_installed.rc != 0 or cilium_needs_update
|
||||
|
||||
- name: Wait for Cilium resources
|
||||
command: >-
|
||||
ansible.builtin.command: >-
|
||||
{% if item.type == 'daemonset' %}
|
||||
k3s kubectl wait pods
|
||||
--namespace=kube-system
|
||||
@@ -209,10 +208,10 @@
|
||||
retries: 30
|
||||
delay: 7
|
||||
with_items:
|
||||
- {name: cilium-operator, type: deployment}
|
||||
- {name: cilium, type: daemonset, selector: 'k8s-app=cilium'}
|
||||
- {name: hubble-relay, type: deployment, check_hubble: true}
|
||||
- {name: hubble-ui, type: deployment, check_hubble: true}
|
||||
- { name: cilium-operator, type: deployment }
|
||||
- { name: cilium, type: daemonset, selector: k8s-app=cilium }
|
||||
- { name: hubble-relay, type: deployment, check_hubble: true }
|
||||
- { name: hubble-ui, type: deployment, check_hubble: true }
|
||||
loop_control:
|
||||
label: "{{ item.type }}/{{ item.name }}"
|
||||
when: >-
|
||||
@@ -221,14 +220,13 @@
|
||||
- name: Configure Cilium BGP
|
||||
when: cilium_bgp
|
||||
block:
|
||||
|
||||
- name: Copy BGP manifests to first master
|
||||
ansible.builtin.template:
|
||||
src: "cilium.crs.j2"
|
||||
src: cilium.crs.j2
|
||||
dest: /tmp/k3s/cilium-bgp.yaml
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
mode: "0755"
|
||||
|
||||
- name: Apply BGP manifests
|
||||
ansible.builtin.command:
|
||||
|
||||
Reference in New Issue
Block a user