mirror of
https://github.com/k3s-io/k3s-ansible.git
synced 2025-02-20 01:41:44 +01:00
Add support for ubuntu
This commit is contained in:
parent
b508c721ad
commit
9ad3dd93e4
@ -7,7 +7,7 @@ Author: <https://github.com/itwars>
|
||||
Build a Kubernetes cluster using Ansible with k3s. The goal is easily install a Kubernetes cluster on machines running:
|
||||
|
||||
- [X] Debian
|
||||
- [ ] Ubuntu
|
||||
- [X] Ubuntu
|
||||
- [X] CentOS
|
||||
|
||||
on processor architecture:
|
||||
|
@ -22,8 +22,11 @@
|
||||
group: root
|
||||
mode: 0755
|
||||
when:
|
||||
- ansible_facts.architecture is search("arm")
|
||||
- ansible_facts.userspace_bits == "64"
|
||||
( ansible_facts.architecture is search("arm")
|
||||
and
|
||||
ansible_facts.userspace_bits == "64" )
|
||||
or
|
||||
ansible_facts.architecture == "aarch64"
|
||||
|
||||
- name: Download k3s binary armhf
|
||||
get_url:
|
||||
|
37
roles/ubuntu/tasks/main.yml
Normal file
37
roles/ubuntu/tasks/main.yml
Normal file
@ -0,0 +1,37 @@
|
||||
---
|
||||
|
||||
- name: Check if cgroups enabled in /boot/firmware/cmdline.txt
|
||||
shell: cat /boot/firmware/cmdline.txt | grep cgroup
|
||||
register: cgroup_enabled
|
||||
when: ansible_distribution == 'Ubuntu'
|
||||
# grep will exit with 1 when no results found.
|
||||
# ignore_errors causes the task not to halt play.
|
||||
ignore_errors: true
|
||||
|
||||
- name: Enable cgroup via boot commandline if not already present
|
||||
lineinfile:
|
||||
path: /boot/firmware/cmdline.txt
|
||||
backrefs: yes
|
||||
regexp: "(.*)$"
|
||||
line: '\1 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory'
|
||||
when:
|
||||
( ansible_distribution == 'Ubuntu' )
|
||||
and
|
||||
( cgroup_enabled.stdout == "" )
|
||||
|
||||
- name: Check if cgroups already running
|
||||
shell: cat /proc/cmdline | grep cgroup
|
||||
register: cgroup_running
|
||||
when:
|
||||
ansible_distribution == 'Ubuntu'
|
||||
# grep will exit with 1 when no results found.
|
||||
# ignore_errors causes the task not to halt play.
|
||||
ignore_errors: true
|
||||
|
||||
- name: Rebooting to enable cgroups if not already running
|
||||
reboot:
|
||||
when:
|
||||
( ansible_distribution == 'Ubuntu' )
|
||||
and
|
||||
( cgroup_running.stdout == "" )
|
||||
|
Loading…
Reference in New Issue
Block a user