mirror of
https://github.com/k3s-io/k3s-ansible.git
synced 2025-12-25 00:12:37 +01:00
Support K3s config yaml (#252)
* Support K3s config yaml Signed-off-by: Derek Nola <derek.nola@suse.com>
This commit is contained in:
5
Vagrantfile
vendored
5
Vagrantfile
vendored
@@ -32,8 +32,11 @@ def provision(vm, role, node_num)
|
|||||||
# Required to use the private network configured above
|
# Required to use the private network configured above
|
||||||
extra_server_args: "--node-external-ip #{node_ip} --flannel-iface eth1",
|
extra_server_args: "--node-external-ip #{node_ip} --flannel-iface eth1",
|
||||||
extra_agent_args: "--node-external-ip #{node_ip} --flannel-iface eth1",
|
extra_agent_args: "--node-external-ip #{node_ip} --flannel-iface eth1",
|
||||||
# Not needed, left as reference for ruby-ansible list syntax
|
# Optional, left as reference for ruby-ansible syntax
|
||||||
# extra_service_envs: [ "NO_PROXY='localhost'" ],
|
# extra_service_envs: [ "NO_PROXY='localhost'" ],
|
||||||
|
# config_yaml: <<~YAML
|
||||||
|
# write-kubeconfig-mode: 644
|
||||||
|
# YAML
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -27,3 +27,7 @@ k3s_cluster:
|
|||||||
# List of locally available manifests to apply to the cluster, useful for PVCs or Traefik modifications.
|
# List of locally available manifests to apply to the cluster, useful for PVCs or Traefik modifications.
|
||||||
# Manifests should be either full paths or relative to the playbook directory.
|
# Manifests should be either full paths or relative to the playbook directory.
|
||||||
# extra_manifests: [ '/path/to/manifest1.yaml', '/path/to/manifest2.yaml' ]
|
# extra_manifests: [ '/path/to/manifest1.yaml', '/path/to/manifest2.yaml' ]
|
||||||
|
# config_yaml: |
|
||||||
|
# This is now an inner yaml file. Mantain the indentation.
|
||||||
|
# YAML here will be placed as the content of /etc/rancher/k3s/config.yaml
|
||||||
|
# See https://docs.k3s.io/installation/configuration#configuration-file
|
||||||
|
|||||||
@@ -187,3 +187,17 @@
|
|||||||
dest: "/var/lib/rancher/k3s/server/manifests"
|
dest: "/var/lib/rancher/k3s/server/manifests"
|
||||||
mode: 0600
|
mode: 0600
|
||||||
loop: "{{ extra_manifests }}"
|
loop: "{{ extra_manifests }}"
|
||||||
|
|
||||||
|
- name: Setup optional config file
|
||||||
|
when: config_yaml is defined
|
||||||
|
block:
|
||||||
|
- name: Make config directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "/etc/rancher/k3s"
|
||||||
|
mode: 0755
|
||||||
|
state: directory
|
||||||
|
- name: Copy config values
|
||||||
|
ansible.builtin.copy:
|
||||||
|
content: "{{ config_yaml }}"
|
||||||
|
dest: "/etc/rancher/k3s/config.yaml"
|
||||||
|
mode: 0644
|
||||||
|
|||||||
Reference in New Issue
Block a user