mirror of
https://github.com/PyratLabs/ansible-role-k3s
synced 2024-12-05 02:40:19 +01:00
Renamed k3s_control_node_address -> k3s_registration_address
This commit is contained in:
parent
85576d62ed
commit
4326f4497d
15 changed files with 53 additions and 19 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -9,3 +9,4 @@ vagrant/ubuntu-*.log
|
|||
__pycache__
|
||||
ansible.cfg
|
||||
pyratlabs-issue-dump.txt
|
||||
.cache
|
||||
|
|
17
CHANGELOG.md
17
CHANGELOG.md
|
@ -14,6 +14,23 @@
|
|||
---
|
||||
-->
|
||||
|
||||
## 2021-03-14, v2.8.0
|
||||
|
||||
Happy π day!
|
||||
|
||||
### Notable changes
|
||||
|
||||
- Updated GitHub Actions, resolved linting errors.
|
||||
- Renamed `k3s_control_node_address` -> `k3s_registration_address`
|
||||
|
||||
### Breaking changes
|
||||
|
||||
- A task has been added to rename `k3s_control_node_address` to
|
||||
`k3s_registration_address` for any users still using this variable name,
|
||||
however this might still break something.
|
||||
|
||||
---
|
||||
|
||||
## 2021-02-28, v2.7.1
|
||||
|
||||
### Notable changes
|
||||
|
|
|
@ -67,7 +67,7 @@ consistency. These are generally cluster-level configuration.
|
|||
| `k3s_release_version` | Use a specific version of k3s, eg. `v0.2.0`. Specify `false` for stable. | `false` |
|
||||
| `k3s_config_file` | Location of the k3s configuration file. | `/etc/rancher/k3s/config.yaml` |
|
||||
| `k3s_build_cluster` | When multiple play hosts are available, attempt to cluster. Read notes below. | `true` |
|
||||
| `k3s_control_node_address` | Use a specific control node address. IP or FQDN. | NULL |
|
||||
| `k4s_registration_address` | Fixed registration address for nodes. IP or FQDN. | NULL |
|
||||
| `k3s_github_url` | Set the GitHub URL to install k3s from. | https://github.com/k3s-io/k3s |
|
||||
| `k3s_install_dir` | Installation directory for k3s. | `/usr/local/bin` |
|
||||
| `k3s_install_hard_links` | Install using hard links rather than symbolic links. | `false` |
|
||||
|
@ -314,7 +314,7 @@ stable release:
|
|||
```yaml
|
||||
- hosts: k3s_nodes
|
||||
vars:
|
||||
k3s_control_node_address: loadbalancer # Typically a load balancer.
|
||||
k3s_registration_address: loadbalancer # Typically a load balancer.
|
||||
k3s_server:
|
||||
datastore-endpoint: "postgres://postgres:verybadpass@database:5432/postgres?sslmode=disable"
|
||||
pre_tasks:
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
galaxy_info:
|
||||
role_name: k3s
|
||||
namespace: xanmanning
|
||||
author: Xan Manning
|
||||
description: Ansible role for installing k3s as either a standalone server or HA cluster
|
||||
company: Pyrat Ltd.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
become: true
|
||||
vars:
|
||||
molecule_is_test: true
|
||||
k3s_control_node_address: loadbalancer
|
||||
k3s_registration_address: loadbalancer
|
||||
k3s_server:
|
||||
datastore-endpoint: "postgres://postgres:verybadpass@database:5432/postgres?sslmode=disable"
|
||||
pre_tasks:
|
||||
|
|
|
@ -79,7 +79,8 @@
|
|||
- import_tasks: ../validate/state/control-plane.yml
|
||||
when: not k3s_skip_validation
|
||||
|
||||
- meta: flush_handlers
|
||||
- name: Flush Handlers
|
||||
meta: flush_handlers
|
||||
|
||||
- import_tasks: ../validate/state/nodes.yml
|
||||
when: not k3s_skip_validation
|
||||
|
|
|
@ -8,4 +8,5 @@
|
|||
- restart docker
|
||||
become: "{{ k3s_become_for_package_install | ternary(true, false, k3s_become_for_all) }}"
|
||||
|
||||
- meta: flush_handlers
|
||||
- name: Flush Handlers
|
||||
meta: flush_handlers
|
||||
|
|
|
@ -12,4 +12,5 @@
|
|||
- restart docker
|
||||
become: "{{ k3s_become_for_package_install | ternary(true, false, k3s_become_for_all) }}"
|
||||
|
||||
- meta: flush_handlers
|
||||
- name: Flush Handlers
|
||||
meta: flush_handlers
|
||||
|
|
|
@ -12,4 +12,5 @@
|
|||
- restart docker
|
||||
become: "{{ k3s_become_for_package_install | ternary(true, false, k3s_become_for_all) }}"
|
||||
|
||||
- meta: flush_handlers
|
||||
- name: Flush Handlers
|
||||
meta: flush_handlers
|
||||
|
|
|
@ -12,4 +12,5 @@
|
|||
- restart docker
|
||||
become: "{{ k3s_become_for_package_install | ternary(true, false, k3s_become_for_all) }}"
|
||||
|
||||
- meta: flush_handlers
|
||||
- name: Flush Handlers
|
||||
meta: flush_handlers
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
or (k3s_primary_control_node and k3s_controller_list | length > 1))
|
||||
- not ansible_check_mode
|
||||
|
||||
- meta: flush_handlers
|
||||
- name: Flush Handlers
|
||||
meta: flush_handlers
|
||||
|
||||
- include_tasks: install-k3s-node.yml
|
||||
when: k3s_build_cluster
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
k3s_build_cluster: false
|
||||
when:
|
||||
- ansible_play_hosts_all | length < 2
|
||||
- k3s_control_node_address is not defined
|
||||
- k3s_registration_address is not defined
|
||||
|
||||
- name: Ensure k3s control node fact is set
|
||||
ansible.builtin.set_fact:
|
||||
|
@ -93,13 +93,21 @@
|
|||
check_mode: false
|
||||
when: k3s_control_delegate is not defined
|
||||
|
||||
- name: Ensure the control node address is registered in Ansible
|
||||
- name: Ensure the node registration address is defined from k3s_control_node_address
|
||||
ansible.builtin.set_fact:
|
||||
k3s_control_node_address: "{{ hostvars[k3s_control_delegate].ansible_host | default(hostvars[k3s_control_delegate].ansible_fqdn) }}"
|
||||
k3s_registration_address: "{{ k3s_control_node_address }}"
|
||||
check_mode: false
|
||||
when: k3s_control_node_address is not defined
|
||||
when: k3s_control_node_address is defined
|
||||
|
||||
when: k3s_control_node_address is not defined
|
||||
- name: Ensure the node registration address is defined
|
||||
ansible.builtin.set_fact:
|
||||
k3s_registration_address: "{{ hostvars[k3s_control_delegate].ansible_host | default(hostvars[k3s_control_delegate].ansible_fqdn) }}"
|
||||
check_mode: false
|
||||
when:
|
||||
- k3s_registration_address is not defined
|
||||
- k3s_control_node_address is not defined
|
||||
|
||||
when: k3s_registration_address is not defined
|
||||
or k3s_control_delegate is not defined
|
||||
|
||||
- name: Ensure k3s_runtime_config is set for control plane
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
- ('docker' in k3s_runtime_config and k3s_runtime_config.docker)
|
||||
- ('rootless' not in k3s_runtime_config or not k3s_runtime_config.rootless)
|
||||
|
||||
- meta: flush_handlers
|
||||
- name: Flush Handlers
|
||||
meta: flush_handlers
|
||||
|
||||
- import_tasks: build/download-k3s.yml
|
||||
|
||||
|
@ -49,4 +50,4 @@
|
|||
when:
|
||||
- k3s_build_cluster is defined
|
||||
- k3s_build_cluster
|
||||
- k3s_control_node_address is defined
|
||||
- k3s_registration_address is defined
|
||||
|
|
|
@ -29,7 +29,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) and k3s_controller_list | length > 1 %}
|
||||
--server https://{{ k3s_control_node_address }}:{{ k3s_control_plane_port | default(6443) }}
|
||||
--server https://{{ k3s_registration_address }}:{{ k3s_control_plane_port | default(6443) }}
|
||||
--token-file {{ k3s_token_location }}
|
||||
{% endif %}
|
||||
{% if k3s_server is defined %}
|
||||
|
@ -37,7 +37,7 @@ ExecStart={{ k3s_install_dir }}/k3s
|
|||
{% endif %}
|
||||
{% else %}
|
||||
agent
|
||||
--server https://{{ k3s_control_node_address }}:{{ k3s_control_plane_port | default(6443) }}
|
||||
--server https://{{ k3s_registration_address }}:{{ k3s_control_plane_port | default(6443) }}
|
||||
--token-file {{ k3s_token_location }}
|
||||
{% if k3s_agent is defined %}
|
||||
--config {{ k3s_config_file }}
|
||||
|
|
|
@ -107,7 +107,7 @@ k3s_ensure_directories_exist:
|
|||
# Config items that should not appear in k3s_server or k3s_agent
|
||||
k3s_config_exclude:
|
||||
- setting: server
|
||||
correction: k3s_control_node_address
|
||||
correction: k3s_registration_address
|
||||
- setting: cluster-init
|
||||
correction: k3s_etcd_datastore
|
||||
- setting: token
|
||||
|
|
Loading…
Reference in a new issue