* Apply "become" on roles instead of plays This leads to facts being gathered for the "regular" login user, instead of root. * Do not rely on ansible_user Instead of reading ansible_user (which may or may not be defined), this patch lets the roles rely on Ansible facts [1]. [1]: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_vars_facts.html
12 lines
359 B
YAML
12 lines
359 B
YAML
---
|
|
server_init_args: >-
|
|
{% if groups['master'] | length > 1 %}
|
|
{% if ansible_hostname == hostvars[groups['master'][0]]['ansible_hostname'] %}
|
|
--cluster-init
|
|
{% else %}
|
|
--server https://{{ hostvars[groups['master'][0]].k3s_node_ip }}:6443
|
|
{% endif %}
|
|
--token {{ k3s_token }}
|
|
{% endif %}
|
|
{{ extra_server_args | default('') }}
|