Use include_tasks for os_hardening/main.yml (#451)

When `import_tasks` is used, the task `Fetch OS dependent variables`
always runs, even when excluded by an upstream tag.

When `Fetch OS dependent variables` runs while excluded via tags, it
will always fail with the following.

```
fatal: [alpha]: FAILED! => {"msg": "No file was found when using first_found. Use errors='ignore' to allow this task to be skipped if no files are found"}
```

This brings os_hardening's main.yml in line with ssh_hardening's
main.yml, which doesn't have this issue.

Signed-off-by: Colin Adler <[email protected]>
This commit is contained in:
Colin Adler authored and GitHub committed 2021-06-23 11:28:08 +02:00
1 parent cf6b6e6562
commit 8cbeeff501
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -14,7 +14,7 @@
# we only override variables with our default, if they have not been specified already
# by default the lookup functions finds all varnames containing the string, therefore
# we add ^ and $ to denote start and end of string, so this returns only exact maches
# we add ^ and $ to denote start and end of string, so this returns only exact matches
- name: Set OS dependent variables, if not already defined by user
set_fact:
'{{ item.key }}': '{{ item.value }}'
+1 -1
View File
@@ -1,3 +1,3 @@
---
- import_tasks: hardening.yml
- include_tasks: hardening.yml
when: os_hardening_enabled | bool