Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- - hosts: k3s_cluster
- gather_facts: yes
- become: true
- tasks:
- ## UNTESTED!!!!!!!!!!!!!
- - name: Disable SWAP since kubernetes can't work with swap enabled (1/2)
- shell: |
- swapoff -a
- when: kubernetes_installed is changed
- ## UNTESTED!!!!!!!!!!!!!
- - name: Disable SWAP in fstab since kubernetes can't work with swap enabled (2/2)
- replace:
- path: /etc/fstab
- regexp: '^([^#].*?\sswap\s+sw\s+.*)$'
- replace: '# \1'
- when: kubernetes_installed is changed
- - name: Check if rancher dir exists
- stat:
- path: /etc/rancher
- register: stat_result
- - ansible.builtin.fail:
- msg: k3s is already installed
- when: stat_result.stat.exists
- - name: disable iv6 -> net.ipv6.conf.all.disable_ipv6=1
- ansible.posix.sysctl:
- name: "net.ipv6.conf.all.disable_ipv6"
- value: "1"
- state: present
- sysctl_set: true
- reload: true
- when: disable_ipv6
- - name: disable iv6 -> net.ipv6.conf.default.disable_ipv6=1
- ansible.posix.sysctl:
- name: "net.ipv6.conf.default.disable_ipv6"
- value: "1"
- state: present
- sysctl_set: true
- reload: true
- when: disable_ipv6
- - name: disable iv6 -> net.ipv6.conf.lo.disable_ipv6=1
- ansible.posix.sysctl:
- name: "net.ipv6.conf.lo.disable_ipv6"
- value: "1"
- state: present
- sysctl_set: true
- reload: true
- when: disable_ipv6
- - name: wait until apt (cloud init) finished
- shell: |
- while ! pgrep apt ; (($?)) ;do
- sleep 10
- done
- args:
- executable: /bin/bash
- - name: apt-get dist-upgrade
- ansible.builtin.apt:
- upgrade: dist
- update_cache: yes
- - name: install nfs-common
- ansible.builtin.package:
- name: nfs-common
- state: present
- - name: install locales-all
- ansible.builtin.package:
- name: locales-all
- state: present
- - name: ensuere LANG=C.UTF-8 (24h format)
- shell: update-locale LANG=C.UTF-8
- args:
- executable: /bin/bash
- # we need a faster way after proxmox rollbacks
- # sudo htpdate -a google.com
- - name: install htpdate
- ansible.builtin.package:
- name: htpdate
- state: present
- - name: install ntp
- ansible.builtin.package:
- name: ntp
- state: present
- - name: enable service ntp and ensure it is not masked
- ansible.builtin.systemd:
- name: ntp
- enabled: true
- masked: no
- - name: start ntpd
- ansible.builtin.systemd:
- state: started
- name: ntp
- # we need this to enable the agent - https://www.snel.com/support/nstall-qemu-guest-agent-for-debian-ubuntu/
- # qm create --agent=1 # https://pve.proxmox.com/pve-docs/qm.1.html
- - name: install qemu-guest-agent
- ansible.builtin.package:
- name: qemu-guest-agent
- state: present
- - name: enable service qemu-guest-agent and ensure it is not masked
- ansible.builtin.systemd:
- name: qemu-guest-agent
- enabled: true
- masked: no
- - name: start qemu-guest-agent
- ansible.builtin.systemd:
- state: started
- name: qemu-guest-agent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement