Skip to content

Use podman as molecule driver #147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
skip_list:
- '106' # Role name {} does not match ``^[a-z][a-z0-9_]+$`` pattern'
- 'fqcn-builtins'
- 'key-order'
- 'name[missing]'
warn_list:
- 'deprecated-module'
25 changes: 14 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ jobs:
# See:
# - https://bugzilla.redhat.com/show_bug.cgi?id=190144
# - https://github.com/systemd/systemd/pull/16424
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
image:
- 'centos:7'
- 'rockylinux:8.5'
- 'rockylinux:8.6'
scenario:
- test1
- test1b
Expand All @@ -43,7 +43,6 @@ jobs:
- test12
- test13
- test14
- test15

exclude:
- image: 'centos:7'
Expand Down Expand Up @@ -71,15 +70,17 @@ jobs:

steps:
- name: Check out the codebase.
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python 3.
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'
python-version: '3.9'

- name: Install test dependencies.
run: pip3 install -U ansible molecule[docker] docker yamllint ansible-lint
run: |
pip3 install -U ansible molecule[podman] yamllint ansible-lint
ansible-galaxy collection install containers.podman:>=1.10.1 # otherwise get https://github.com/containers/ansible-podman-collections/issues/428

- name: Display ansible version
run: ansible --version
Expand All @@ -102,15 +103,17 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Check out the codebase.
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python 3.
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'
python-version: '3.9'

- name: Install test dependencies.
run: pip3 install -U ansible molecule[docker] docker yamllint ansible-lint
run: |
pip3 install -U ansible molecule[podman] yamllint ansible-lint
ansible-galaxy collection install containers.podman:>=1.10.1 # otherwise get https://github.com/containers/ansible-podman-collections/issues/428

- name: Display ansible version
run: ansible --version
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This Ansible role installs packages and performs configuration to provide an Ope

As a role it must be used from a playbook, for which a simple example is given below. This approach means it is totally modular with no assumptions about available networks or any cluster features except for some hostname conventions. Any desired cluster fileystem or other required functionality may be freely integrated using additional Ansible roles or other approaches.

The minimal image for nodes is a Centos7 or Centos8 cloud image. These use OpenHPC v1 and v2 respectively. Centos8/OpenHPCv2 is generally preferred as it provides additional functionality for Slurm, compilers, MPI and transport libraries.
The minimal image for nodes is a CentOS 7 or RockyLinux 8 GenericCloud image. These use OpenHPC v1 and v2 respectively. Centos8/OpenHPCv2 is generally preferred as it provides additional functionality for Slurm, compilers, MPI and transport libraries.

## Role Variables

Expand Down
3 changes: 1 addition & 2 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ galaxy_info:
min_ansible_version: 2.5.0
platforms:
- name: EL
versions:
- 7
versions: ['7', '8']
galaxy_tags:
- openhpc
- slurm
Expand Down
19 changes: 5 additions & 14 deletions molecule/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,27 @@ test11 | 1 | N | As for #5 but then deletes a n
test12 | 1 | N | As for #5 but enabling job completion and testing `sacct -c`
test13 | 1 | N | As for #5 but tests `openhpc_config` variable.
test14 | 1 | N | As for #5 but also tests `extra_nodes` via State=DOWN nodes.
test15 | 1 | N | No compute nodes.


# Local Installation & Running

Local installation on a RockyLinux 8.x machine looks like:

sudo yum install -y gcc python3-pip python3-devel openssl-devel python3-libselinux
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install -y docker-ce docker-ce-cli containerd.io
sudo yum install -y iptables
sudo systemctl start docker
sudo usermod -aG docker ${USER}
sudo usermod -aG docker rocky
newgrp docker
docker run hello-world # test docker works without sudo

sudo dnf install -y podman
sudo yum install -y git
git clone git@github.com:stackhpc/ansible-role-openhpc.git
cd ansible-role-openhpc/
python3 -m venv venv
python3.9 -m venv venv
. venv/bin/activate
pip install -U pip
pip install -r molecule/requirements.txt
ansible-galaxy collection install containers.podman:>=1.10.1

Then to run tests, e.g.::

cd ansible-role-openhpc/
MOLECULE_IMAGE=centos:7 molecule test --all # NB some won't work as require OpenHPC v2.x (-> CentOS 8.x) features - see `.github/workflows/ci.yml`
MOLECULE_IMAGE=rockylinux:8.5 molecule test --all
MOLECULE_IMAGE=rockylinux:8.6 molecule test --all

**NB:** If the host network has an MTU smaller than 1500 (the docker default), check `molecule.yml` for the relevant test contains `DOCKER_MTU`, then prepend `DOCKER_MTU=<mtu>` to your command. If you have already run molecule you will need to destroy the instances and run `docker network prune` before retrying.

Expand Down
2 changes: 1 addition & 1 deletion molecule/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pip
setuptools
molecule[docker,lint,ansible]
molecule[podman,lint,ansible]
ansible>=2.9.0
12 changes: 4 additions & 8 deletions molecule/test1/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
name: single partition, group is partition
driver:
name: docker
name: podman
platforms:
- name: testohpc-login-0
image: ${MOLECULE_IMAGE}
Expand All @@ -14,8 +13,7 @@ platforms:
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
networks:
- name: net1
network: net1
- name: testohpc-compute-0
image: ${MOLECULE_IMAGE}
pre_build_image: true
Expand All @@ -27,8 +25,7 @@ platforms:
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
networks:
- name: net1
network: net1
- name: testohpc-compute-1
image: ${MOLECULE_IMAGE}
pre_build_image: true
Expand All @@ -40,8 +37,7 @@ platforms:
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
networks:
- name: net1
network: net1
provisioner:
name: ansible
verifier:
Expand Down
15 changes: 5 additions & 10 deletions molecule/test10/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
name: single partition, group is partition
driver:
name: docker
name: podman
platforms:
- name: testohpc-login-0
image: ${MOLECULE_IMAGE}
Expand All @@ -15,8 +14,7 @@ platforms:
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
networks:
- name: net1
network: net1
- name: testohpc-compute-0
image: ${MOLECULE_IMAGE}
pre_build_image: true
Expand All @@ -29,8 +27,7 @@ platforms:
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
networks:
- name: net1
network: net1
- name: testohpc-compute-1
image: ${MOLECULE_IMAGE}
pre_build_image: true
Expand All @@ -43,8 +40,7 @@ platforms:
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
networks:
- name: net1
network: net1
- name: testohpc-compute-2
image: ${MOLECULE_IMAGE}
pre_build_image: true
Expand All @@ -56,8 +52,7 @@ platforms:
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
networks:
- name: net1
network: net1
provisioner:
name: ansible
verifier:
Expand Down
12 changes: 4 additions & 8 deletions molecule/test11/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
name: single partition, group is partition
driver:
name: docker
name: podman
platforms:
- name: testohpc-login-0
image: ${MOLECULE_IMAGE}
Expand All @@ -14,8 +13,7 @@ platforms:
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
networks:
- name: net1
network: net1
- name: testohpc-compute-0
image: ${MOLECULE_IMAGE}
pre_build_image: true
Expand All @@ -29,8 +27,7 @@ platforms:
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
networks:
- name: net1
network: net1
- name: testohpc-compute-1
image: ${MOLECULE_IMAGE}
pre_build_image: true
Expand All @@ -43,8 +40,7 @@ platforms:
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
networks:
- name: net1
network: net1
provisioner:
name: ansible
verifier:
Expand Down
12 changes: 4 additions & 8 deletions molecule/test12/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
name: single partition, group is partition
driver:
name: docker
name: podman
platforms:
- name: testohpc-login-0
image: ${MOLECULE_IMAGE}
Expand All @@ -14,8 +13,7 @@ platforms:
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
networks:
- name: net1
network: net1
docker_networks:
- name: net1
driver_options:
Expand All @@ -31,8 +29,7 @@ platforms:
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
networks:
- name: net1
network: net1
- name: testohpc-compute-1
image: ${MOLECULE_IMAGE}
pre_build_image: true
Expand All @@ -44,8 +41,7 @@ platforms:
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
networks:
- name: net1
network: net1
provisioner:
name: ansible
verifier:
Expand Down
18 changes: 6 additions & 12 deletions molecule/test13/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
name: single partition, group is partition
driver:
name: docker
name: podman
platforms:
- name: testohpc-control
image: ${MOLECULE_IMAGE}
Expand All @@ -14,8 +13,7 @@ platforms:
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
networks:
- name: net1
network: net1

- name: testohpc-login-0
image: ${MOLECULE_IMAGE}
Expand All @@ -28,8 +26,7 @@ platforms:
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
networks:
- name: net1
network: net1

- name: testohpc-login-1
image: ${MOLECULE_IMAGE}
Expand All @@ -42,8 +39,7 @@ platforms:
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
networks:
- name: net1
network: net1

- name: testohpc-compute-0
image: ${MOLECULE_IMAGE}
Expand All @@ -56,8 +52,7 @@ platforms:
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
networks:
- name: net1
network: net1
- name: testohpc-compute-1
image: ${MOLECULE_IMAGE}
pre_build_image: true
Expand All @@ -69,8 +64,7 @@ platforms:
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
networks:
- name: net1
network: net1
provisioner:
name: ansible
# ansible_args:
Expand Down
Loading