Skip to content

Commit

Permalink
Merge pull request #135 from Yajo/fix-jinja2-native
Browse files Browse the repository at this point in the history
fix: restore clustering and avoid failure with jinja2_native=true
  • Loading branch information
xanmanning authored Jul 21, 2021
2 parents 0c08453 + 4b42a9b commit d2968d5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
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

0 comments on commit d2968d5

Please sign in to comment.