fix: systemd env vars and openrc service file

This commit is contained in:
Xan Manning 2022-06-15 22:31:49 +00:00
parent e6cb2a91e8
commit 6f1cb8e904
4 changed files with 9 additions and 7 deletions

View file

@ -4,13 +4,14 @@
become: true become: true
vars: vars:
molecule_is_test: true molecule_is_test: true
k3s_release_version: latest k3s_release_version: v1.22
k3s_build_cluster: false k3s_build_cluster: false
k3s_control_token: 55ba04e5-e17d-4535-9170-3e4245453f4d
k3s_install_dir: /opt/k3s/bin k3s_install_dir: /opt/k3s/bin
k3s_config_file: /opt/k3s/etc/k3s.yaml k3s_config_file: /opt/k3s/etc/k3s_config.yaml
k3s_server: # k3s_server:
data-dir: /var/lib/k3s-io # data-dir: /var/lib/k3s-io
default-local-storage-path: /var/lib/k3s-io/local-storage # default-local-storage-path: /var/lib/k3s-io/local-storage
k3s_agent: k3s_agent:
snapshotter: native snapshotter: native
k3s_server_manifests_templates: k3s_server_manifests_templates:

View file

@ -7,5 +7,6 @@
k3s_server: "{{ lookup('file', 'k3s_server.yml') | from_yaml }}" k3s_server: "{{ lookup('file', 'k3s_server.yml') | from_yaml }}"
k3s_agent: "{{ lookup('file', 'k3s_agent.yml') | from_yaml }}" k3s_agent: "{{ lookup('file', 'k3s_agent.yml') | from_yaml }}"
k3s_airgap: true k3s_airgap: true
k3s_release_version: latest
roles: roles:
- role: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" - role: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"

View file

@ -25,7 +25,7 @@ command_args="{% filter regex_replace('\s+', ' ') %}
{% if k3s_server is defined %} {% if k3s_server is defined %}
--config {{ k3s_config_file }} --config {{ k3s_config_file }}
{% endif %} {% endif %}
{% if k3s_control_node and not k3s_primary_control_node %} {% if not k3s_primary_control_node or k3s_control_token is defined %}
--token-file {{ k3s_token_location }} --token-file {{ k3s_token_location }}
{% endif %} {% endif %}
{% else %} {% else %}

View file

@ -20,7 +20,7 @@ After={{ after_unit }}
Type={{ 'notify' if k3s_control_node else 'exec' }} Type={{ 'notify' if k3s_control_node else 'exec' }}
{% if k3s_service_env_vars is defined and k3s_service_env_vars is iterable %} {% if k3s_service_env_vars is defined and k3s_service_env_vars is iterable %}
{% for env_var in k3s_service_env_vars %} {% for env_var in k3s_service_env_vars %}
Environment={{ env_var }}={{ k3s_service_env_vars[env_var] }} Environment={{ env_var }}="{{ k3s_service_env_vars[env_var] }}"
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if k3s_service_env_file is defined and k3s_service_env_file %} {% if k3s_service_env_file is defined and k3s_service_env_file %}