|
| 1 | +--- |
| 2 | +- name: wrapper playbook for kitchen testing "ansible-os-hardening" with custom vars for testing |
| 3 | + hosts: all |
| 4 | + become: true |
| 5 | + collections: |
| 6 | + - devsec.hardening |
| 7 | + environment: |
| 8 | + http_proxy: "{{ lookup('env', 'http_proxy') | default(omit) }}" |
| 9 | + https_proxy: "{{ lookup('env', 'https_proxy') | default(omit) }}" |
| 10 | + no_proxy: "{{ lookup('env', 'no_proxy') | default(omit) }}" |
| 11 | + tasks: |
| 12 | + - name: set ansible_python_interpreter to "/usr/bin/python3" on fedora |
| 13 | + set_fact: |
| 14 | + ansible_python_interpreter: "/usr/bin/python3" |
| 15 | + when: ansible_facts.distribution == 'Fedora' |
| 16 | + |
| 17 | + - name: Run the equivalent of "apt-get update && apt-get upgrade" |
| 18 | + apt: |
| 19 | + name: "*" |
| 20 | + state: latest |
| 21 | + update_cache: true |
| 22 | + when: ansible_os_family == 'Debian' |
| 23 | + |
| 24 | + - name: install required tools on SuSE |
| 25 | + # cannot use zypper module, since it depends on python-xml |
| 26 | + shell: "zypper -n install python-xml" |
| 27 | + when: ansible_facts.os_family == 'Suse' |
| 28 | + |
| 29 | + - name: install required tools on fedora |
| 30 | + dnf: |
| 31 | + name: |
| 32 | + - python |
| 33 | + - findutils |
| 34 | + - procps-ng |
| 35 | + when: ansible_facts.distribution == 'Fedora' |
| 36 | + |
| 37 | + - name: install required tools on Arch |
| 38 | + community.general.pacman: |
| 39 | + name: |
| 40 | + - awk |
| 41 | + state: present |
| 42 | + update_cache: true |
| 43 | + when: ansible_facts.os_family == 'Archlinux' |
| 44 | + |
| 45 | + - name: install required tools on RHEL # noqa ignore-errors |
| 46 | + yum: |
| 47 | + name: |
| 48 | + - openssh-clients |
| 49 | + - openssh |
| 50 | + state: present |
| 51 | + update_cache: true |
| 52 | + ignore_errors: true |
| 53 | + |
| 54 | + - name: create recursing symlink to test minimize access |
| 55 | + shell: "rm -f /usr/bin/zzz && ln -s /usr/bin /usr/bin/zzz" |
| 56 | + changed_when: false |
| 57 | + |
| 58 | + - name: include YUM prepare tasks |
| 59 | + include_tasks: prepare_tasks/yum.yml |
| 60 | + when: ansible_facts.os_family == 'RedHat' |
0 commit comments