Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/k0s update #1

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,6 @@ hello k0s
pod "hello-k0s" deleted
```

### Want to throw away your cluster and start all over?

```ShellSession
$ multipass delete $(multipass list --format csv | grep 'k0s' | cut -d',' -f1)
$ multipass purge
```

## Test with Vagrant

It's assumed that vagrant is installed, if not, download and install it from their [website](https://www.vagrantup.com/downloads)

After that consult the [readme](Vagrant.md)

## How to Contribute

I welcome issues to and pull requests against this repository!
109 changes: 0 additions & 109 deletions Vagrant.md

This file was deleted.

37 changes: 0 additions & 37 deletions Vagrantfile

This file was deleted.

3 changes: 1 addition & 2 deletions site.yml → install_k0s_cluster.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---

- hosts: all
- hosts: k0s
name: Download k0s on all nodes
become: yes
roles:
Expand Down
4 changes: 2 additions & 2 deletions inventory/sample/group_vars/all.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
# Use this to overwrite the role defaults
# k0s_version: v1.22.4+k0s.1
# k0s_version: v1.23.8+k0s.0
# ansible_user: k0s
# artifacts_dir: "{{ inventory_dir }}/artifacts"
# systemd_dest: /etc/systemd/system
# k0s_binary_dest: /usr/local/bin/k0s
# k0s_config_dir: /etc/k0s
k0s_config_dir: /etc/k0s
# k0s_data_dir: /var/lib/k0s
# k0s_libexec_dir: /usr/libexec/k0s/
# k0s_use_custom_config: false
2 changes: 1 addition & 1 deletion inventory/sample/inventory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ all:
k0s-7:
ansible_host: 192.168.64.61
vars:
ansible_user: k0s
ansible_user: k0s
10 changes: 0 additions & 10 deletions inventory/vagrant/group_vars/all.yml

This file was deleted.

27 changes: 0 additions & 27 deletions inventory/vagrant/inventory.yml

This file was deleted.

30 changes: 30 additions & 0 deletions k0s_backup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
- hosts: controller, initial_controller
name: Download k0s on all nodes
become: yes
roles:
- role: backup

# - hosts: initial_controller
# gather_facts: yes
# become: yes
# name: Configure initial k0s control plane node
# roles:
# - role: k0s/initial_controller
# tags: init

# - hosts: controller
# gather_facts: yes
# become: yes
# serial: 1
# name: Configure k0s control plane nodes
# roles:
# - role: k0s/controller
# tags: server

# - hosts: worker
# become: yes
# name: Configure k0s worker nodes
# roles:
# - role: k0s/worker
# tags: worker
2 changes: 1 addition & 1 deletion reset.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

- hosts: all
- hosts: k0s
gather_facts: yes
become: yes
roles:
Expand Down
3 changes: 3 additions & 0 deletions roles/backup/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
k0s_version: v1.23.8+k0s.0
k0s_binary_dest: /usr/local/bin/k0s
28 changes: 28 additions & 0 deletions roles/backup/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
- name: set k0s_backup_dir fact
set_fact:
k0s_backup_dir: "/k0s-backup"
run_once: true
when: k0s_backup_dir is not defined

- name: create k0s_backup_dir path
file:
path: "{{ k0s_backup_dir }}"
state: directory
owner: "{{ ansible_user }}"
mode: 0775

- name: Backup k0s controller
register: backup_controller_state
command: k0s backup --save-path={{ k0s_backup_dir }} -

- name: List backups data dir contents
find:
paths: "{{ k0s_backup_dir }}"
recurse: yes
file_type: any
register: k0s_backup_file

- debug:
msg: "{{ k0s_backup_file }}"

2 changes: 1 addition & 1 deletion roles/download/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
k0s_version: v1.22.4+k0s.1
k0s_version: v1.23.8+k0s.0
k0s_binary_dest: /usr/local/bin/k0s
5 changes: 3 additions & 2 deletions roles/k0s/controller/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

- name: Create k0s controller service with install command
register: install_controller_cmd
command: k0s install controller --config {{ k0s_config_dir }}/k0s.yaml --token-file {{ k0s_config_dir }}/controller-token {{ extra_args | default(omit) }}
command: k0s install controller --config {{ k0s_config_dir }}/k0s.yaml --token-file {{ k0s_config_dir }}/controller-token --enable-k0s-cloud-provider=true {{ extra_args | default(omit) }}
changed_when: install_controller_cmd | length > 0

- name: Setup custom environment variables for systemd unit
Expand All @@ -26,7 +26,8 @@
enabled: yes

- name: "Wait for k8s apiserver"
become: true
wait_for:
host: localhost
port: 6443
timeout: 180
timeout: 300
Loading