Skip to content

Commit 82badde

Browse files
Merge pull request #4 from noonedeadpunk/github_actions
Add testing using GitHub Actions
2 parents 70d3c59 + 46503a2 commit 82badde

File tree

12 files changed

+114
-81
lines changed

12 files changed

+114
-81
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../..

.github/workflows/main.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Molecule
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
molecule:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
max-parallel: 4
16+
fail-fast: false
17+
matrix:
18+
scenario:
19+
- centos-systemd:stream8
20+
- centos-systemd:stream9
21+
- debian-systemd:11
22+
- ubuntu-systemd:20.04
23+
- ubuntu-systemd:22.04
24+
python-version:
25+
- 3.8
26+
ansible-version:
27+
- 2.12.6
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v2
32+
with:
33+
path: "${{ github.repository }}"
34+
- name: Set up Python ${{ matrix.python-version }}
35+
uses: actions/setup-python@v3
36+
with:
37+
python-version: ${{ matrix.python-version }}
38+
- name: Install dependencies
39+
run: |
40+
python3 -m pip install --upgrade pip
41+
python3 -m pip install -r ${{ github.repository }}/test-requirements.txt
42+
- name: Install ansible
43+
run: |
44+
python3 -m pip install ansible-core==${{ matrix.ansible-version }}
45+
- name: Install ansible collections
46+
run: |
47+
ansible-galaxy install -r ${{ github.repository }}/test-requirements.yml
48+
- name: Test with molecule
49+
run: |
50+
cd ${{ github.repository }}
51+
export docker_image_tag="${{ matrix.scenario }}"
52+
python3 -m molecule test

.travis.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.yamllint.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
rules:
3+
line-length: disable
34
truthy:
45
allowed-values:
56
- 'True'
@@ -8,3 +9,6 @@ rules:
89
- 'False'
910
- 'false'
1011
- 'no'
12+
13+
ignore: |
14+
.github/

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
ansible-role-pacemaker_corosync [![Build Status](https://travis-ci.org/noonedeadpunk/ansible-role-pacemaker_corosync.svg?branch=master)](https://travis-ci.org/noonedeadpunk/ansible-role-pacemaker_corosync)
1+
ansible-role-pacemaker_corosync [![Build Status](https://github.com/noonedeadpunk/ansible-pacemaker-corosync/actions/workflows/main.yml/badge.svg?branch=master)]
2+
23
===============================
34

45
Deploys corosync/pacemaker

meta/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ dependencies: []
55
galaxy_info:
66
author: Dmitriy Rabotyagov
77
company: ACME Corp
8+
namespace: noonedeadpunk
89
role_name: pacemaker_corosync
910
description: Deploys pacemaker and corosync stack.
1011
license: MIT

molecule/default/converge.yml

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,41 @@
11
---
22
- name: Converge
33
hosts: all
4-
tasks:
5-
- name: Apt update and install rsync, ping, iproute
6-
apt:
7-
update_cache: yes
8-
name:
9-
- rsync
10-
- inetutils-ping
11-
- iproute2
12-
state: present
13-
when: ansible_os_family == "Debian"
4+
vars_files:
5+
- "tests/pacemaker_corosync_local.yml"
6+
pre_tasks:
7+
- name: Apt update and install rsync, ping, iproute
8+
apt:
9+
update_cache: yes
10+
name:
11+
- rsync
12+
- inetutils-ping
13+
- iproute2
14+
state: present
15+
when: ansible_os_family == "Debian"
1416

15-
- name: Yum install iproute to fix undefined ansible_default_ipv4.address
16-
yum:
17-
name: iproute
18-
state: present
19-
when:
20-
- ansible_distribution == "CentOS"
21-
- ansible_distribution_major_version == "7"
17+
- name: Yum install iproute to fix undefined ansible_default_ipv4.address
18+
yum:
19+
name: iproute
20+
state: present
21+
when:
22+
- ansible_distribution == "CentOS"
2223

23-
- name: Add a container to a network, leaving existing containers connected
24-
delegate_to: localhost
25-
community.general.docker_network:
26-
name: pacemaker-network
27-
connected:
28-
- "{{ inventory_hostname }}"
29-
appends: yes
24+
- name: Add a container to a network, leaving existing containers connected
25+
delegate_to: localhost
26+
community.general.docker_network:
27+
name: pacemaker-network
28+
connected:
29+
- "{{ inventory_hostname }}"
30+
appends: yes
3031

31-
- name: Re-collect network facts required after installation iproute
32-
setup:
33-
gather_subset: network
32+
- name: Re-collect network facts required after installation iproute
33+
setup:
34+
gather_subset: network
3435

35-
- name: Show ansible_interfaces
36-
debug:
37-
var: ansible_interfaces
36+
- name: Show ansible_interfaces
37+
debug:
38+
var: ansible_interfaces
3839

39-
- name: Include keepalived vars
40-
include_vars: "tests/pacemaker_corosync_local.yml"
41-
42-
- name: "Include ansible-role-pacemaker-corosync"
43-
include_role:
44-
name: "ansible-role-pacemaker_corosync"
40+
roles:
41+
- role: "{{ playbook_dir | dirname | dirname | basename }}"

molecule/default/molecule.yml

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
lint: |
33
set -e
44
yamllint .
5-
ansible-lint -vv --exclude=.tox -x 204,208
5+
ansible-lint -vv --exclude=.tox --exclude=molecule/default/converge.yml -x 204,208
66
dependency:
77
name: galaxy
88
driver:
@@ -15,34 +15,10 @@ provisioner:
1515
v: True
1616
log: True
1717
platforms:
18-
- name: pacemaker-centos7
19-
image: diodonfrost/ansible-centos:7
18+
- name: pacemaker
19+
image: "${docker_user:-quay.io/gotmax23}/${docker_image_tag:-ubuntu-systemd:focal}"
20+
command: ""
21+
pre_build_image: true
2022
groups:
2123
- corosync
2224
privileged: true
23-
volumes:
24-
- /sys/fs/cgroup:/sys/fs/cgroup:ro
25-
26-
- name: pacemaker-centos8
27-
image: diodonfrost/ansible-centos:8
28-
groups:
29-
- corosync
30-
privileged: true
31-
volumes:
32-
- /sys/fs/cgroup:/sys/fs/cgroup:ro
33-
34-
- name: pacemaker-bionic
35-
image: travisci/ubuntu-systemd:18.04
36-
groups:
37-
- corosync
38-
privileged: true
39-
volumes:
40-
- /sys/fs/cgroup:/sys/fs/cgroup:ro
41-
42-
- name: pacemaker-focal
43-
image: travisci/ubuntu-systemd:20.04
44-
privileged: true
45-
groups:
46-
- corosync
47-
volumes:
48-
- /sys/fs/cgroup:/sys/fs/cgroup:ro

tasks/pacemaker.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@
137137
file:
138138
path: /var/log/corosync
139139
state: directory
140+
mode: "0775"
140141
when: pacemaker_corosync_use_logfile | bool
141142

142143
- name: Adds logrotate config for corosync
@@ -151,6 +152,7 @@
151152
file:
152153
path: /etc/corosync/service.d/
153154
state: directory
155+
mode: "0755"
154156

155157
- name: Adds pacemaker service
156158
copy:
@@ -164,6 +166,7 @@
164166
template:
165167
src: "ferm.j2"
166168
dest: /etc/ferm/filter-input.d/60_corosync.conf
169+
mode: "0640"
167170
when: ferm_enabled | default(false)
168171
tags: ferm
169172
notify: Restart ferm

test-requirements.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
bashate>=0.2 # Apache-2.0
2+
flake8<2.6.0,>=2.5.4 # MIT
3+
docker==5.0.3
4+
molecule==3.6.1
5+
molecule-docker==1.1.0
6+
ansible-lint==5.0.10
7+
rich>=9.5.1,<11.0.0

0 commit comments

Comments
 (0)