This commit is contained in:
Luca Bilke 2025-01-11 21:22:54 +01:00
parent 508a9db2f2
commit 933e26b509
17 changed files with 26 additions and 368 deletions

View file

View file

@ -6,7 +6,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, Callable
if TYPE_CHECKING:
from ansible_collections.ssnailed.ez_compose.plugins.module_utils.common import (
from ansible_collections.snailed.ez_compose.plugins.module_utils.common import (
State,
)

View file

@ -5,10 +5,10 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ansible_collections.ssnailed.ez_compose.plugins.module_utils import service
from ansible_collections.snailed.ez_compose.plugins.module_utils import service
if TYPE_CHECKING:
from ansible_collections.ssnailed.ez_compose.plugins.module_utils.common import (
from ansible_collections.snailed.ez_compose.plugins.module_utils.common import (
State,
)

View file

@ -5,10 +5,10 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ansible_collections.ssnailed.ez_compose.plugins.module_utils import service
from ansible_collections.snailed.ez_compose.plugins.module_utils import service
if TYPE_CHECKING:
from ansible_collections.ssnailed.ez_compose.plugins.module_utils.common import (
from ansible_collections.snailed.ez_compose.plugins.module_utils.common import (
State,
)

View file

@ -5,10 +5,10 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ansible_collections.ssnailed.ez_compose.plugins.module_utils import service
from ansible_collections.snailed.ez_compose.plugins.module_utils import service
if TYPE_CHECKING:
from ansible_collections.ssnailed.ez_compose.plugins.module_utils.common import (
from ansible_collections.snailed.ez_compose.plugins.module_utils.common import (
State,
)

View file

@ -5,10 +5,10 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ansible_collections.ssnailed.ez_compose.plugins.module_utils import service
from ansible_collections.snailed.ez_compose.plugins.module_utils import service
if TYPE_CHECKING:
from ansible_collections.ssnailed.ez_compose.plugins.module_utils.common import (
from ansible_collections.snailed.ez_compose.plugins.module_utils.common import (
State,
)

View file

@ -7,13 +7,13 @@ import copy
from dataclasses import replace
from typing import TYPE_CHECKING, Any, Callable
from ansible_collections.ssnailed.ez_compose.plugins.module_utils.common import (
from ansible_collections.snailed.ez_compose.plugins.module_utils.common import (
recursive_update,
update_project,
)
if TYPE_CHECKING:
from ansible_collections.ssnailed.ez_compose.plugins.module_utils.common import (
from ansible_collections.snailed.ez_compose.plugins.module_utils.common import (
State,
)

View file

@ -5,13 +5,13 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ansible_collections.ssnailed.ez_compose.plugins.module_utils import (
from ansible_collections.snailed.ez_compose.plugins.module_utils import (
label,
service,
)
if TYPE_CHECKING:
from ansible_collections.ssnailed.ez_compose.plugins.module_utils.common import (
from ansible_collections.snailed.ez_compose.plugins.module_utils.common import (
State,
)

View file

@ -5,10 +5,10 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ansible_collections.ssnailed.ez_compose.plugins.module_utils import service
from ansible_collections.snailed.ez_compose.plugins.module_utils import service
if TYPE_CHECKING:
from ansible_collections.ssnailed.ez_compose.plugins.module_utils.common import (
from ansible_collections.snailed.ez_compose.plugins.module_utils.common import (
State,
)

View file

@ -5,10 +5,10 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ansible_collections.ssnailed.ez_compose.plugins.module_utils import service
from ansible_collections.snailed.ez_compose.plugins.module_utils import service
if TYPE_CHECKING:
from ansible_collections.ssnailed.ez_compose.plugins.module_utils.common import (
from ansible_collections.snailed.ez_compose.plugins.module_utils.common import (
State,
)

View file

@ -5,10 +5,10 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ansible_collections.ssnailed.ez_compose.plugins.module_utils import service
from ansible_collections.snailed.ez_compose.plugins.module_utils import service
if TYPE_CHECKING:
from ansible_collections.ssnailed.ez_compose.plugins.module_utils.common import (
from ansible_collections.snailed.ez_compose.plugins.module_utils.common import (
State,
)

View file

@ -6,10 +6,10 @@ from __future__ import annotations
import shlex
from typing import TYPE_CHECKING, Any
from ansible_collections.ssnailed.ez_compose.plugins.module_utils import service
from ansible_collections.snailed.ez_compose.plugins.module_utils import service
if TYPE_CHECKING:
from ansible_collections.ssnailed.ez_compose.plugins.module_utils.common import (
from ansible_collections.snailed.ez_compose.plugins.module_utils.common import (
State,
)

View file

@ -6,10 +6,10 @@ from __future__ import annotations
import shlex
from typing import TYPE_CHECKING, Any
from ansible_collections.ssnailed.ez_compose.plugins.module_utils import service
from ansible_collections.snailed.ez_compose.plugins.module_utils import service
if TYPE_CHECKING:
from ansible_collections.ssnailed.ez_compose.plugins.module_utils.common import (
from ansible_collections.snailed.ez_compose.plugins.module_utils.common import (
State,
)

View file

@ -6,7 +6,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ansible_collections.ssnailed.ez_compose.plugins.module_utils.common import (
from ansible_collections.snailed.ez_compose.plugins.module_utils.common import (
State,
)

View file

@ -393,7 +393,7 @@ options:
from typing import Any
from ansible.module_utils.basic import AnsibleModule # type: ignore[reportMissingStubFile]
from ansible_collections.ssnailed.ez_compose.plugins.module_utils import (
from ansible_collections.snailed.ez_compose.plugins.module_utils import (
common,
label,
service,

View file

@ -1,6 +1,6 @@
---
- name: "project | Write compose file: {{ project.name }}"
ssnailed.ez_compose.compose:
snailed.ez_compose.compose:
name: "{{ project.name }}"
services: "{{ project.services }}"
settings: "{{ ez_compose_settings }}"

342
test.yml
View file

@ -1,342 +0,0 @@
---
module: compose
short_description: Simplify docker-compose deployments
description:
- Easily create docker-compose files using a single module
author:
- "Luca Bilke (@ssnailed)"
attributes:
check_mode:
support: full
diff_mode:
support: full
options:
name:
description:
- Name of the compose project to create or modify.
aliases: [project]
type: str
project_dir:
description:
- Path to store project directory under.
type: path
services:
description:
- Services to create in the project.
type: list
elements: dict
suboptions:
custom:
description:
- Custom service definition.
type: dict
suboptions:
name:
description:
- Name of the service.
type: str
image:
description:
- Image to use for service.
type: str
defaults:
description:
- Service definition to be overwritten.
type: dict
overwrite:
description:
- Service definition to overwrite with.
type: dict
internal_network:
description:
- If true, add internal network to service.
type: bool
default: false
label_helpers:
description:
- Label helper configurations.
type: dict
suboptions:
docker_volume_backupper:
description:
- Docker Volume Backupper label helper configuration.
type: dict
suboptions:
stop:
description:
- If true, stop the container when backing up.
type: bool
default: true
traefik_middleware:
description:
- Traefik Middleware label helper configuration.
type: dict
suboptions:
proxy_type:
description:
- Traefik proxy type.
type: str
choices: [http, tcp, udp]
default: http
name:
description:
- Name of the middleware.
- 'Default is generated dynamically like so:
{{ project_name }}_{{ service_name }}_{{ proxy_type }}_{{ middleware }}'
type: string
middleware:
description:
- The traefik middleware to use.
type: str
required: true
settings:
description:
- Middleware options.
type: dict
required: true
traefik_router:
description:
- Traefik Router label helper configuration.
type: dict
suboptions:
proxy_type:
description:
- Traefik proxy type.
type: str
choices: [http, tcp, udp]
default: http
name:
description:
- Name of the middleware.
- 'Default is generated dynamically like so:
"{{ project_name }}_{{ service_name }}_{{ proxy_type }}"'
type: string
rule:
description:
- Routing rule to match.
type: str
required: true
service:
description:
- Traefik service to point at.
type: str
certresolver:
description:
- Certresolver to use.
type: str
entrypoints:
description:
- Entrypoints to listen on.
type: list
elements: str
middlewares:
description:
- Middlewares to use.
type: list
elements: str
traefik_service:
description:
- Traefik Service label helper configuration.
type: dict
suboptions:
proxy_type:
description:
- Traefik proxy type.
type: str
choices: [http, tcp, udp]
default: http
name:
description:
- Name of the middleware.
- 'Default is generated dynamically like so:
"{{ project_name }}_{{ service_name }}_{{ proxy_type }}"'
type: string
port:
description:
- Port to forward to.
type: int
docker_in_docker:
description:
- Docker-in-Docker service definition.
type: dict
suboptions:
name:
description:
- Name of the service.
type: str
image:
description:
- Image to use for service.
type: str
defaults:
description:
- Service definition to be overwritten.
type: dict
overwrite:
description:
- Service definition to overwrite with.
type: dict
docker_socket_proxy:
description:
- Docker Socket Proxy service definition.
type: dict
suboptions:
name:
description:
- Name of the service.
type: str
image:
description:
- Image to use for service.
type: str
defaults:
description:
- Service definition to be overwritten.
type: dict
overwrite:
description:
- Service definition to overwrite with.
type: dict
read_only:
description:
- If true, only allow read access to the docker socket.
type: bool
default: true
docker_volume_backupper:
description:
- Docker Socket Proxy service definition.
type: dict
suboptions:
name:
description:
- Name of the service.
type: str
image:
description:
- Image to use for service.
type: str
defaults:
description:
- Service definition to be overwritten.
type: dict
overwrite:
description:
- Service definition to overwrite with.
type: dict
archive:
description:
- Directory to store backups in.
type: path
backup_volumes:
description:
- List of volume names of volumes to backup.
type: list
elements: str
mariadb:
description:
- MariaDB service definition.
type: dict
suboptions:
name:
description:
- Name of the service.
type: str
image:
description:
- Image to use for service.
type: str
defaults:
description:
- Service definition to be overwritten.
type: dict
overwrite:
description:
- Service definition to overwrite with.
type: dict
backup:
description:
- If true, add labels for the docker volume backupper.
type: bool
database:
description:
- Name of database.
type: str
required: true
username:
description:
- Username for database.
type: str
required: true
password:
description:
- Password for database.
type: str
required: true
root_password:
description:
- Root password for database.
type: str
postgres:
description:
- PostgreSQL service definition.
type: dict
suboptions:
name:
description:
- Name of the service.
type: str
image:
description:
- Image to use for service.
type: str
defaults:
description:
- Service definition to be overwritten.
type: dict
overwrite:
description:
- Service definition to overwrite with.
type: dict
backup:
description:
- If true, add labels for the docker volume backupper.
type: bool
database:
description:
- Name of database.
type: str
required: true
username:
description:
- Username for database.
type: str
required: true
password:
description:
- Password for database.
type: str
required: true
redis:
description:
- Redis service definition.
type: dict
suboptions:
name:
description:
- Name of the service.
type: str
image:
description:
- Image to use for service.
type: str
defaults:
description:
- Service definition to be overwritten.
type: dict
overwrite:
description:
- Service definition to overwrite with.
type: dict