mirror of
https://github.com/PyratLabs/ansible-role-k3s.git
synced 2024-11-22 11:48:22 +01:00
Fixing ansible-linting, exclude name check for Travis-CI
This release also fixes: - #38 : removing the --disable-agent option. Please use node taints. - #39 : clarified where jmespath should be installed in README.md
This commit is contained in:
parent
230aaa110c
commit
c743df868b
2
.ansible-lint
Normal file
2
.ansible-lint
Normal file
@ -0,0 +1,2 @@
|
||||
skip_list:
|
||||
- '106'
|
@ -7,7 +7,7 @@ Kubernetes") as either a standalone server or cluster.
|
||||
|
||||
## Requirements
|
||||
|
||||
The control host requires the following Python dependencies:
|
||||
The host you're running Ansible from requires the following Python dependencies:
|
||||
|
||||
- `jmespath >= 0.9.0`
|
||||
|
||||
@ -58,7 +58,6 @@ consistency.
|
||||
| `k3s_use_experimental` | Allow the use of experimental features in k3s. | `false` |
|
||||
| `k3s_use_unsupported_config` | Allow the use of unsupported configurations in k3s. | `false` |
|
||||
| `k3s_non_root` | Install k3s as non-root user. See notes below. | `false` |
|
||||
| `k3s_control_workers` | Are control hosts also workers? | `true` |
|
||||
| `k3s_cluster_cidr` | Network CIDR to use for pod IPs | 10.42.0.0/16 |
|
||||
| `k3s_service_cidr` | Network CIDR to use for service IPs | 10.43.0.0/16 |
|
||||
| `k3s_control_node_address` | Use a specific control node address. IP or FQDN. | _NULL_ |
|
||||
|
@ -56,9 +56,6 @@ k3s_datastore_endpoint: false
|
||||
# Use DQLite for HA Datastore? (EXPERIMENTAL)
|
||||
k3s_dqlite_datastore: false
|
||||
|
||||
# Are control hosts also worker nodes?
|
||||
k3s_control_workers: true
|
||||
|
||||
# HTTPS Listening port
|
||||
k3s_https_port: 6443
|
||||
|
||||
|
@ -8,6 +8,5 @@
|
||||
k3s_https_port: 26443
|
||||
k3s_flannel_backend: wireguard
|
||||
k3s_cluster_domain: examplecluster.local
|
||||
k3s_control_workers: false
|
||||
roles:
|
||||
- role: xanmanning.k3s
|
||||
|
@ -14,7 +14,6 @@
|
||||
k3s_disable_scheduler: true
|
||||
k3s_disable_cloud_controller: true
|
||||
k3s_disable_network_policy: true
|
||||
k3s_control_workers: false
|
||||
k3s_node_labels:
|
||||
- foo: bar
|
||||
- hello: world
|
||||
|
@ -23,6 +23,7 @@
|
||||
template:
|
||||
src: k3s.service.j2
|
||||
dest: "{{ k3s_systemd_unit_directory }}/k3s.service"
|
||||
mode: 0644
|
||||
become: "{{ k3s_become_for_systemd | ternary(true, false, k3s_become_for_all) }}"
|
||||
notify:
|
||||
- reload systemd
|
||||
|
@ -32,6 +32,7 @@
|
||||
file:
|
||||
path: "{{ k3s_install_dir }}"
|
||||
state: directory
|
||||
mode: 0755
|
||||
|
||||
- name: Ensure k3s binary is downloaded
|
||||
get_url:
|
||||
|
@ -6,6 +6,7 @@
|
||||
dest: "{{ k3s_install_dir }}/k3s"
|
||||
state: "{{ 'hard' if k3s_install_hard_links else 'link' }}"
|
||||
force: "{{ k3s_install_hard_links }}"
|
||||
mode: 0755
|
||||
when: ((k3s_control_node and k3s_controller_count | length == 1)
|
||||
or (k3s_primary_control_node and k3s_controller_count | length > 1)) and not ansible_check_mode
|
||||
notify:
|
||||
@ -16,12 +17,13 @@
|
||||
file:
|
||||
path: "{{ k3s_systemd_unit_directory }}"
|
||||
state: directory
|
||||
recurse: true
|
||||
mode: 0755
|
||||
|
||||
- name: Ensure k3s service unit file is present on control plane
|
||||
template:
|
||||
src: k3s.service.j2
|
||||
dest: "{{ k3s_systemd_unit_directory }}/k3s.service"
|
||||
mode: 0644
|
||||
when: (k3s_control_node and k3s_controller_count | length == 1)
|
||||
or (k3s_primary_control_node and k3s_controller_count | length > 1)
|
||||
notify:
|
||||
@ -51,6 +53,7 @@
|
||||
dest: "{{ k3s_install_dir }}/{{ item }}"
|
||||
state: "{{ 'hard' if k3s_install_hard_links else 'link' }}"
|
||||
force: "{{ k3s_install_hard_links }}"
|
||||
mode: 0755
|
||||
notify:
|
||||
- restart k3s
|
||||
loop:
|
||||
|
@ -4,6 +4,7 @@
|
||||
file:
|
||||
state: directory
|
||||
path: "{{ k3s_server_manifests_dir }}"
|
||||
mode: 0755
|
||||
when: k3s_server_manifests_templates | length > 0
|
||||
|
||||
# https://rancher.com/docs/k3s/latest/en/advanced/#auto-deploying-manifests
|
||||
@ -11,4 +12,5 @@
|
||||
template:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ k3s_server_manifests_dir }}/{{ item | basename | replace('.j2','') }}"
|
||||
mode: 0644
|
||||
loop: "{{ k3s_server_manifests_templates }}"
|
||||
|
@ -47,6 +47,7 @@
|
||||
P_{{ hostvars[item].k3s_primary_control_node | default(False) }}
|
||||
create: true
|
||||
regexp: "^{{ item }} @@@ {{ hostvars[item].ansible_host | default(hostvars[item].ansible_fqdn) }}"
|
||||
mode: 0600
|
||||
loop: "{{ play_hosts }}"
|
||||
check_mode: false
|
||||
when: hostvars[item].k3s_control_node is defined
|
||||
|
@ -17,21 +17,15 @@
|
||||
|
||||
- include_tasks: build/install-docker-prerequisites-{{ ansible_os_family | lower }}.yml
|
||||
when: k3s_use_docker
|
||||
and ((k3s_control_workers)
|
||||
or (not k3s_control_workers and not k3s_control_node))
|
||||
and (k3s_non_root is not defined or not k3s_non_root)
|
||||
|
||||
- import_tasks: build/install-docker.yml
|
||||
when: k3s_use_docker
|
||||
and ((k3s_control_workers)
|
||||
or (not k3s_control_workers and not k3s_control_node))
|
||||
and ansible_distribution | replace(" ", "-") | lower not in ['amazon', 'suse', 'opensuse-leap']
|
||||
and (k3s_non_root is not defined or not k3s_non_root)
|
||||
|
||||
- include_tasks: build/install-docker-{{ ansible_distribution | replace(" ", "-") | lower }}.yml
|
||||
when: k3s_use_docker
|
||||
and ((k3s_control_workers)
|
||||
or (not k3s_control_workers and not k3s_control_node))
|
||||
and ansible_distribution | replace(" ", "-") | lower in ['amazon', 'suse', 'opensuse-leap']
|
||||
and (k3s_non_root is not defined or not k3s_non_root)
|
||||
|
||||
|
@ -8,22 +8,16 @@
|
||||
|
||||
- import_tasks: teardown/uninstall-docker.yml
|
||||
when: k3s_use_docker
|
||||
and ((k3s_control_workers)
|
||||
or (not k3s_control_workers and not k3s_control_node))
|
||||
and ansible_distribution | replace(" ", "-") | lower not in ['amazon', 'suse', 'opensuse-leap']
|
||||
and (k3s_non_root is not defined or not k3s_non_root)
|
||||
|
||||
- include_tasks: teardown/uninstall-docker-{{ ansible_distribution | replace(" ", "-") | lower }}.yml
|
||||
when: k3s_use_docker
|
||||
and ((k3s_control_workers)
|
||||
or (not k3s_control_workers and not k3s_control_node))
|
||||
and ansible_distribution | replace(" ", "-") | lower in ['amazon', 'suse', 'opensuse-leap']
|
||||
and (k3s_non_root is not defined or not k3s_non_root)
|
||||
|
||||
- include_tasks: teardown/uninstall-docker-prerequisites-{{ ansible_os_family | lower }}.yml
|
||||
when: k3s_use_docker
|
||||
and ((k3s_control_workers)
|
||||
or (not k3s_control_workers and not k3s_control_node))
|
||||
and (k3s_non_root is not defined or not k3s_non_root)
|
||||
|
||||
- import_tasks: validate/check-uninstalled.yml
|
||||
|
@ -11,7 +11,7 @@ ExecStartPre=-/sbin/modprobe overlay
|
||||
{% filter replace('\n', ' ') %}
|
||||
ExecStart={{ k3s_install_dir }}/k3s
|
||||
{% if k3s_control_node %}
|
||||
server{{ ' --disable-agent' if not k3s_control_workers else '' }}
|
||||
server
|
||||
{% if k3s_bind_address is defined %}
|
||||
--bind-address {{ k3s_bind_address }}
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user