Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: restore clustering and avoid failure with jinja2_native=true #135

Merged
merged 2 commits into from
Jul 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions tasks/build/preconfigure-k3s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

- name: Ensure k3s control node fact is set
ansible.builtin.set_fact:
k3s_control_node: "{{ 'false' if k3s_build_cluster else 'true' }}"
k3s_control_node: "{{ false if k3s_build_cluster else true }}"
when: k3s_control_node is not defined

- name: Ensure k3s primary control node fact is set
ansible.builtin.set_fact:
k3s_primary_control_node: "{{ 'false' if k3s_build_cluster else 'true' }}"
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 captured
Expand Down Expand Up @@ -69,11 +69,11 @@
{% filter replace('\n', ' ') %}
{{ host }}
@@@
{{ hostvars[host].ansible_host | default(hostvars[host].ansible_fqdn) }}
{{ hostvars[host].ansible_host | default(hostvars[host].ansible_fqdn) | string }}
@@@
C_{{ hostvars[host].k3s_control_node }}
C_{{ hostvars[host].k3s_control_node | string }}
@@@
P_{{ hostvars[host].k3s_primary_control_node | default(False) }}
P_{{ hostvars[host].k3s_primary_control_node | default(False) | string }}
{% endfilter %}
@@@ END:{{ host }}
{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions templates/k3s.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ 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_registration_address }}:{{ k3s_control_plane_port | default(6443) }}
--server https://{{ k3s_registration_address }}:{{ k3s_control_plane_port | default(6443) | string }}
--token-file {{ k3s_token_location }}
{% endif %}
{% if k3s_server is defined %}
--config {{ k3s_config_file }}
{% endif %}
{% else %}
agent
--server https://{{ k3s_registration_address }}:{{ k3s_control_plane_port | default(6443) }}
--server https://{{ k3s_registration_address }}:{{ k3s_control_plane_port | default(6443) | string }}
--token-file {{ k3s_token_location }}
{% if k3s_agent is defined %}
--config {{ k3s_config_file }}
Expand Down