diff --git a/README.md b/README.md index b6c2e31..0129306 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ The host you're running Ansible from requires the following Python dependencies: This role has been tested on Ansible 2.7.0+ against the following Linux Distributions: - Amazon Linux 2 + - Archlinux - CentOS 8 - CentOS 7 - Debian 9 diff --git a/defaults/main.yml b/defaults/main.yml index 75be6b3..b32f696 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -4,7 +4,7 @@ # Global/Cluster Configuration ## -# k3s state, options: installed, started, stopped, restarted, validated +# k3s state, options: installed, started, stopped, restarted, uninstalled, validated # (default: installed) k3s_state: installed diff --git a/meta/main.yml b/meta/main.yml index b1f24ef..80714b1 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -36,6 +36,9 @@ galaxy_info: # platforms is a list of platforms, and each platform has a name and a list of versions. # platforms: + - name: Archlinux + versions: + - all - name: EL versions: - 7 diff --git a/tasks/build/install-docker-archlinux.yml b/tasks/build/install-docker-archlinux.yml new file mode 100644 index 0000000..5f72243 --- /dev/null +++ b/tasks/build/install-docker-archlinux.yml @@ -0,0 +1,15 @@ +--- + +- name: Ensure docker is installed using Pacman + pacman: + name: docker + state: present + register: ensure_docker_prerequisites_installed + until: ensure_docker_prerequisites_installed is succeeded + retries: 3 + delay: 10 + notify: + - restart docker + become: "{{ k3s_become_for_package_install | ternary(true, false, k3s_become_for_all) }}" + +- meta: flush_handlers diff --git a/tasks/build/install-docker-prerequisites-archlinux.yml b/tasks/build/install-docker-prerequisites-archlinux.yml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/tasks/build/install-docker-prerequisites-archlinux.yml @@ -0,0 +1 @@ +--- diff --git a/tasks/state-installed.yml b/tasks/state-installed.yml index 66a3ad6..e1f30e4 100644 --- a/tasks/state-installed.yml +++ b/tasks/state-installed.yml @@ -20,10 +20,10 @@ - include_tasks: build/install-docker-prerequisites-{{ ansible_os_family | lower }}.yml - import_tasks: build/install-docker.yml - when: ansible_distribution | replace(" ", "-") | lower not in ['amazon', 'suse', 'opensuse-leap'] + when: ansible_distribution | replace(" ", "-") | lower not in ['amazon', 'suse', 'opensuse-leap', 'archlinux'] - include_tasks: build/install-docker-{{ ansible_distribution | replace(" ", "-") | lower }}.yml - when: ansible_distribution | replace(" ", "-") | lower in ['amazon', 'suse', 'opensuse-leap'] + when: ansible_distribution | replace(" ", "-") | lower in ['amazon', 'suse', 'opensuse-leap', 'archlinux'] when: ('docker' in k3s_runtime_config and k3s_runtime_config.docker) and ('rootless' not in k3s_runtime_config or not k3s_runtime_config.rootless) diff --git a/tasks/state-uninstalled.yml b/tasks/state-uninstalled.yml index 9a94026..11d1d6c 100644 --- a/tasks/state-uninstalled.yml +++ b/tasks/state-uninstalled.yml @@ -10,10 +10,10 @@ block: - import_tasks: teardown/uninstall-docker.yml - when: ansible_distribution | replace(" ", "-") | lower not in ['amazon', 'suse', 'opensuse-leap'] + when: ansible_distribution | replace(" ", "-") | lower not in ['amazon', 'suse', 'opensuse-leap', 'archlinux'] - include_tasks: teardown/uninstall-docker-{{ ansible_distribution | replace(" ", "-") | lower }}.yml - when: ansible_distribution | replace(" ", "-") | lower in ['amazon', 'suse', 'opensuse-leap'] + when: ansible_distribution | replace(" ", "-") | lower in ['amazon', 'suse', 'opensuse-leap', 'archlinux'] - include_tasks: teardown/uninstall-docker-prerequisites-{{ ansible_os_family | lower }}.yml diff --git a/tasks/teardown/drain-and-remove-nodes.yml b/tasks/teardown/drain-and-remove-nodes.yml index f6407b0..f6f12df 100644 --- a/tasks/teardown/drain-and-remove-nodes.yml +++ b/tasks/teardown/drain-and-remove-nodes.yml @@ -19,7 +19,7 @@ become: "{{ k3s_become_for_kubectl | ternary(true, false, k3s_become_for_all) }}" - name: Ensure uninstalled nodes are drained - command: "{{ k3s_install_dir }}/kubectl drain {{ item }} --ignore-daemonsets" + command: "{{ k3s_install_dir }}/kubectl drain {{ item }} --ignore-daemonsets --delete-local-data" delegate_to: "{{ k3s_control_delegate }}" run_once: true when: item in kubectl_get_nodes_result.stdout diff --git a/tasks/teardown/uninstall-docker-archlinux.yml b/tasks/teardown/uninstall-docker-archlinux.yml new file mode 100644 index 0000000..2dd97fc --- /dev/null +++ b/tasks/teardown/uninstall-docker-archlinux.yml @@ -0,0 +1,11 @@ +--- + +- name: Ensure docker is uninstalled using Pacman + pacman: + name: docker + state: absent + register: ensure_docker_uninstalled + until: ensure_docker_uninstalled is succeeded + retries: 3 + delay: 10 + become: "{{ k3s_become_for_uninstall | ternary(true, false, k3s_become_for_all) }}"