refactor: fix ansible-lint complains

- Change task names to start with a capital letter for consistency
- Update file modes to be strings instead of integers for better readability
- Replace deprecated `fetch` module with `ansible.builtin.fetch`

🤖
This commit is contained in:
Sebastian Mark 2023-07-17 11:31:21 +02:00
parent ea3dfef243
commit e73c49dc5e

View file

@ -1,43 +1,43 @@
--- ---
- hosts: all - hosts: all
gather_facts: false gather_facts: false
name: install k3s server name: Install k3s server
tags: k3s-server tags: k3s-server
tasks: tasks:
- name: download k3s install script - name: Download k3s install script
ansible.builtin.get_url: ansible.builtin.get_url:
url: https://get.k3s.io url: https://get.k3s.io
dest: /usr/local/bin/k3s_install.sh dest: /usr/local/bin/k3s_install.sh
mode: 0755 mode: "755"
- name: install k3s server - name: Install k3s server
ansible.builtin.command: "k3s_install.sh" ansible.builtin.command: "k3s_install.sh"
environment: environment:
INSTALL_K3S_CHANNEL: v1.27.3+k3s1 INSTALL_K3S_CHANNEL: v1.27.3+k3s1
INSTALL_K3S_EXEC: "--disable traefik" INSTALL_K3S_EXEC: "--disable traefik"
changed_when: false changed_when: false
- name: start and enable k3s server - name: Start and enable k3s server
ansible.builtin.service: ansible.builtin.service:
name: k3s name: k3s
state: started state: started
enabled: true enabled: true
- name: add kubeconfig variable to bashrc - name: Add kubeconfig variable to bashrc
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: ~/.bashrc path: ~/.bashrc
line: "export KUBECONFIG=/etc/rancher/k3s/k3s.yaml" line: "export KUBECONFIG=/etc/rancher/k3s/k3s.yaml"
insertafter: EOF insertafter: EOF
- name: get kubeconfig - name: Get kubeconfig
fetch: ansible.builtin.fetch:
src: /etc/rancher/k3s/k3s.yaml src: /etc/rancher/k3s/k3s.yaml
dest: kubeconfig_{{ ansible_host }}.yml dest: kubeconfig_{{ ansible_host }}.yml
flat: true flat: true
- hosts: all - hosts: all
gather_facts: false gather_facts: false
name: deploy baseline name: Deploy baseline
tags: baseline tags: baseline
tasks: tasks:
- name: copy manifest - name: Copy manifest
ansible.builtin.copy: ansible.builtin.copy:
src: argocd-init.yml src: argocd-init.yml
dest: /var/lib/rancher/k3s/server/manifests/argocd-init.yml dest: /var/lib/rancher/k3s/server/manifests/argocd-init.yml
mode: 0644 mode: "644"