Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
3da21e0e2f | |||
3290f8c2c6 | |||
|
d68d96015e | ||
|
df476f1c61 | ||
|
14a67f676b | ||
|
4fc2d8547f | ||
|
c8a2518b31 | ||
|
23ab24282c | ||
|
effb62c3e6 | ||
|
ec7c196064 | ||
|
5eca1af323 | ||
|
e98f0e954e | ||
|
6c4ccbaab1 | ||
|
1777cb4e80 | ||
|
170edc1cd0 | ||
|
051847001f | ||
|
411f1360e0 |
10
.ansible-lint
Normal file
10
.ansible-lint
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
exclude_paths:
|
||||||
|
- .github/
|
||||||
|
- molecule/
|
||||||
|
|
||||||
|
warn_list:
|
||||||
|
- internal-error
|
||||||
|
|
||||||
|
# vi: ft=yaml
|
5
.github/workflows/release.yml
vendored
5
.github/workflows/release.yml
vendored
@ -1,3 +1,4 @@
|
|||||||
|
---
|
||||||
name: Release
|
name: Release
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@ -9,7 +10,6 @@ env:
|
|||||||
GALAXY_USERNAME: IronicBadger
|
GALAXY_USERNAME: IronicBadger
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -29,4 +29,5 @@ jobs:
|
|||||||
- name: Trigger a new import on Galaxy.
|
- name: Trigger a new import on Galaxy.
|
||||||
run: >-
|
run: >-
|
||||||
ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }}
|
ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }}
|
||||||
$(echo ${{ env.GALAXY_USERNAME }}) $(echo ${{ github.repository }} | cut -d/ -f2)
|
$(echo ${{ env.GALAXY_USERNAME }})
|
||||||
|
$(echo ${{ github.repository }} | cut -d/ -f2)
|
||||||
|
8
.yamllint
Normal file
8
.yamllint
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
extends: default
|
||||||
|
|
||||||
|
ignore: |
|
||||||
|
.github/
|
||||||
|
|
||||||
|
# vi: ft=yaml
|
18
README.md
18
README.md
@ -45,6 +45,7 @@ containers:
|
|||||||
active: true
|
active: true
|
||||||
image: nextcloud
|
image: nextcloud
|
||||||
container_name: nextcloud
|
container_name: nextcloud
|
||||||
|
user: www-data
|
||||||
include_global_env_vars: false
|
include_global_env_vars: false
|
||||||
volumes:
|
volumes:
|
||||||
- "{{ appdata_path }}/nextcloud/html:/var/www/html"
|
- "{{ appdata_path }}/nextcloud/html:/var/www/html"
|
||||||
@ -78,4 +79,21 @@ containers:
|
|||||||
mem_limit: 128m
|
mem_limit: 128m
|
||||||
ports:
|
ports:
|
||||||
- "4242:4242"
|
- "4242:4242"
|
||||||
|
- service_name: netbox
|
||||||
|
active: true
|
||||||
|
image: docker.io/netboxcommunity/netbox:v3.6-2.7.0
|
||||||
|
anchor: netbox
|
||||||
|
user: "unit:root"
|
||||||
|
- service_name: netbox-worker
|
||||||
|
active: true
|
||||||
|
fragment: netbox
|
||||||
|
command:
|
||||||
|
- /opt/netbox/venv/bin/python
|
||||||
|
- /opt/netbox/netbox/manage.py
|
||||||
|
- rqworker
|
||||||
|
- service_name: netbox-housekeeping
|
||||||
|
active: true
|
||||||
|
fragment: netbox
|
||||||
|
command:
|
||||||
|
- /opt/netbox/housekeeping.sh
|
||||||
```
|
```
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
---
|
---
|
||||||
docker_compose_generator_output_path: "~"
|
docker_compose_generator_output_path: "~"
|
||||||
docker_compose_generator_uid: "1000"
|
docker_compose_generator_uid: "1000"
|
||||||
docker_compose_generator_gid: "1000"
|
docker_compose_generator_gid: "1000"
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
---
|
---
|
||||||
galaxy_info:
|
galaxy_info:
|
||||||
role_name: docker_compose_generator
|
role_name: docker_compose_generator
|
||||||
|
namespace: ironicbadger
|
||||||
author: Alex Kretzschmar
|
author: Alex Kretzschmar
|
||||||
description: Create a docker-compose.yml file
|
description: Create a docker-compose.yml file
|
||||||
issue_tracker_url: https://github.com/ironicbadger/ansible-role-create-users/issues
|
issue_tracker_url: "https://github.com/ironicbadger/\
|
||||||
|
ansible-role-create-users/issues"
|
||||||
license: GPLv2
|
license: GPLv2
|
||||||
min_ansible_version: 2.4
|
min_ansible_version: 2.4
|
||||||
platforms:
|
platforms:
|
||||||
|
8
molecule/default/converge.yml
Normal file
8
molecule/default/converge.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
- name: Converge
|
||||||
|
hosts: all
|
||||||
|
vars_files:
|
||||||
|
- vars.yml
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- ansible.builtin.import_tasks: ../../tasks/main.yaml
|
21
molecule/default/molecule.yml
Normal file
21
molecule/default/molecule.yml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
dependency:
|
||||||
|
name: galaxy
|
||||||
|
driver:
|
||||||
|
name: docker
|
||||||
|
lint: |
|
||||||
|
set -e
|
||||||
|
yamllint .
|
||||||
|
ansible-lint
|
||||||
|
platforms:
|
||||||
|
- name: instance
|
||||||
|
image: geerlingguy/docker-debian11-ansible:latest
|
||||||
|
command: ""
|
||||||
|
volumes:
|
||||||
|
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||||
|
priveleged: true
|
||||||
|
pre_build_image: true
|
||||||
|
provisioner:
|
||||||
|
name: ansible
|
||||||
|
verifier:
|
||||||
|
name: ansible
|
3
molecule/default/requirements.yml
Normal file
3
molecule/default/requirements.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
collections:
|
||||||
|
- community.docker
|
9
molecule/default/vars.yml
Normal file
9
molecule/default/vars.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
containers:
|
||||||
|
- name: apache2
|
||||||
|
active: true
|
||||||
|
image: ubuntu/apache2:2.4-22.04_beta
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
environment:
|
||||||
|
- TZ=UTC
|
9
molecule/default/verify.yml
Normal file
9
molecule/default/verify.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
- name: Verify
|
||||||
|
hosts: all
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Verify Apache is serving web requests.
|
||||||
|
ansible.builtin.uri:
|
||||||
|
url: http://localhost/
|
||||||
|
status_code: 200
|
@ -1,12 +1,14 @@
|
|||||||
---
|
---
|
||||||
- name: ensure destination for compose file exists
|
- name: Ensure destination for compose file exists
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ docker_compose_generator_output_path }}"
|
path: "{{ docker_compose_generator_output_path }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
- name: write docker-compose file
|
- name: Write docker-compose file
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: ../templates/docker-compose.yml.j2
|
src: docker-compose.yml.j2
|
||||||
dest: "{{ docker_compose_generator_output_path }}/docker-compose.yml"
|
dest: "{{ docker_compose_generator_output_path }}/docker-compose.yml"
|
||||||
owner: "{{ docker_compose_generator_uid }}"
|
owner: "{{ docker_compose_generator_uid }}"
|
||||||
group: "{{ docker_compose_generator_gid }}"
|
group: "{{ docker_compose_generator_gid }}"
|
||||||
|
mode: 0644
|
||||||
|
@ -3,8 +3,13 @@
|
|||||||
services:
|
services:
|
||||||
{% for container in containers %}
|
{% for container in containers %}
|
||||||
{% if container.active %}
|
{% if container.active %}
|
||||||
{{ container.service_name }}:
|
{{ container.service_name }}:{% if container.anchor is defined %} &{{ container.anchor }}{% endif %}
|
||||||
|
|
||||||
|
{% if container.fragment is defined %}
|
||||||
|
<<: *{{ container.fragment }}
|
||||||
|
{% else %}
|
||||||
image: {{ container.image }}
|
image: {{ container.image }}
|
||||||
|
{% endif %}
|
||||||
container_name: {{ container.container_name | default(container.service_name) }}
|
container_name: {{ container.container_name | default(container.service_name) }}
|
||||||
{% if container.extra_hosts is defined %}
|
{% if container.extra_hosts is defined %}
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
@ -15,9 +20,30 @@ services:
|
|||||||
{% if container.network_mode is defined %}
|
{% if container.network_mode is defined %}
|
||||||
network_mode: {{ container.network_mode }}
|
network_mode: {{ container.network_mode }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if container.networks is defined %}
|
||||||
|
networks:
|
||||||
|
{% if container.networks is iterable and (container.networks is not string and container.networks is not mapping) %}
|
||||||
|
{% for network in container.networks %}
|
||||||
|
- {{ network }}
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
{% for network, params in container.networks.items() %}
|
||||||
|
{{ network }}:
|
||||||
|
{% if params.aliases is defined %}
|
||||||
|
aliases:
|
||||||
|
{% for alias in params.aliases %}
|
||||||
|
- {{ alias }}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
{% if container.build is defined %}
|
{% if container.build is defined %}
|
||||||
build: {{ container.build }}
|
build: {{ container.build }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if container.user is defined %}
|
||||||
|
user: {{ container.user }}
|
||||||
|
{% endif %}
|
||||||
{% if container.privileged is defined %}
|
{% if container.privileged is defined %}
|
||||||
privileged: {{ container.privileged }}
|
privileged: {{ container.privileged }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -33,6 +59,9 @@ services:
|
|||||||
- {{ group }}
|
- {{ group }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if container.runtime is defined %}
|
||||||
|
runtime: {{ container.runtime }}
|
||||||
|
{% endif %}
|
||||||
{% if container.devices is defined %}
|
{% if container.devices is defined %}
|
||||||
devices:
|
devices:
|
||||||
{% for device in container.devices %}
|
{% for device in container.devices %}
|
||||||
@ -46,17 +75,25 @@ services:
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if container.labels is defined %}
|
{% if container.labels is defined %}
|
||||||
|
{% if container.labels is none %}
|
||||||
|
labels: []
|
||||||
|
{% else %}
|
||||||
labels:
|
labels:
|
||||||
{% for label in container.labels %}
|
{% for label in container.labels %}
|
||||||
- {{ label }}
|
- {{ label }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
{% if container.ports is defined %}
|
{% if container.ports is defined %}
|
||||||
|
{% if container.ports is none %}
|
||||||
|
ports: []
|
||||||
|
{% else %}
|
||||||
ports:
|
ports:
|
||||||
{% for port in container.ports %}
|
{% for port in container.ports %}
|
||||||
- {{ port }}
|
- {{ port }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
{% if container.expose is defined %}
|
{% if container.expose is defined %}
|
||||||
expose:
|
expose:
|
||||||
{% for expose_port in container.expose %}
|
{% for expose_port in container.expose %}
|
||||||
@ -197,3 +234,17 @@ services:
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% if docker_networks is defined %}
|
||||||
|
networks:
|
||||||
|
{% for network in docker_networks %}
|
||||||
|
{% if network.active %}
|
||||||
|
{{ network.network_name }}:
|
||||||
|
{% if network.external is defined %}
|
||||||
|
external: {{ network.external }}
|
||||||
|
{% endif %}
|
||||||
|
{% if network.driver is defined %}
|
||||||
|
driver: {{ network.driver }}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user