mirror of
https://github.com/dev-sec/ansible-collection-hardening
synced 2024-11-14 02:47:06 +00:00
422fb940a9
Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>
67 lines
2.2 KiB
YAML
67 lines
2.2 KiB
YAML
---
|
|
- name: Wrapper playbook for kitchen testing "ansible-os-hardening" with custom vars for testing
|
|
hosts: all
|
|
become: true
|
|
environment:
|
|
http_proxy: "{{ lookup('env', 'http_proxy') | default(omit) }}"
|
|
https_proxy: "{{ lookup('env', 'https_proxy') | default(omit) }}"
|
|
no_proxy: "{{ lookup('env', 'no_proxy') | default(omit) }}"
|
|
tasks:
|
|
- name: Set ansible_python_interpreter to "/usr/bin/python3" on fedora
|
|
ansible.builtin.set_fact:
|
|
ansible_python_interpreter: /usr/bin/python3
|
|
when: ansible_facts.distribution == 'Fedora'
|
|
|
|
- name: Run the equivalent of "apt-get update && apt-get upgrade"
|
|
ansible.builtin.apt:
|
|
upgrade: safe
|
|
update_cache: true
|
|
when: ansible_os_family == 'Debian'
|
|
|
|
- name: Install required tools on SuSE
|
|
# cannot use zypper module, since it depends on python-xml
|
|
ansible.builtin.command: zypper -n install python-xml awk
|
|
changed_when: false
|
|
when: ansible_facts.os_family == 'Suse'
|
|
|
|
- name: Install required tools on fedora
|
|
ansible.builtin.dnf:
|
|
name:
|
|
- python
|
|
- findutils
|
|
- procps-ng
|
|
when: ansible_facts.distribution == 'Fedora'
|
|
|
|
- name: Install required tools on Arch
|
|
community.general.pacman:
|
|
name:
|
|
- awk
|
|
state: present
|
|
update_cache: true
|
|
when: ansible_facts.os_family == 'Archlinux'
|
|
|
|
- name: Install required tools on RHEL # noqa ignore-errors
|
|
ansible.builtin.yum:
|
|
name:
|
|
- openssh-clients
|
|
- openssh
|
|
state: present
|
|
update_cache: true
|
|
ignore_errors: true
|
|
|
|
- name: Create recursing symlink to test minimize access
|
|
ansible.builtin.shell: rm -f /usr/bin/zzz && ln -s /usr/bin /usr/bin/zzz
|
|
changed_when: false
|
|
|
|
- name: Include YUM prepare tasks
|
|
ansible.builtin.include_tasks: prepare_tasks/yum.yml
|
|
when: ansible_facts.os_family == 'RedHat'
|
|
|
|
- name: Include preparation tasks
|
|
ansible.builtin.include_tasks:
|
|
file: "{{ item }}"
|
|
loop:
|
|
- prepare_tasks/netrc.yml
|
|
- prepare_tasks/pw_ageing.yml
|
|
- prepare_tasks/sys_account_shell.yml
|
|
- prepare_tasks/ignore_home_folders.yml
|