Skip to content

Commit

Permalink
Add molecule setup for mirsg.infrastructure.install_python (#11)
Browse files Browse the repository at this point in the history
- update README to reflect the role is now part of a collection
- add molecule inventory group vars fro
`mirsg.infrastructure.install_python`
- add a workflow to run molecule on `install_python` when the role
changes
  • Loading branch information
p-j-smith authored Dec 13, 2023
1 parent f350806 commit 0b67432
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/molecule-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Test Python
on:
pull_request:
paths:
- "roles/install_python/**"
- ".github/workflows/molecule.yml"
- ".github/workflows/molecule-python.yml"

jobs:
molecule-firewalld:
uses: ./.github/workflows/molecule.yml
with:
run-tags: python
18 changes: 1 addition & 17 deletions roles/install_python/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
# Ansible Role: mirsg.install_python
# Ansible Role: mirsg.infrastructure.install_python

This role installs Python, pip, and setuptools on Debian and RedHat operating systems. It will also update pip to the latest version or a
user-specified version, and then install user-specified Python packages using pip.

## Requirements

If you would like to run Ansible Molecule to test this role, the requirements are in [`requirements.txt`](https://github.com/UCL-MIRSG/ansible-role-install-python/blob/main/requirements.txt).

## Role Variables

`install_python` is a dictionary that contains the following variables:
Expand All @@ -29,10 +25,6 @@ The packages listed in `install_python.system_packages` will be installed by the

`pip_packages`: list of Python packages to be installed by pip. This defaults to `[]`.

## Dependencies

There are no Ansible-Galaxy dependencies for this role.

## Example Playbook

This role will install Python on a managed host. To used this role, add it to the list of roles in a play:
Expand All @@ -43,11 +35,3 @@ This role will install Python on a managed host. To used this role, add it to th
roles:
- mirsg.install_python
```

## License

[BSD 3-Clause License](https://github.com/UCL-MIRSG/ansible-role-install-python/blob/main/LICENSE).

## Author Information

This role was created by the [Medical Imaging Research Software Group](https://www.ucl.ac.uk/advanced-research-computing/expertise/research-software-development/medical-imaging-research-software-group) at [UCL](https://www.ucl.ac.uk/).
12 changes: 12 additions & 0 deletions tests/molecule/resources/inventory/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ selinux_enabled: false
# mirsg.infrastructure.provision
server_locale: "en_GB.UTF-8"

# mirsg.infrastructure.install_python
install_python:
version: "2"
pip_version: "20.3.4"
pip_executable: "pip"
system_packages:
- python
- python-pip
- python-setuptools
pip_packages:
- cryptography

# mirsg.infrastructure.firewalld
allow_public_access: true
internal_zone_open_services:
Expand Down

0 comments on commit 0b67432

Please sign in to comment.