From f4b6192bc1abbb763301fb84f43b123c1489bda2 Mon Sep 17 00:00:00 2001 From: Thomas Schmid Date: Tue, 11 Jan 2022 20:22:29 +0100 Subject: [PATCH] octoprint: allow additional user configuration of octoprint Signed-off-by: Thomas Schmid --- roles/octoprint/tasks/main.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/roles/octoprint/tasks/main.yml b/roles/octoprint/tasks/main.yml index 22447f2..ff5f0b6 100644 --- a/roles/octoprint/tasks/main.yml +++ b/roles/octoprint/tasks/main.yml @@ -52,11 +52,16 @@ - name: Default octoprint config set_fact: - octoprint_config: "{{ lookup('template', 'config.yaml.j2') | from_yaml }}" + octoprint_default_config: "{{ lookup('template', 'config.yaml.j2') | from_yaml }}" + +- name: Apply user config + set_fact: + octoprint_config_combined: "{{ octoprint_default_config | combine(octoprint_config, recursive=True)}}" + when: octoprint_config is defined - name: Initial configuration of octoprint copy: - content: "{{ octoprint_config | to_nice_yaml }}" + content: "{{ octoprint_config_combined | to_nice_yaml }}" dest: "/home/{{ octoprint_user }}/.octoprint/config.yaml" when: not octoprint_register_config_stat.stat.exists @@ -73,7 +78,7 @@ - name: Write updated octoprint configuration copy: - content: "{{ octoprint_config | combine(current_octoprint_config, recursive=True) | to_nice_yaml}}" + content: "{{ current_octoprint_config | combine(octoprint_config_combined, recursive=True) | to_nice_yaml}}" dest: "/home/{{octoprint_user}}/.octoprint/config.yaml" notify: Restart octoprint