d2e1d2ee56
The user_list parameter is a pure internal parameter. The user_list parameter conflicts with the parameter of one of our roles. As this is a pure internal parameter, it can simply be renamed. Change-Id: I87ddb138ba78584ba63f463ec304460c970206ad
116 lines
3.3 KiB
YAML
116 lines
3.3 KiB
YAML
---
|
|
# Copyright 2015, Rackspace US, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
- name: Create temporary directory to hold any temporary files
|
|
tempfile:
|
|
state: directory
|
|
suffix: hardening
|
|
register: mktemp_result
|
|
when:
|
|
- not check_mode | bool
|
|
tags:
|
|
- always
|
|
|
|
- name: Set a fact for the temporary directory
|
|
set_fact:
|
|
temp_dir: "{{ mktemp_result.path }}"
|
|
changed_when: False
|
|
when:
|
|
- not check_mode | bool
|
|
tags:
|
|
- always
|
|
|
|
# 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.
|
|
- name: Importing async_tasks tasks
|
|
import_tasks: async_tasks.yml
|
|
|
|
- name: Get user data for all users on the system
|
|
get_users:
|
|
min_uid: 0
|
|
register: hardening_user_list
|
|
check_mode: no
|
|
tags:
|
|
- always
|
|
|
|
- name: Get user data for all interactive users on the system
|
|
get_users:
|
|
min_uid: "{{ security_interactive_user_minimum_uid }}"
|
|
register: interactive_user_list
|
|
check_mode: no
|
|
tags:
|
|
- always
|
|
|
|
# NOTE(mhayden): EPEL is only needed for the clamav packages. We should only
|
|
# install EPEL if the deployer asked for clamav to be installed.
|
|
- name: Install EPEL repository
|
|
yum:
|
|
name: "{{ security_epel_release_package }}"
|
|
state: "{{ security_package_state }}"
|
|
when:
|
|
- ansible_facts['pkg_mgr'] == 'dnf'
|
|
- security_epel_install_repository | bool
|
|
- security_enable_virus_scanner | bool
|
|
tags:
|
|
- always
|
|
|
|
# Package installations and removals must come first so that configuration
|
|
# changes can be made later.
|
|
- name: Importing packages tasks
|
|
import_tasks: packages.yml
|
|
tags:
|
|
- always
|
|
|
|
# Package managers are managed first since the changes in these tasks will
|
|
# affect the remainder of the tasks in the role.
|
|
- name: Including OS-specific tasks
|
|
include_tasks: "{{ ansible_facts['pkg_mgr'] }}.yml"
|
|
|
|
# The bulk of the security changes are applied in these tasks. The tasks in
|
|
# 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
|
|
# Controls by Tag" section of the role documentation.
|
|
- name: Importing accounts tasks
|
|
import_tasks: accounts.yml
|
|
- name: Importing aide tasks
|
|
import_tasks: aide.yml
|
|
when: security_rhel7_enable_aide | bool
|
|
- name: Importing auditd tasks
|
|
import_tasks: auditd.yml
|
|
- name: Importing auth tasks
|
|
import_tasks: auth.yml
|
|
- name: Importing file_perms tasks
|
|
import_tasks: file_perms.yml
|
|
- name: Importing graphical tasks
|
|
import_tasks: graphical.yml
|
|
- name: Importing kernel tasks
|
|
import_tasks: kernel.yml
|
|
- name: Importing lsm tasks
|
|
import_tasks: lsm.yml
|
|
- name: Importing misc tasks
|
|
import_tasks: misc.yml
|
|
- name: Importing sshd tasks
|
|
import_tasks: sshd.yml
|
|
|
|
- name: Remove the temporary directory
|
|
file:
|
|
path: "{{ temp_dir }}"
|
|
state: absent
|
|
changed_when: False
|
|
when:
|
|
- not check_mode | bool
|
|
tags:
|
|
- always
|