mirror of
https://github.com/k3s-io/k3s-ansible.git
synced 2025-12-25 00:12:37 +01:00
Fixes #3: Fix linting issues, add ansible-lint and yamllint configuration.
This commit is contained in:
@@ -7,32 +7,31 @@
|
||||
|
||||
- name: Download k3s binary x64
|
||||
get_url:
|
||||
url: https://github.com/rancher/k3s/releases/download/{{ k3s_version }}/k3s
|
||||
dest: /usr/local/bin/k3s
|
||||
owner: root
|
||||
group: root
|
||||
mode: 755
|
||||
# when: ( ansible_facts.userspace_architecture == "x86_64" )
|
||||
when: ( ansible_facts.architecture == "x86_64" )
|
||||
url: https://github.com/rancher/k3s/releases/download/{{ k3s_version }}/k3s
|
||||
dest: /usr/local/bin/k3s
|
||||
owner: root
|
||||
group: root
|
||||
mode: 755
|
||||
when: ansible_facts.architecture == "x86_64"
|
||||
|
||||
- name: Download k3s binary arm64
|
||||
get_url:
|
||||
url: https://github.com/rancher/k3s/releases/download/{{ k3s_version }}/k3s-arm64
|
||||
dest: /usr/local/bin/k3s
|
||||
owner: root
|
||||
group: root
|
||||
mode: 755
|
||||
when: ( ansible_facts.architecture is search("arm") )
|
||||
and
|
||||
( ansible_facts.userspace_bits == "64" )
|
||||
url: https://github.com/rancher/k3s/releases/download/{{ k3s_version }}/k3s-arm64
|
||||
dest: /usr/local/bin/k3s
|
||||
owner: root
|
||||
group: root
|
||||
mode: 755
|
||||
when:
|
||||
- ansible_facts.architecture is search("arm")
|
||||
- ansible_facts.userspace_bits == "64"
|
||||
|
||||
- name: Download k3s binary armhf
|
||||
get_url:
|
||||
url: https://github.com/rancher/k3s/releases/download/{{ k3s_version }}/k3s-armhf
|
||||
dest: /usr/local/bin/k3s
|
||||
owner: root
|
||||
group: root
|
||||
mode: 755
|
||||
when: ( ansible_facts.architecture is search("arm") )
|
||||
and
|
||||
( ansible_facts.userspace_bits == "32" )
|
||||
url: https://github.com/rancher/k3s/releases/download/{{ k3s_version }}/k3s-armhf
|
||||
dest: /usr/local/bin/k3s
|
||||
owner: root
|
||||
group: root
|
||||
mode: 755
|
||||
when:
|
||||
- ansible_facts.architecture is search("arm")
|
||||
- ansible_facts.userspace_bits == "32"
|
||||
|
||||
@@ -36,10 +36,10 @@
|
||||
register: node_token
|
||||
|
||||
- name: Store Master node-token
|
||||
set_fact:
|
||||
token: "{{ node_token.content | b64decode | regex_replace('\n', '') }}"
|
||||
set_fact:
|
||||
token: "{{ node_token.content | b64decode | regex_replace('\n', '') }}"
|
||||
|
||||
- name: Restore node-token file access
|
||||
- name: Restore node-token file access
|
||||
file:
|
||||
path: /var/lib/rancher/k3s/server
|
||||
mode: "{{ p.stat.mode }}"
|
||||
@@ -58,9 +58,11 @@
|
||||
owner: "{{ ansible_user }}"
|
||||
|
||||
- name: Replace https://localhost:6443 by https://master-pi:6443
|
||||
command: k3s kubectl config set-cluster default
|
||||
--server=https://{{ master_ip }}:6443
|
||||
--kubeconfig ~{{ ansible_user }}/.kube/config
|
||||
command: >-
|
||||
k3s kubectl config set-cluster default
|
||||
--server=https://{{ master_ip }}:6443
|
||||
--kubeconfig ~{{ ansible_user }}/.kube/config
|
||||
changed_when: true
|
||||
|
||||
- name: Create kubectl symlink
|
||||
file:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
- name: Set SELinux to disabled state
|
||||
selinux:
|
||||
state: disabled
|
||||
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux'
|
||||
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux']
|
||||
|
||||
- name: Enable IPv4 forwarding
|
||||
sysctl:
|
||||
@@ -24,7 +24,7 @@
|
||||
value: "1"
|
||||
state: present
|
||||
reload: yes
|
||||
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux'
|
||||
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux']
|
||||
loop:
|
||||
- net.bridge.bridge-nf-call-iptables
|
||||
- net.bridge.bridge-nf-call-ip6tables
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
regexp: '^(.*rootwait)$'
|
||||
line: '\1 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory'
|
||||
backrefs: true
|
||||
when: ( cmdline.stat.path is defined )
|
||||
and
|
||||
( ansible_facts.architecture is search("arm") )
|
||||
when:
|
||||
- cmdline.stat.path is defined
|
||||
- ansible_facts.architecture is search("arm")
|
||||
register: boot_cmdline
|
||||
|
||||
- name: Rebooting on Raspbian
|
||||
- name: Rebooting on Raspbian
|
||||
reboot:
|
||||
when: ( boot_cmdline is changed )
|
||||
and
|
||||
( ansible_facts.architecture is search("arm") )
|
||||
when:
|
||||
- boot_cmdline | changed
|
||||
- ansible_facts.architecture is search("arm")
|
||||
|
||||
Reference in New Issue
Block a user