Commit 1031ea3c authored by Derek Nola's avatar Derek Nola
Browse files

Comply with ansible-lint



Signed-off-by: default avatarDerek Nola <derek.nola@suse.com>
parent 5b17c77e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
.vscode
.vagrant
 No newline at end of file
+2 −1
Original line number Diff line number Diff line
---

- hosts: k3s_cluster
- name: Reset K3s cluster
  hosts: k3s_cluster
  gather_facts: yes
  become: yes
  roles:
+3 −3
Original line number Diff line number Diff line
---

- name: Download k3s binary x64
  get_url:
  ansible.builtin.get_url:
    url: https://github.com/k3s-io/k3s/releases/download/{{ k3s_version }}/k3s
    checksum: sha256:https://github.com/k3s-io/k3s/releases/download/{{ k3s_version }}/sha256sum-amd64.txt
    timeout: 120
@@ -12,7 +12,7 @@
  when: ansible_facts.architecture == "x86_64"

- name: Download k3s binary arm64
  get_url:
  ansible.builtin.get_url:
    url: https://github.com/k3s-io/k3s/releases/download/{{ k3s_version }}/k3s-arm64
    checksum: sha256:https://github.com/k3s-io/k3s/releases/download/{{ k3s_version }}/sha256sum-arm64.txt
    timeout: 120
@@ -26,7 +26,7 @@
      ansible_facts.architecture is search("aarch64")

- name: Download k3s binary armhf
  get_url:
  ansible.builtin.get_url:
    url: https://github.com/k3s-io/k3s/releases/download/{{ k3s_version }}/k3s-armhf
    checksum: sha256:https://github.com/k3s-io/k3s/releases/download/{{ k3s_version }}/sha256sum-arm.txt
    timeout: 120
+13 −13
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@

- name: Copy K3s service file
  register: k3s_service
  template:
  ansible.builtin.template:
    src: "k3s.service.j2"
    dest: "{{ systemd_dir }}/k3s.service"
    owner: root
@@ -10,49 +10,49 @@
    mode: 0644

- name: Enable and check K3s service
  systemd:
  ansible.builtin.systemd:
    name: k3s
    daemon_reload: yes
    state: restarted
    enabled: yes

- name: Wait for node-token
  wait_for:
  ansible.builtin.wait_for:
    path: "{{ k3s_server_location }}/server/node-token"

- name: Register node-token file access mode
  stat:
  ansible.builtin.stat:
    path: "{{ k3s_server_location }}/server/node-token"
  register: p

- name: Change file access node-token
  file:
  ansible.builtin.file:
    path: "{{ k3s_server_location }}/server/node-token"
    mode: "g+rx,o+rx"

- name: Read node-token from master
  slurp:
  ansible.builtin.slurp:
    path: "{{ k3s_server_location }}/server/node-token"
  register: node_token

- name: Store Master node-token
  set_fact:
  ansible.builtin.set_fact:
    token: "{{ node_token.content | b64decode | regex_replace('\n', '') }}"

- name: Restore node-token file access
  file:
  ansible.builtin.file:
    path: "{{ k3s_server_location }}/server/node-token"
    mode: "{{ p.stat.mode }}"

- name: Create directory .kube
  file:
  ansible.builtin.file:
    path: ~{{ ansible_user }}/.kube
    state: directory
    owner: "{{ ansible_user }}"
    mode: "u=rwx,g=rx,o="

- name: Copy config file to user home directory
  copy:
  ansible.builtin.copy:
    src: /etc/rancher/k3s/k3s.yaml
    dest: ~{{ ansible_user }}/.kube/config
    remote_src: yes
@@ -60,20 +60,20 @@
    mode: "u=rw,g=,o="

- name: Replace https://localhost:6443 by https://master-ip:6443
  command: >-
  ansible.builtin.command: >-
    /usr/local/bin/k3s kubectl config set-cluster default
      --server=https://{{ master_ip }}:6443
      --kubeconfig ~{{ ansible_user }}/.kube/config
  changed_when: true

- name: Create kubectl symlink
  file:
  ansible.builtin.file:
    src: /usr/local/bin/k3s
    dest: /usr/local/bin/kubectl
    state: link

- name: Create crictl symlink
  file:
  ansible.builtin.file:
    src: /usr/local/bin/k3s
    dest: /usr/local/bin/crictl
    state: link
+2 −2
Original line number Diff line number Diff line
---

- name: Copy K3s service file
  template:
  ansible.builtin.template:
    src: "k3s.service.j2"
    dest: "{{ systemd_dir }}/k3s-node.service"
    owner: root
@@ -9,7 +9,7 @@
    mode: 0755

- name: Enable and check K3s service
  systemd:
  ansible.builtin.systemd:
    name: k3s-node
    daemon_reload: yes
    state: restarted
Loading