Ansible Collection Development Repository
  • Shell 51.3%
  • Jinja 40.5%
  • Dockerfile 8.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Arnaud Véron edf29d7488
All checks were successful
opensvc.cluster / sanity (ansible-core 2.20, python 3.12) (push) Successful in 30s
opensvc.cluster / sanity (ansible-core 2.21, python 3.12) (push) Successful in 32s
opensvc.cluster / lint (ansible-core 2.16, python 3.12) (push) Successful in 34s
opensvc.cluster / lint (ansible-core 2.20, python 3.12) (push) Successful in 44s
opensvc.cluster / lint (ansible-core 2.21, python 3.12) (push) Successful in 45s
opensvc.cluster_v3 / sanity (ansible-core 2.16, python 3.12) (push) Successful in 37s
opensvc.cluster_v3 / sanity (ansible-core 2.19, python 3.12) (push) Successful in 32s
opensvc.cluster_v3 / sanity (ansible-core 2.20, python 3.12) (push) Successful in 32s
opensvc.cluster_v3 / sanity (ansible-core 2.21, python 3.12) (push) Successful in 30s
opensvc.cluster_v3 / sanity (ansible-core 2.22, python 3.13) (push) Successful in 31s
opensvc.cluster / sanity (ansible-core 2.16, python 3.12) (push) Successful in 35s
opensvc.cluster_v3 / lint (ansible-core 2.16, python 3.12) (push) Successful in 25s
opensvc.cluster_v3 / lint (ansible-core 2.19, python 3.12) (push) Successful in 29s
opensvc.cluster_v3 / lint (ansible-core 2.20, python 3.12) (push) Successful in 29s
opensvc.cluster_v3 / lint (ansible-core 2.21, python 3.12) (push) Successful in 27s
opensvc.cluster_v3 / lint (ansible-core 2.22, python 3.13) (push) Successful in 26s
[cluster_v3] Release 1.5.1
2026-12-02 13:30:28 +01:00
.forgejo/workflows Run the CI jobs in the slim python images 2026-12-02 09:37:12 +01:00
ansible_collections/opensvc [cluster_v3] Release 1.5.1 2026-12-02 13:30:28 +01:00
examples Fix the lint of the example playbooks 2026-12-02 10:27:49 +01:00
.gitignore Stop tracking the generated requirements files 2026-12-02 08:11:31 +01:00
build.img.sh Fix the default command of the images, run every check 2026-12-02 10:07:43 +01:00
docker-entrypoint.sh Fix the default command of the images, run every check 2026-12-02 10:07:43 +01:00
Dockerfile Fix the default command of the images, run every check 2026-12-02 10:07:43 +01:00
Dockerfile.dev Fix the default command of the images, run every check 2026-12-02 10:07:43 +01:00
README.md Point the links to the forge repository 2026-12-02 10:12:30 +01:00
requirements.dev.txt Add ansible-core 2022-01-26 11:19:14 +01:00
requirements.dev.yml Update docker image build 2021-05-20 14:54:15 +02:00
requirements.template.txt Build images based on ansible versions 2022-01-26 11:21:40 +01:00

Ansible Collection Development Repository

OpenSVC supports Ansible for cluster deployment and configuration. This repository includes an Ansible collection with multiple roles and example playbooks, allowing users to easilly build OpenSVC clusters. It is also organised to develop and contribute to this project. Please refer to Getting Started section of this readme.

Ansible Collections

Please refer to Ansible Collections Documentation for any questions related to this new way of delivering Ansible contents (introduced by ansible version 2.9.0)

Getting Started

There are multiple ways of using the collection, they are described below

Prerequisites

This repository requires some products to be installed:

Collection usage

  • ansible-core >= 2.16.0
  • docker, to use the collection images

Ansible version compatibility

The collections require ansible-core >= 2.16. They have been tested with ansible-core 2.16, 2.19, 2.20, 2.21 and 2.22 (beta), the docker images being built for the Ansible releases on a maintained ansible-core (see build.img.sh).

They have been tested on Ubuntu 20.04, 22.04, 24.04, 26.04 and RHEL 7, 8, 9, 10 nodes. The managed nodes python version limits the ansible-core version:

Nodes Python ansible-core
RHEL 7, RHEL 8 3.6 <= 2.16
Ubuntu 20.04 3.8 <= 2.19
RHEL 9, 10, Ubuntu 22.04+ >= 3.9 all

Option 1 : Using Ansible Galaxy and ansible-galaxy to install the collection

$ ansible-galaxy collection install opensvc.cluster
Process install dependency map
Starting collection install process
Installing 'opensvc.cluster:0.0.1' to '~/.ansible/collections/ansible_collections/opensvc/cluster'

Option 2 : Installing the collection from the git repository

You can git clone this repository, and build yourself the collection, to finally install it

Git clone the repo

user@node:~/dev$ git clone https://forge.opensvc.com/opensvc/ansible-collection.git

Install the collection

user@node:~/dev$ cd ansible-collection
user@node:~/dev/ansible-collection$ ansible-galaxy collection build --force ansible_collections/opensvc/cluster
user@node:~/dev/ansible-collection$ ansible-galaxy collection install opensvc-cluster-<VERSION>.tar.gz

Some example playbooks are available in the examples folder. After updating the inventory file to reflect your environment, you can run a playbook with the command below:

$ cd examples
$ ansible-playbook -i inventory playbook.yml

Please refer to OpenSVC Galaxy Documentation for more detailed usages of the collection.


Option 3 : Testing/Contributing to the collection

Git clone the repo

user@node:~/dev$ git clone https://forge.opensvc.com/opensvc/ansible-collection.git

You can contribute to this collection by using the development environment:

  1. Implement changes, patches, to the collection structure ansible-collection/ansible_collections/*. You don't have to commit your changes for testing purposes.
  2. Build the docker image
  • install all prerequisites

  • embedds the current collection with your changes

    build.img.sh writes the requirements.<version>.txt file of each Ansible release it supports (generated files, not tracked by git) and prints the build commands. Run it, then the docker build command of the release you want, here tagged osvccol:test:

    user@node:~/dev$ cd ansible-collection
    user@node:~/dev/ansible-collection$ ./build.img.sh
    user@node:~/dev/ansible-collection$ docker build --network host --build-arg PYTHON_IMAGE=<python image> --build-arg REQUIREMENTS_FILE=requirements.<version>.txt -f Dockerfile -t osvccol:test .
    
  1. Spawn a docker container using the new image, and start testing your changes using the bind mounted examples directory

    user@node:~/dev/ansible-collection$ docker run --rm -v $HOME/dev/ansible-collection/examples:/examples -it osvccol:test /bin/sh
    /examples # 
    
  2. Update inventory and ssh.private.key files

    /examples # ls -l
    total 40
    -rw-r--r--    1 1000     1000           140 Mar 25 16:42 ansible.cfg
    -rw-r--r--    1 1000     1000           226 Mar 25 16:08 inventory
    -rw-r--r--    1 1000     1000           233 Mar 25 16:36 playbook-provision-cluster.yml
    -rw-r--r--    1 1000     1000           151 Mar 23 11:17 playbook-unprovision-cluster.yml
    -rw-r--r--    1 1000     1000           152 Mar 23 11:23 playbook-unprovision-services.yml
    -rwx------    1 1000     1000          3243 Mar 23 09:23 ssh.private.key
    

    Note: You must create the ssh.private.key file with your personal private key, to make ssh connection work fine.

    /examples # cat inventory 
    [clusternodes]
    demo1.acme.com ansible_host="1.1.1.1" ansible_ssh_private_key_file="ssh.private.key"
    demo2.acme.com ansible_host="2.2.2.2" ansible_ssh_private_key_file="ssh.private.key"
    
    [webservers]
    web1.acme.com
    web2.acme.com
    
    [dbservers]
    db1.acme.com
    db2.acme.com
    
  3. Run a playbook to provision a cluster using members of the clusternodes group

    /examples # ansible-playbook -i inventory playbook-provision-cluster.yml --limit clusternodes
    

If your changes are ok, and you want to share them with the community, send them as patches (git format-patch) to ansible@opensvc.com, with your questions and bug reports.

If you need to rework your changes, just follow those steps :

  1. Exit the docker container with exit or CTRL+d
  2. Fix your code
  3. Update the docker image, with the same docker build command as above
  4. Spawn a new docker container
    user@node:~/dev/ansible-collection$ docker run --rm -v $HOME/dev/ansible-collection/examples:/examples -it osvccol:test /bin/sh
    
  5. Repeat your tests
    /examples # ansible-playbook -i inventory playbook-provision-cluster.yml --limit clusternodes
    

Note

The Dockerfile ends with a call to an entrypoint docker-entrypoint.sh which by default run a syntax check and lint every playbook found in the examples directory.

user@node:~/dev/ansible-collection$ docker run --rm -v $PWD/examples:/examples -it osvccol:test

=> Start syntax checking & linting for playbook playbook-provision-cluster-with-relay-heartbeat.yml

playbook: playbook-provision-cluster-with-relay-heartbeat.yml
Examining playbook-provision-cluster-with-relay-heartbeat.yml of type playbook
=> End of syntax checking & linting for playbook playbook-provision-cluster-with-relay-heartbeat.yml

=> Start syntax checking & linting for playbook playbook-provision-cluster.yml

playbook: playbook-provision-cluster.yml
Examining playbook-provision-cluster.yml of type playbook
=> End of syntax checking & linting for playbook playbook-provision-cluster.yml

=> Start syntax checking & linting for playbook playbook-unprovision-cluster.yml

playbook: playbook-unprovision-cluster.yml
Examining playbook-unprovision-cluster.yml of type playbook
=> End of syntax checking & linting for playbook playbook-unprovision-cluster.yml

=> Start syntax checking & linting for playbook playbook-unprovision-services.yml

playbook: playbook-unprovision-services.yml
Examining playbook-unprovision-services.yml of type playbook
=> End of syntax checking & linting for playbook playbook-unprovision-services.yml