Reorder task files

- Docker tasks moved into a separate directory for ease of removal #67
  - Bugfix: Control plane on alternate port didn't work.
  - Validation tasks grouped
This commit is contained in:
Xan Manning 2020-12-20 17:26:45 +00:00
parent 6db36d5d95
commit 440d7f51cf
36 changed files with 29 additions and 21 deletions

View File

@ -69,10 +69,10 @@
when: k3s_control_node and not k3s_primary_control_node
become: "{{ k3s_become_for_systemd | ternary(true, false, k3s_become_for_all) }}"
- import_tasks: ../validate/check-control-plane.yml
- import_tasks: ../validate/state/control-plane.yml
when: not k3s_skip_validation
- meta: flush_handlers
- import_tasks: ../validate/check-cluster-nodes-ready.yml
- import_tasks: ../validate/state/nodes.yml
when: not k3s_skip_validation

View File

@ -16,6 +16,11 @@
k3s_primary_control_node: "{{ 'false' if k3s_build_cluster else 'true' }}"
when: k3s_primary_control_node is not defined
- name: Ensure k3s control plane port is captures
ansible.builtin.set_fact:
k3s_control_plane_port: "{{ k3s_runtime_config['https-listen-port'] | default(6443) }}"
delegate_to: k3s_primary_control_node
- name: Ensure a k3s control node is defined if none are found in ansible_play_hosts_all
block:
- name: Set the control host

View File

@ -17,12 +17,12 @@
- name: Ensure docker installation tasks are run
block:
- include_tasks: build/install-docker-prerequisites-{{ ansible_os_family | lower }}.yml
- include_tasks: build/docker/{{ ansible_os_family | lower }}/install-prerequisites.yml
- import_tasks: build/install-docker.yml
- import_tasks: build/docker/install.yml
when: ansible_distribution | replace(" ", "-") | lower not in ['amazon', 'suse', 'opensuse-leap', 'archlinux']
- include_tasks: build/install-docker-{{ ansible_distribution | replace(" ", "-") | lower }}.yml
- include_tasks: build/docker/{{ ansible_distribution | replace(" ", "-") | lower }}/install.yml
when: ansible_distribution | replace(" ", "-") | lower in ['amazon', 'suse', 'opensuse-leap', 'archlinux']
when: ('docker' in k3s_runtime_config and k3s_runtime_config.docker)

View File

@ -9,16 +9,16 @@
- name: Ensure docker uninstall tasks are run
block:
- import_tasks: teardown/uninstall-docker.yml
- import_tasks: teardown/docker/uninstall.yml
when: ansible_distribution | replace(" ", "-") | lower not in ['amazon', 'suse', 'opensuse-leap', 'archlinux']
- include_tasks: teardown/uninstall-docker-{{ ansible_distribution | replace(" ", "-") | lower }}.yml
- include_tasks: teardown/docker/{{ ansible_distribution | replace(" ", "-") | lower }}/uninstall.yml
when: ansible_distribution | replace(" ", "-") | lower in ['amazon', 'suse', 'opensuse-leap', 'archlinux']
- include_tasks: teardown/uninstall-docker-prerequisites-{{ ansible_os_family | lower }}.yml
- include_tasks: teardown/docker/{{ ansible_os_family | lower }}/uninstall-prerequisites.yml
when: ('docker' in k3s_runtime_config and k3s_runtime_config.docker)
and ('rootless' not in k3s_runtime_config or not k3s_runtime_config.rootless)
- import_tasks: validate/check-uninstalled.yml
- import_tasks: validate/state/uninstalled.yml
when: not k3s_skip_validation

View File

@ -32,7 +32,7 @@
- name: Ensure facts are written to disk
ansible.builtin.copy:
dest: pyratlabs-issue-dump.txt
dest: "{{ playbook_dir }}/pyratlabs-issue-dump.txt"
content: |
# Begin ANSIBLE VERSION
{{ check_ansible_version.stdout }}

View File

@ -1,12 +1,12 @@
---
- import_tasks: check-variables.yml
- import_tasks: configuration/variables.yml
- import_tasks: check-experimental-variables.yml
- import_tasks: configuration/experimental-variables.yml
- import_tasks: check-unsupported-rootless.yml
- import_tasks: configuration/unsupported-rootless.yml
when: ("rootless" in k3s_runtime_config)
and k3s_runtime_config.rootless
- import_tasks: check-control-count.yml
- import_tasks: configuration/control-node-count.yml
when: k3s_build_cluster is defined and k3s_build_cluster

View File

@ -1,5 +1,5 @@
---
- import_tasks: check-control-plane.yml
- import_tasks: state/control-plane.yml
- import_tasks: check-cluster-nodes-ready.yml
- import_tasks: state/nodes.yml

View File

@ -8,16 +8,16 @@
success_msg: "k3s_state is valid."
when: k3s_state is defined
- import_tasks: check-environment.yml
- import_tasks: environment/local/packages.yml
when: not k3s_skip_validation
and not k3s_skip_env_checks
- include_tasks: check-target-environment-packages.yml
- include_tasks: environment/remote/packages.yml
loop: "{{ k3s_check_packages }}"
loop_control:
loop_var: package
when: not k3s_skip_validation
and not k3s_skip_env_checks
- include_tasks: issue-data.yml
- include_tasks: environment/local/issue-data.yml
when: pyratlabs_issue_controller_dump is defined and pyratlabs_issue_controller_dump

View File

@ -17,7 +17,7 @@ ExecStart={{ k3s_install_dir }}/k3s
{% if k3s_control_node %}
server
{% if (k3s_etcd_datastore is defined and k3s_etcd_datastore) and (k3s_primary_control_node is not defined or not k3s_primary_control_node) %}
--server https://{{ k3s_control_node_address }}:{{ k3s_runtime_config['https-listen-port'] | default(6443) }}
--server https://{{ k3s_control_node_address }}:{{ k3s_control_plane_port | default(6443) }}
--token-file {{ k3s_token_location }}
{% endif %}
{% if k3s_server is defined %}
@ -25,7 +25,7 @@ ExecStart={{ k3s_install_dir }}/k3s
{% endif %}
{% else %}
agent
--server https://{{ k3s_control_node_address }}:{{ k3s_runtime_config['https-listen-port'] | default(6443) }}
--server https://{{ k3s_control_node_address }}:{{ k3s_control_plane_port | default(6443) }}
--token-file {{ k3s_token_location }}
{% if k3s_agent is defined %}
--config {{ k3s_config_file }}

View File

@ -55,6 +55,9 @@ k3s_runtime_config: "{{ (k3s_server | default({})) | combine (k3s_agent | defaul
# Empty array for counting the number of control plane nodes
k3s_controller_count: []
# Control plane port default
k3s_control_plane_port: 6443
# Default to the "system" systemd context, this will be "user" when running rootless
k3s_systemd_context: system