diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml new file mode 100644 index 0000000..d88a40a --- /dev/null +++ b/molecule/default/converge.yml @@ -0,0 +1,13 @@ +--- +- name: Converge + hosts: all + tasks: + - name: Include default variables + ansible.builtin.include_vars: + file: "../../defaults/main.yml" + - name: Include variables + ansible.builtin.include_vars: + file: "../../vars/main.yml" + roles: + - name: Run the atomic-red-team role + role: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" diff --git a/molecule/default/inventory b/molecule/default/inventory new file mode 100644 index 0000000..2fbb50c --- /dev/null +++ b/molecule/default/inventory @@ -0,0 +1 @@ +localhost diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml new file mode 100644 index 0000000..dfbf3ff --- /dev/null +++ b/molecule/default/molecule.yml @@ -0,0 +1,41 @@ +--- +# Run molecule inside of a docker container +driver: + name: docker + +platforms: + - name: ubuntu-atomic-red-team + image: "geerlingguy/docker-ubuntu2204-ansible:latest" + # Setting the command to this is necessary for systemd containers + command: "" + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:rw + cgroupns_mode: host + privileged: true + + - name: kali-atomic-red-team + image: cisagov/docker-kali-ansible:latest + # Setting the command to this is necessary for systemd containers + command: "" + pre_build_image: true + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:rw + cgroupns_mode: host + privileged: true + + - name: redhat-atomic-red-team + image: "geerlingguy/docker-rockylinux9-ansible:latest" + # Setting the command to this is necessary for systemd containers + command: "" + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:rw + cgroupns_mode: host + privileged: true + +provisioner: + name: ansible + playbooks: + converge: ${MOLECULE_PLAYBOOK:-converge.yml} + +verifier: + name: ansible diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml new file mode 100644 index 0000000..f8970ca --- /dev/null +++ b/molecule/default/verify.yml @@ -0,0 +1,34 @@ +--- +- name: Verify + hosts: all + gather_facts: true + tasks: + - name: Include default variables + ansible.builtin.include_vars: + file: "../../defaults/main.yml" + + - name: Include variables + ansible.builtin.include_vars: + file: "../../vars/main.yml" + + - name: Check if PowerShell is installed + ansible.builtin.shell: + cmd: "pwsh -NoProfile -v" + register: pwsh_version + ignore_errors: true + + - name: Assert that PowerShell is installed + ansible.builtin.assert: + that: + - pwsh_version.rc == 0 + - "'PowerShell' in pwsh_version.stdout" + + - name: Check if /usr/local/bin is in $PATH + ansible.builtin.shell: + cmd: "echo $PATH" + register: system_path + + - name: Assert that /usr/local/bin is in $PATH + ansible.builtin.assert: + that: + - "'/usr/local/bin' in system_path.stdout"