From bd64ca7441639fa21ea548076cf29fef5383fbb4 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Tue, 12 Apr 2022 21:07:56 +0200 Subject: [PATCH] More portable way for sharing variables between role and tests --- tasks/set_common_vars.yml | 3 +++ tasks/sshd.yml | 2 ++ tests/tasks/restore.yml | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 tasks/set_common_vars.yml diff --git a/tasks/set_common_vars.yml b/tasks/set_common_vars.yml new file mode 100644 index 0000000..c7cacd3 --- /dev/null +++ b/tasks/set_common_vars.yml @@ -0,0 +1,3 @@ +--- +- name: Include common vars + include_vars: vars/common.yml diff --git a/tasks/sshd.yml b/tasks/sshd.yml index 57cb12b..1252445 100644 --- a/tasks/sshd.yml +++ b/tasks/sshd.yml @@ -1,5 +1,7 @@ --- +- include_tasks: set_common_vars.yml + - include_tasks: variables.yml - include_tasks: install.yml diff --git a/tests/tasks/restore.yml b/tests/tasks/restore.yml index e8130e8..75bb25b 100644 --- a/tests/tasks/restore.yml +++ b/tests/tasks/restore.yml @@ -26,7 +26,10 @@ - __sshd_test_backup.path is defined - name: Include common variables - include_vars: ../../vars/common.yml + include_role: + name: ansible-sshd + tasks_from: set_common_vars.yml + public: true - name: Restart sshd service service: