Skip to content

Commit

Permalink
install python3, pip so we can then install pam-tester
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Gumprich <[email protected]>
  • Loading branch information
Sebastian Gumprich committed Aug 8, 2023
1 parent 8220ae9 commit f1ec9f2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
19 changes: 9 additions & 10 deletions molecule/os_hardening/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@
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
set_fact:
ansible_python_interpreter: "/usr/bin/python3"
when: ansible_facts.distribution == 'Fedora'

- name: Run the equivalent of "apt-get update && apt-get upgrade"
apt:
name: "*"
state: latest
- name: Install Python3 on Debian 10
ansible.builtin.apt:
name: python3
state: present
update_cache: true
when: ansible_os_family == 'Debian'

- name: install required tools on SuSE
- name: Set ansible_python_interpreter to "/usr/bin/python3"
ansible.builtin.set_fact:
ansible_python_interpreter: /usr/bin/python3

- name: Install required tools on SuSE
# cannot use zypper module, since it depends on python-xml
ansible.builtin.shell: zypper -n install python-xml
when: ansible_facts.os_family == 'Suse'
Expand Down
13 changes: 6 additions & 7 deletions molecule/os_hardening/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@
- verify_tasks/netrc.yml
- verify_tasks/ignore_home_folders.yml

# temp. disabled - https://github.com/dev-sec/ansible-collection-hardening/issues/690
# - name: include PAM tests
# include_tasks: verify_tasks/pam.yml
# when: ansible_facts.distribution in ['Debian', 'Ubuntu'] or ansible_facts.os_family == 'RedHat'

- name: include YUM tests
include_tasks: verify_tasks/yum.yml
- name: Include YUM tests
ansible.builtin.include_tasks: verify_tasks/yum.yml
when: ansible_facts.os_family == 'RedHat'

- name: Include PAM tests
ansible.builtin.include_tasks: verify_tasks/pam.yml
when: ansible_facts.distribution in ['Debian', 'Ubuntu'] or ansible_facts.os_family == 'RedHat'

- name: Verify
hosts: localhost
environment:
Expand Down
6 changes: 3 additions & 3 deletions molecule/os_hardening/verify_tasks/pam.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
state: present
executable: /usr/bin/pip3

- name: set password for test
set_fact:
test_pw: "myTest!pw"
- name: Set password for test
ansible.builtin.set_fact:
test_pw: myTestpwSage

- name: Set locale for test
ansible.builtin.set_fact:
Expand Down

0 comments on commit f1ec9f2

Please sign in to comment.