Skip to content

Commit

Permalink
Add support for Service Envs (#237)
Browse files Browse the repository at this point in the history
* Add support for service ENVs
* Rename PR template
Signed-off-by: Derek Nola <[email protected]>
  • Loading branch information
dereknola committed Nov 9, 2023
1 parent e864933 commit e6233d9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
File renamed without changes.
5 changes: 3 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def provision(vm, role, node_num)

vm.provision "ansible", run: 'once' do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "playbook/site.yml"
ansible.playbook = "playbook/debug.yml"
ansible.groups = {
"server" => NODE_ROLES.grep(/^server/),
"agent" => NODE_ROLES.grep(/^agent/),
Expand All @@ -32,7 +32,8 @@ def provision(vm, role, node_num)
# Required to use the private network configured above
extra_server_args: "--node-external-ip #{node_ip} --flannel-iface eth1",
extra_agent_args: "--node-external-ip #{node_ip} --flannel-iface eth1",
k3s_server_location: "/data/k3s",
# Not needed, left as reference for ruby-ansible list syntax
# extra_service_envs: [ "NO_PROXY='localhost'" ],
}
end
end
Expand Down
1 change: 1 addition & 0 deletions inventory-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ k3s_cluster:
# api_port: 6443

Check warning on line 23 in inventory-sample.yml

View workflow job for this annotation

GitHub Actions / Lint

yaml[comments-indentation]

Comment not indented like content

Check warning on line 23 in inventory-sample.yml

View workflow job for this annotation

GitHub Actions / Lint

23:5 [comments-indentation] comment not indented like content
# k3s_server_location: /var/lib/rancher/k3s
# systemd_dir: /etc/systemd/system
# extra_service_envs: [ 'ENV_VAR1=VALUE1', 'ENV_VAR2=VALUE2' ]
7 changes: 7 additions & 0 deletions roles/k3s/server/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
group: root
mode: 0644

- name: Add service enviorment variables
when: extra_service_envs is defined
ansible.builtin.lineinfile:
path: "{{ systemd_dir }}/k3s.service.env"
line: "{{ item }}"
with_items: "{{ extra_service_envs }}"

- name: Enable and check K3s service
ansible.builtin.systemd:
name: k3s
Expand Down

0 comments on commit e6233d9

Please sign in to comment.