From e26ad50415053c58782bca5295ed1145877dbbe8 Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Sun, 4 Dec 2022 17:46:10 +0100 Subject: [PATCH] Fix file paths --- plays/files/{ => system_base}/motd/valkyrie | 0 plays/files/{ => system_base}/motd/yggdrasil | 0 .../system_smart/files => files/system_smart}/smartd.conf | 0 plays/roles/system_base/tasks/include/motd.yml | 2 +- plays/roles/system_smart/meta/argument_specs.yml | 6 ++++++ plays/roles/system_smart/tasks/main.yml | 2 +- plays/system.yml | 6 +++++- 7 files changed, 13 insertions(+), 3 deletions(-) rename plays/files/{ => system_base}/motd/valkyrie (100%) rename plays/files/{ => system_base}/motd/yggdrasil (100%) rename plays/{roles/system_smart/files => files/system_smart}/smartd.conf (100%) create mode 100644 plays/roles/system_smart/meta/argument_specs.yml diff --git a/plays/files/motd/valkyrie b/plays/files/system_base/motd/valkyrie similarity index 100% rename from plays/files/motd/valkyrie rename to plays/files/system_base/motd/valkyrie diff --git a/plays/files/motd/yggdrasil b/plays/files/system_base/motd/yggdrasil similarity index 100% rename from plays/files/motd/yggdrasil rename to plays/files/system_base/motd/yggdrasil diff --git a/plays/roles/system_smart/files/smartd.conf b/plays/files/system_smart/smartd.conf similarity index 100% rename from plays/roles/system_smart/files/smartd.conf rename to plays/files/system_smart/smartd.conf diff --git a/plays/roles/system_base/tasks/include/motd.yml b/plays/roles/system_base/tasks/include/motd.yml index c183ed3..6d908a8 100644 --- a/plays/roles/system_base/tasks/include/motd.yml +++ b/plays/roles/system_base/tasks/include/motd.yml @@ -8,6 +8,6 @@ _system_base_motd_file != "" vars: _file_path: - - ../../../{{ motd_dir_path }}/{{ ansible_hostname }} + - "{{ motd_dir_path }}/{{ ansible_hostname }}" _system_base_motd_file: >- {{ lookup('ansible.builtin.first_found', _file_path, errors='ignore') }} diff --git a/plays/roles/system_smart/meta/argument_specs.yml b/plays/roles/system_smart/meta/argument_specs.yml new file mode 100644 index 0000000..ea59bf6 --- /dev/null +++ b/plays/roles/system_smart/meta/argument_specs.yml @@ -0,0 +1,6 @@ +argument_specs: + main: + options: + smartd_conf_file_path: + type: "str" + required: true diff --git a/plays/roles/system_smart/tasks/main.yml b/plays/roles/system_smart/tasks/main.yml index 6a7737c..3974864 100644 --- a/plays/roles/system_smart/tasks/main.yml +++ b/plays/roles/system_smart/tasks/main.yml @@ -4,7 +4,7 @@ - name: "smartd configuration" ansible.builtin.copy: - src: "./smartd.conf" + src: "{{ smartd_conf_file_path }}" dest: "/etc/smartd.conf" mode: 0644 register: smartd_conf diff --git a/plays/system.yml b/plays/system.yml index 95c056d..0b590b1 100644 --- a/plays/system.yml +++ b/plays/system.yml @@ -4,8 +4,12 @@ roles: - role: "system_ups" tags: "role:system_ups" + vars: + smartd_conf_file_path: "files/system_smart/smartd.conf" + when: the_nine_worlds_production | bool - role: "system_smart" tags: "role:system_smart" + when: the_nine_worlds_production | bool - role: "system_zfs" tags: "role:system_zfs" @@ -18,4 +22,4 @@ - role: "system_base" tags: "role:system_base" vars: - motd_dir_path: "files/motd" + motd_dir_path: "files/system_base/motd"