Switch to using import_tasks for static inclusion

Using dynamic inclusion (include_tasks) should only be done
if the tasks to include are based on a conditional and there
is no expectation for the tag on the include task to be applied
to all included tasks. Using include_tasks for static inclusion
dramatically raises memory consumption. Using include_tasks also
breaks the ability to use a tag applied to the include.

In this patch we fix all inclusions to ensure that they are set
properly to dynamic or static inclusions where necessary.

We also remove the unnecessary leading whitespace in the main
task file.

Change-Id: Idff86d4a90d3309f0e9ae3b9f0559b37e25dc26f
Closes-Bug: #1800169
This commit is contained in:
Jesse Pretorius 2018-10-30 18:33:07 +00:00
parent b792753b34
commit f381cc02af
2 changed files with 50 additions and 50 deletions

View File

@ -52,7 +52,7 @@
tags: tags:
- always - always
- include_tasks: "{{ stig_version }}stig/main.yml" - import_tasks: "{{ stig_version }}stig/main.yml"
- include_tasks: contrib/main.yml - include_tasks: contrib/main.yml
when: when:

View File

@ -33,7 +33,7 @@
# Some of the tasks in the role may take a long time to run. Let's start them # Some of the tasks in the role may take a long time to run. Let's start them
# as early as possible so they have time to finish. # as early as possible so they have time to finish.
- include_tasks: async_tasks.yml - import_tasks: async_tasks.yml
- name: Get user data for all users on the system - name: Get user data for all users on the system
get_users: get_users:
@ -66,7 +66,7 @@
# Package installations and removals must come first so that configuration # Package installations and removals must come first so that configuration
# changes can be made later. # changes can be made later.
- include_tasks: packages.yml - import_tasks: packages.yml
tags: tags:
- always - always
@ -78,16 +78,16 @@
# each file are tagged with the same name (for example, tasks in `auth.yml` # each file are tagged with the same name (for example, tasks in `auth.yml`
# are tagged with `auth`). Also, the tag name matches up with the "STIG # are tagged with `auth`). Also, the tag name matches up with the "STIG
# Controls by Tag" section of the role documentation. # Controls by Tag" section of the role documentation.
- include_tasks: accounts.yml - import_tasks: accounts.yml
- include_tasks: aide.yml - import_tasks: aide.yml
- include_tasks: auditd.yml - import_tasks: auditd.yml
- include_tasks: auth.yml - import_tasks: auth.yml
- include_tasks: file_perms.yml - import_tasks: file_perms.yml
- include_tasks: graphical.yml - import_tasks: graphical.yml
- include_tasks: kernel.yml - import_tasks: kernel.yml
- include_tasks: lsm.yml - import_tasks: lsm.yml
- include_tasks: misc.yml - import_tasks: misc.yml
- include_tasks: sshd.yml - import_tasks: sshd.yml
- name: Remove the temporary directory - name: Remove the temporary directory
file: file: