Skip to content
Open
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
18 changes: 9 additions & 9 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,33 @@ on:
jobs:

list-scenarios:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
outputs:
matrix: ${{ steps.listscenarios.outputs.scenarios }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- id: listscenarios
uses: ome/action-ansible-molecule-list-scenarios@main

test:
name: Test
needs:
- list-scenarios
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
strategy:
# Keep running so we can see if other tests pass
fail-fast: false
matrix:
scenario: ${{fromJson(needs.list-scenarios.outputs.matrix)}}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.12'
- name: Install Ansible & Molecule
run: |
pip install "ansible<8" "ansible-lint<6.13" flake8
pip install "molecule<5" "ansible-compat<4"
pip install "requests" "ansible" "ansible-lint" "flake8"
pip install "molecule" "ansible-compat"
pip install molecule-plugins[docker] pytest-testinfra
- name: Run molecule
run: molecule test -s "${{ matrix.scenario }}"
Expand All @@ -46,7 +46,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags')
needs:
- test
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: galaxy
uses: ome/action-ansible-galaxy-publish@main
Expand Down
4 changes: 2 additions & 2 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ galaxy_info:
description: HAProxy installation and configuration.
company: Open Microscopy Environment
license: "license (BSD, MIT)"
min_ansible_version: 2.3
min_ansible_version: 2.11
platforms:
- name: EL
versions:
- 7
- 9
namespace: ome
galaxy_tags:
- web
Expand Down
22 changes: 0 additions & 22 deletions molecule/default/Dockerfile.j2

This file was deleted.

9 changes: 7 additions & 2 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ lint: |
ansible-lint
flake8
platforms:
- name: haproxy-c7
image: centos/systemd
- name: haproxy-u2204
image: eniocarboni/docker-ubuntu-systemd:22.04
image_version: latest
command: /sbin/init
privileged: true
cgroupns_mode: host
tmpfs:
- /sys/fs/cgroup
groups:
- extra_options
provisioner:
name: ansible
lint:
Expand Down
6 changes: 5 additions & 1 deletion molecule/default/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
hosts: all
pre_tasks:
- name: Install dependencies
package:
become: true
ansible.builtin.apt:
update_cache: true
cache_valid_time: 86400
name:
- curl
- rsyslog
- openssl
state: present

- name: Ensure dummy certificate is in place
command: >-
openssl req -x509 -nodes -days 365 -newkey rsa:2048
Expand Down
4 changes: 2 additions & 2 deletions molecule/default/tests/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@


def test_service_running_and_enabled(host,):
if host.file('/etc/redhat-release').exists:
if host.file('/etc/os-release').exists:
service = host.service('haproxy')
assert service.is_running
assert service.is_enabled
else:
# BUG: testinfra tries to use systemd
out = host.check_output('service haproxy status')
assert out == 'haproxy is running.'
assert out == 'Active: active (running)'


@pytest.mark.parametrize('name', [
Expand Down
22 changes: 21 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
---

- name: Ensure HAProxy is installed
become: true
package:
ansible.builtin.apt:
update_cache: true
cache_valid_time: 86400
name: "{{ haproxy_package_name }}"
state: present

Expand Down Expand Up @@ -59,3 +62,20 @@
- name: Ensure HAProxy is started and enabled on boot.
become: true
service: name=haproxy state=started enabled=yes

# - name: restart haproxy
# become: true
# service:
# name: haproxy
# state: restarted

# - name: Debug output of systemclt rsyslog
# become: true
# ansible.builtin.command:
# systemctl status haproxy
# register: haproxy_status
# ignore_errors: yes

# - name: Show output
# debug:
# msg: "{{ haproxy_status.stdout }}"
Loading