Skip to content
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

Add option to set node name as fqdn #1

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ff08d17
Add option to set node name as fqdn
May 6, 2019
a5bea0c
Add support for wider distro set
Jul 2, 2020
f1be7a6
Add variables to control logging options
Aug 4, 2020
7ae17fb
Remove unnecessary test for pacemaker_corosync_use_logfile
Aug 17, 2020
078f1f8
Update corosync.conf.j2
mpiscaer Aug 20, 2020
9442dd3
add pacemaker-remote
Aug 20, 2020
4a1d613
chnage the condition
Aug 20, 2020
fbb0417
integrating pacemaker-remote
Aug 21, 2020
8b005d9
Update ha repository name for CentOS 8
Jan 11, 2021
94ea02b
Merge pull request #1 from mpiscaer/master
Jan 13, 2021
294be33
Make pacemaker remote optional
Jan 13, 2021
7d66260
Add CI tests
Jan 13, 2021
765c9ea
Merge pull request #3 from noonedeadpunk/ci
Jan 13, 2021
7b64a5f
Update README.md
Jan 13, 2021
70d3c59
Reflect repo rename
Jan 13, 2021
46503a2
Add testing using GitHub Actions
Jun 15, 2022
82badde
Merge pull request #4 from noonedeadpunk/github_actions
noonedeadpunk Jun 15, 2022
90b5fb4
Add compatibility with centos-9
Jun 15, 2022
dacff1e
Merge pull request #5 from jrosser/patch-1
noonedeadpunk Jun 15, 2022
855e21f
Remove usage of fact variables
Apr 10, 2023
0d0313b
Remove CentOS 8 Stream testing
Apr 10, 2023
a0be973
Test molecule with disabled inject_facts_as_vars
Apr 11, 2023
c4a492a
Merge pull request #6 from noonedeadpunk/disable_iject_vars_ci
noonedeadpunk Apr 11, 2023
8218da4
Drop `warn` from command args
Oct 20, 2023
c47c5da
Update testing stack for the role
Jun 14, 2024
4e8dc00
Merge pull request #7 from noonedeadpunk/ansible_2.17
noonedeadpunk Jun 14, 2024
f05132b
Delete .cache folder from the repo
noonedeadpunk Jun 14, 2024
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
57 changes: 57 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Molecule

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
molecule:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
fail-fast: false
matrix:
scenario:
- tag: centos-systemd:stream9
user: quay.io/gotmax23
- tag: debian-systemd:12
user: quay.io/gotmax23
- tag: ubuntu-systemd:20.04
user: quay.io/gotmax23
- tag: ubuntu-systemd:22.04
user: quay.io/gotmax23
python-version:
- "3.10"
ansible-version:
- 2.12.10
- 2.17.0

steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: "${{ github.repository }}"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r ${{ github.repository }}/test-requirements.txt
- name: Install ansible
run: |
python3 -m pip install ansible-core==${{ matrix.ansible-version }}
- name: Install ansible collections
run: |
ansible-galaxy install -r ${{ github.repository }}/test-requirements.yml
- name: Test with molecule
run: |
cd ${{ github.repository }}
export docker_image_tag="${{ matrix.scenario.tag }}"
export docker_user="${{ matrix.scenario.user }}"
python3 -m molecule test
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.vagrant
vagrant

.cache
14 changes: 14 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
rules:
line-length: disable
truthy:
allowed-values:
- 'True'
- 'true'
- 'yes'
- 'False'
- 'false'
- 'no'

ignore: |
.github/
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
ansible-pacemaker-corosync role
ansible-role-pacemaker_corosync [![Build Status](https://github.com/noonedeadpunk/ansible-pacemaker-corosync/actions/workflows/main.yml/badge.svg?branch=master)]

===============================

Deploys corosync/pacemaker on Ubuntu 14.04
Deploys corosync/pacemaker

# Variables

- `pacemaker_corosync_group`: Ansible group name for corosync cluster (default: false, *mandatory*)
- `pacemaker_remote_group`: Ansible group name for pacemaker-remote cluster (default: false, *mandatory*)
- `pacemaker_corosync_ring_interface`: Interface to use for ring0 communications (default: false, *mandatory*)

- `pacemaker_remote_ring_interface`: Interface to use for ring0 communications on remote hosts (default: pacemaker_corosync_ring_interface)
- `pacemaker_corosync_fqdn`: Whether use inventory_hostname or ansible_fqdn as node name for corosync (default: false)
13 changes: 13 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
---

pacemaker_corosync_fqdn: false
pacemaker_corosync_group: false
pacemaker_remote_group: false
pacemaker_corosync_ring_interface: false
pacemaker_remote_ring_interface: "{{ pacemaker_corosync_ring_interface }}"
pacemaker_corosync_use_syslog: true
pacemaker_corosync_use_logfile: false


# Centos EPEL repository options (for haveged)
pacemaker_corosync_haveged_enabled: True
pacemaker_corosync_centos_epel_mirror: "{{ centos_epel_mirror | default('http://download.fedoraproject.org/pub/epel') }}"
pacemaker_corosync_centos_epel_key: "{{ centos_epel_key | default('http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-' ~ ansible_facts['distribution_major_version']) }}"
7 changes: 7 additions & 0 deletions examples/play.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

- name: Install pacemaker-corosync
hosts: "{{ pacemaker_corosync_group }}"
become: true
roles:
- pacemaker_corosync
2 changes: 1 addition & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
service:
name: "{{ item }}"
state: restarted
enabled: yes
with_items:
- corosync
- pacemaker
23 changes: 15 additions & 8 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@
dependencies: []

galaxy_info:
author: Michel Blanc
author: Dmitriy Rabotyagov
company: ACME Corp
description: ansible-pacemaker-corosync role
namespace: noonedeadpunk
role_name: pacemaker_corosync
description: Deploys pacemaker and corosync stack.
license: MIT
min_ansible_version: 1.6
min_ansible_version: 2.6
platforms:
- name: Ubuntu
versions:
- all
categories:
- system
- name: Ubuntu
versions:
- bionic
- focal
- name: EL
versions:
- 7
- 8
galaxy_tags:
- system
10 changes: 10 additions & 0 deletions molecule/default/cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Prepare molecule instance
hosts: all[0]
gather_facts: no
tasks:
- name: Create a network with custom IPAM config
delegate_to: localhost
community.general.docker_network:
name: pacemaker-network
state: absent
41 changes: 41 additions & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
- name: Converge
hosts: all
vars_files:
- "tests/pacemaker_corosync_local.yml"
pre_tasks:
- name: Apt update and install rsync, ping, iproute
apt:
update_cache: yes
name:
- rsync
- inetutils-ping
- iproute2
state: present
when: ansible_facts['os_family'] == "Debian"

- name: Yum install iproute to fix undefined ansible_default_ipv4.address
yum:
name: iproute
state: present
when:
- ansible_facts['distribution'] == "CentOS"

- name: Add a container to a network, leaving existing containers connected
delegate_to: localhost
community.general.docker_network:
name: pacemaker-network
connected:
- "{{ inventory_hostname }}"
appends: yes

- name: Re-collect network facts required after installation iproute
setup:
gather_subset: network

- name: Show ansible_interfaces
debug:
var: ansible_facts['interfaces']

roles:
- role: "{{ playbook_dir | dirname | dirname | basename }}"
27 changes: 27 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
lint: |
set -e
yamllint .
ansible-lint -vv --exclude=.tox --exclude=molecule/default/converge.yml -x 204,208
dependency:
name: galaxy
driver:
name: docker
verifier:
name: ansible
provisioner:
name: ansible
options:
v: True
log: True
config_options:
defaults:
inject_facts_as_vars: false
platforms:
- name: pacemaker
image: "${docker_user:-quay.io/gotmax23}/${docker_image_tag:-ubuntu-systemd:focal}"
command: ""
pre_build_image: true
groups:
- corosync
privileged: true
12 changes: 12 additions & 0 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Prepare molecule instance
hosts: all[0]
tasks:
- name: Create a network with custom IPAM config
delegate_to: localhost
community.general.docker_network:
name: pacemaker-network
ipam_config:
- subnet: 192.168.33.0/24
gateway: 192.168.33.254
iprange: 192.168.33.0/26
4 changes: 4 additions & 0 deletions molecule/default/tests/pacemaker_corosync_local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---

pacemaker_corosync_group: corosync
pacemaker_corosync_ring_interface: eth1
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ansible==2.10.5
docker==4.4.1
molecule[docker]==3.2.2
ansible-lint==4.3.7
14 changes: 12 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
- include: check_vars.yml tags=pacemaker,check
- include: pacemaker.yml tags=pacemaker
---

- name: Importing variables check
import_tasks: check_vars.yml
tags:
- pacemaker
- check

- name: Importing pacemaker tasks
import_tasks: pacemaker.yml
tags:
- pacemaker
Loading