diff --git a/.forgejo/workflows/molecule.yml b/.forgejo/workflows/molecule.yml new file mode 100644 index 0000000..59dc096 --- /dev/null +++ b/.forgejo/workflows/molecule.yml @@ -0,0 +1,18 @@ +--- +on: [push] +jobs: + lint: + runs-on: docker + container: + image: code.waks.be/nishiki/molecule:docker + steps: + - uses: actions/checkout@v3 + - run: ansible-lint . + - run: yamllint . + molecule: + runs-on: docker + container: + image: code.waks.be/nishiki/molecule:docker + steps: + - uses: actions/checkout@v3 + - run: molecule test diff --git a/.yamllint b/.yamllint index 5465b58..2f9af0a 100644 --- a/.yamllint +++ b/.yamllint @@ -2,11 +2,11 @@ extends: default ignore: | - .kitchen/* + .kitchen* vendor/ + .forgejo/ rules: line-length: max: 120 level: warning - truthy: false diff --git a/README.md b/README.md index c3c4484..e2212ff 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,32 @@ # Ansible role: Docker Swarm -[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://framagit.org/artifaille/ansible-role-docker/blob/master/LICENSE) +[![Version](https://img.shields.io/badge/latest_version-1.1.0-green.svg)](https://code.waks.be/nishiki/ansible-role-swarm/releases) +[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://code.waks.be/nishiki/ansible-role-swarm/src/branch/main/LICENSE) +[![Build](https://code.waks.be/nishiki/ansible-role-swarm/actions/workflows/molecule.yml/badge.svg?branch=main)](https://code.waks.be/nishiki/ansible-role-swarm/actions?workflow=molecule.yml) Install and configure docker with swarm ## Requirements -* Ansible >= 2.10 -* Debian Bookworm +- Ansible >= 2.10 +- Debian Bookworm ## Role variables -* `swarm_init` - init the cluster, run once with the ansible option `-e swarm_init=true` (default: `false`) -* `swarm_manager` - set the cluster role (default: `false`) -* `swarm_advertise_addr` - listen address -* `swarm_join_token_manager` - join token for manager (use `docker swarm join-token manager` after init to set this variable) -* `swarm_join_token_worker` - join token for worker (use `docker swarm join-token worker` after init to set this variable) -* `swarm_remote_addrs` - manager addresses for slave node -* `swarm_networks` - array with the docker networks +- `swarm_init` - init the cluster, run once with the ansible option `-e swarm_init=true` (default: `false`) +- `swarm_manager` - set the cluster role (default: `false`) +- `swarm_advertise_addr` - listen address +- `swarm_join_token_manager` - join token for manager (use `docker swarm join-token manager` after init to set this variable) +- `swarm_join_token_worker` - join token for worker (use `docker swarm join-token worker` after init to set this variable) +- `swarm_remote_addrs` - manager addresses for slave node +- `swarm_networks` - array with the docker networks ``` proxy: state: present ``` -* `swarm_services` - hash with the service to manage +- `swarm_services` - hash with the service to manage ``` wordpress: @@ -54,7 +56,7 @@ wordpress: state: present ``` -* `swarm_registry_logins` - hash with the registry logins +- `swarm_registry_logins` - hash with the registry logins ``` gitlab: @@ -64,8 +66,8 @@ gitlab: user: www-data ``` -* `swarm_proxy_url` - set a proxy url for http and https requests -* `swarm_proxy_ignore` - array with ignore host or subnet +- `swarm_proxy_url` - set a proxy url for http and https requests +- `swarm_proxy_ignore` - array with ignore host or subnet ``` - localhost @@ -74,7 +76,7 @@ gitlab: ## How to use - * Install: +- Install: ``` - hosts: server @@ -86,10 +88,10 @@ gitlab: ### Test with molecule and docker -* install [docker](https://docs.docker.com/engine/installation/) -* install `python3` and `python3-pip` -* install molecule and dependencies `pip3 install molecule 'molecule[docker]' docker ansible-lint testinfra yamllint` -* run `molecule test` +- install [docker](https://docs.docker.com/engine/installation/) +- install `python3` and `python3-pip` +- install molecule and dependencies `pip3 install molecule 'molecule[docker]' docker ansible-lint testinfra yamllint` +- run `molecule test` ## License