mirror of
https://github.com/k3s-io/k3s-ansible.git
synced 2026-10-23 03:22:03 +02:00
Wrap api_endpoint with ansible.utils.ipwrap for IPv6 compatibility (#550)
* Add IPv6 support for api_endpoint Signed-off-by: Stéphane Este-Gracias <sestegra@gmail.com> Signed-off-by: Derek Nola <derek.nola@suse.com> * Add ansible.utils requirement Signed-off-by: Stéphane Este-Gracias <sestegra@gmail.com> Signed-off-by: Derek Nola <derek.nola@suse.com> * Add netaddr dependency Signed-off-by: Stéphane Este-Gracias <sestegra@gmail.com> Signed-off-by: Derek Nola <derek.nola@suse.com> --------- Signed-off-by: Stéphane Este-Gracias <sestegra@gmail.com> Signed-off-by: Derek Nola <derek.nola@suse.com> Signed-off-by: Stéphane Este-Gracias <sestegra@gmail.com>
This commit is contained in:
1 parent
cb38fd92e3
commit
445cecb423
6 files changed
+11
-10
No files matched your search
@@ -63,7 +63,7 @@ jobs:
|
||||
|
||||
- name: Install Ansible and dependencies
|
||||
run: |
|
||||
pip install ansible
|
||||
pip install ansible netaddr
|
||||
ansible-galaxy collection install -r collections/requirements.yml
|
||||
|
||||
- name: Verify Inventory
|
||||
@@ -295,7 +295,7 @@ jobs:
|
||||
|
||||
- name: Install Ansible and dependencies
|
||||
run: |
|
||||
pip install ansible
|
||||
pip install ansible netaddr
|
||||
ansible-galaxy collection install -r collections/requirements.yml
|
||||
|
||||
- name: Verify Inventory
|
||||
@@ -461,7 +461,7 @@ jobs:
|
||||
|
||||
- name: Install Ansible and dependencies
|
||||
run: |
|
||||
pip install ansible
|
||||
pip install ansible netaddr
|
||||
ansible-galaxy collection install -r collections/requirements.yml
|
||||
|
||||
- name: Verify Inventory
|
||||
@@ -531,7 +531,7 @@ jobs:
|
||||
|
||||
- name: Install Ansible and dependencies
|
||||
run: |
|
||||
pip install ansible
|
||||
pip install ansible netaddr
|
||||
ansible-galaxy collection install -r collections/requirements.yml
|
||||
|
||||
- name: Verify Inventory
|
||||
|
||||
@@ -20,7 +20,7 @@ on processor architectures:
|
||||
|
||||
## System requirements
|
||||
|
||||
The control node **must** have Ansible 8.0+ (ansible-core 2.15+)
|
||||
The control node **must** have Ansible 8.0+ (ansible-core 2.15+) and the Python `netaddr` library (`pip install netaddr`), required by the `ansible.utils.ipwrap` filter for IPv6 `api_endpoint` support.
|
||||
|
||||
All managed nodes in inventory must have:
|
||||
- Passwordless SSH access
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
collections:
|
||||
- name: community.general
|
||||
- name: ansible.posix
|
||||
- name: ansible.utils
|
||||
@@ -43,7 +43,7 @@
|
||||
INSTALL_K3S_SKIP_START: "true"
|
||||
INSTALL_K3S_SYSTEMD_DIR: "{{ systemd_dir }}"
|
||||
INSTALL_K3S_VERSION: "{{ k3s_version }}"
|
||||
INSTALL_K3S_EXEC: "agent --server https://{{ api_endpoint }}:{{ api_port }} {{ extra_agent_args }}"
|
||||
INSTALL_K3S_EXEC: "agent --server https://{{ api_endpoint | ansible.utils.ipwrap }}:{{ api_port }} {{ extra_agent_args }}"
|
||||
# We overrides the extra_install_envs with required keys from _base_envs on purpose
|
||||
_install_envs: "{{ extra_install_envs | default({}) | combine(_base_envs) }}"
|
||||
changed_when: true
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
- name: Add server URL to server config for joining servers in HA-IC setup
|
||||
when: (groups[server_group] | length) > 1 and inventory_hostname != groups[server_group][0] and not use_external_database
|
||||
ansible.builtin.set_fact:
|
||||
k3s_server_config: "{{ k3s_server_config | combine({'server': 'https://' + api_endpoint + ':' + api_port | string}) }}"
|
||||
k3s_server_config: "{{ k3s_server_config | combine({'server': 'https://' + (api_endpoint | ansible.utils.ipwrap) + ':' + api_port | string}) }}"
|
||||
|
||||
# If the user has provided additional server config, merge it with the generated config
|
||||
- name: Merge user server config with generated server config
|
||||
@@ -216,7 +216,7 @@
|
||||
|
||||
- name: Change server address in kubeconfig on control node
|
||||
ansible.builtin.shell: |
|
||||
KUBECONFIG={{ kubeconfig }} kubectl config set-cluster default --server=https://{{ api_endpoint }}:{{ api_port }}
|
||||
KUBECONFIG={{ kubeconfig }} kubectl config set-cluster default --server=https://{{ api_endpoint | ansible.utils.ipwrap }}:{{ api_port }}
|
||||
delegate_to: 127.0.0.1
|
||||
become: false
|
||||
register: k3s_server_csa_result
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
- name: Add server URL to server config for joining servers in HA-IC setup
|
||||
when: (groups[server_group] | length) > 1 and inventory_hostname != groups[server_group][0] and not use_external_database
|
||||
ansible.builtin.set_fact:
|
||||
k3s_server_config: "{{ k3s_server_config | combine({'server': 'https://' + api_endpoint + ':' + api_port | string}) }}"
|
||||
k3s_server_config: "{{ k3s_server_config | combine({'server': 'https://' + (api_endpoint | ansible.utils.ipwrap) + ':' + api_port | string}) }}"
|
||||
|
||||
# If the user has provided additional server config, merge it with the generated config
|
||||
- name: Merge user server config with generated server config
|
||||
@@ -163,7 +163,7 @@
|
||||
INSTALL_K3S_SKIP_START: "true"
|
||||
INSTALL_K3S_SYSTEMD_DIR: "{{ systemd_dir }}"
|
||||
INSTALL_K3S_VERSION: "{{ k3s_version }}"
|
||||
INSTALL_K3S_EXEC: "agent --server https://{{ api_endpoint }}:{{ api_port }} {{ extra_agent_args }}"
|
||||
INSTALL_K3S_EXEC: "agent --server https://{{ api_endpoint | ansible.utils.ipwrap }}:{{ api_port }} {{ extra_agent_args }}"
|
||||
K3S_TOKEN: "{{ token if token is defined else k3s_upgrade_old_server_token.stdout }}"
|
||||
# We overrides the extra_install_envs with required keys from _base_envs on purpose
|
||||
_install_envs: "{{ extra_install_envs | default({}) | combine(_base_envs) }}"
|
||||
|
||||
Reference in new issue
Block a user