2020-12-10 07:33:09 +00:00
|
|
|
---
|
2020-12-10 19:26:11 +00:00
|
|
|
# Basic system configuration. All hardening should also be imported here.
|
2021-01-21 22:20:13 +00:00
|
|
|
# Use --extra-vars="host=..." and specify a hostname in the inventory or
|
|
|
|
# provide an ansible host group name. You can also just use "all" if you
|
|
|
|
# want to ensure all systems are up to date on the configuration.
|
2020-12-10 19:26:11 +00:00
|
|
|
- name: Configure system
|
2021-01-21 22:20:13 +00:00
|
|
|
hosts: "{{ host }}"
|
2020-12-10 07:33:09 +00:00
|
|
|
become: true
|
|
|
|
|
2020-12-10 23:11:41 +00:00
|
|
|
# This is to try to avoid the handler issue in pre/post tasks
|
|
|
|
handlers:
|
2020-12-13 11:54:31 +00:00
|
|
|
- import_tasks: handlers/main.yml
|
2020-12-10 23:11:41 +00:00
|
|
|
|
2020-12-10 07:33:09 +00:00
|
|
|
pre_tasks:
|
|
|
|
- name: Check if ansible cannot be run here
|
|
|
|
stat:
|
|
|
|
path: /etc/no-ansible
|
|
|
|
register: no_ansible
|
|
|
|
|
|
|
|
- name: Verify if we can run ansible
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "not no_ansible.stat.exists"
|
2021-01-02 03:14:24 +00:00
|
|
|
success_msg: "We are able to run on this node"
|
|
|
|
fail_msg: "/etc/no-ansible exists - skipping run on this node"
|
2020-12-10 07:33:09 +00:00
|
|
|
|
2020-12-10 19:26:11 +00:00
|
|
|
tasks:
|
2020-12-10 19:59:59 +00:00
|
|
|
- name: Loading Variables from OS Common
|
2020-12-13 11:54:31 +00:00
|
|
|
import_tasks: tasks/variable_loader_common.yml
|
2020-12-10 19:59:59 +00:00
|
|
|
|
2020-12-10 19:26:11 +00:00
|
|
|
- name: Configure SSH
|
2020-12-13 11:54:31 +00:00
|
|
|
import_tasks: tasks/ssh_config.yml
|
2020-12-10 07:33:09 +00:00
|
|
|
|
2020-12-10 19:59:59 +00:00
|
|
|
- name: Configure harden settings
|
2020-12-13 11:54:31 +00:00
|
|
|
import_tasks: tasks/harden.yml
|
2020-12-10 19:59:59 +00:00
|
|
|
|
2020-12-12 19:58:00 +00:00
|
|
|
- name: Configure PAM
|
2020-12-13 11:54:31 +00:00
|
|
|
import_tasks: tasks/authentication.yml
|
2020-12-12 12:39:37 +00:00
|
|
|
|
2020-12-13 17:22:55 +00:00
|
|
|
- name: Configure auditd
|
2020-12-13 18:41:26 +00:00
|
|
|
import_tasks: tasks/auditd.yml
|
|
|
|
|
|
|
|
- name: Configure grub
|
|
|
|
import_tasks: tasks/grub.yml
|
2020-12-13 17:22:55 +00:00
|
|
|
|
2020-12-31 21:49:48 +00:00
|
|
|
- name: Configure common scripts
|
|
|
|
import_tasks: tasks/scripts.yml
|
|
|
|
|
2020-12-10 07:33:09 +00:00
|
|
|
post_tasks:
|
|
|
|
- name: Touching run file that ansible has ran here
|
|
|
|
file:
|
|
|
|
path: /var/log/ansible.run
|
|
|
|
state: touch
|
2020-12-10 23:40:49 +00:00
|
|
|
mode: '0644'
|
2020-12-11 21:00:14 +00:00
|
|
|
owner: root
|
2020-12-10 23:40:49 +00:00
|
|
|
group: root
|