xoxys.droneci/templates/services/droneci_compose.yml.j2

86 lines
3.0 KiB
Plaintext
Raw Normal View History

2018-12-13 22:09:22 +00:00
#jinja2:lstrip_blocks: True
2019-08-27 20:04:33 +00:00
{{ ansible_managed | comment }}
version: "2"
2018-12-13 22:09:22 +00:00
services:
droneci:
container_name: {{ droneci_container_name }}
image: {{ droneci_image }}
{% if droneci_exposed_ports | default([]) %}
2018-12-13 22:09:22 +00:00
ports:
{% for port in droneci_exposed_ports %}
- {{ port | quote }}
{% endfor %}
{% endif %}
{% if droneci_volumes | default([]) %}
2018-12-13 22:09:22 +00:00
volumes:
{% for volume in droneci_volumes %}
- "{{ volume.name }}:{{ volume.dest }}"
{% endfor %}
{% endif %}
{% if droneci_networks_applied | default([]) %}
networks:
{% for network in droneci_networks_applied %}
- {{ network }}
{% endfor %}
{% endif %}
{% if droneci_extra_hosts | default([]) %}
2018-12-14 00:27:46 +00:00
extra_hosts:
{% for host in droneci_extra_hosts %}
- {{ host | quote }}
{% endfor %}
2018-12-14 00:23:33 +00:00
{% endif %}
privileged: true
2018-12-13 22:09:22 +00:00
environment:
2019-01-11 20:27:47 +00:00
- DRONE_SERVER_HOST={{ droneci_host | urlsplit('hostname') }}
- DRONE_SERVER_PROTO={{ droneci_host | urlsplit('scheme') }}
- DRONE_AGENTS_ENABLED=true
2019-01-11 20:27:47 +00:00
- DRONE_RPC_SECRET={{ droneci_secret }}
- DRONE_USER_CREATE=username:{{ droneci_admin_user }},admin:true
2019-01-11 20:27:47 +00:00
- DRONE_LOGS_COLOR=true
- DRONE_LOGS_PRETTY=true
- DRONE_TLS_AUTOCERT=false
2019-10-27 15:04:40 +00:00
{% if droneci_db_type == "pgsql" %}
2018-12-13 22:09:22 +00:00
- DRONE_DATABASE_DRIVER=postgres
2019-10-27 15:04:40 +00:00
- DRONE_DATABASE_DATASOURCE=postgres://{{ droneci_db_user }}:{{ droneci_db_password }}@{{ droneci_db_server }}/{{ droneci_db_name }}?sslmode={{ droneci_db_ssl_mode }}
2018-12-13 22:09:22 +00:00
{% endif %}
2019-06-10 12:09:49 +00:00
{% if droneci_gitea_enabled %}
2019-01-11 20:27:47 +00:00
- DRONE_GITEA_SERVER={{ droneci_gitea_server }}
2019-05-18 23:44:23 +00:00
- DRONE_GITEA_SKIP_VERIFY={{ droneci_gitea_skip_verify | lower }}
{% if droneci_gitea_oauth_client_id is defined and droneci_gitea_oauth_client_secret is defined %}
2019-05-19 00:04:31 +00:00
- DRONE_GITEA_CLIENT_ID={{ droneci_gitea_oauth_client_id }}
- DRONE_GITEA_CLIENT_SECRET={{ droneci_gitea_oauth_client_secret }}
2019-05-18 23:44:23 +00:00
{% endif %}
2018-12-13 22:09:22 +00:00
{% endif %}
{% if droneci_http_proxy is defined %}
- HTTP_PROXY={{ droneci_http_proxy | join(',') }}
- http_proxy={{ droneci_http_proxy | join(',') }}
{% endif %}
{% if droneci_https_proxy is defined %}
- HTTPS_PROXY={{ droneci_https_proxy | join(',') }}
- https_proxy={{ droneci_https_proxy | join(',') }}
{% endif %}
- NO_PROXY={{ droneci_no_proxy | join(',') }}
- no_proxy={{ droneci_no_proxy | join(',') }}
{% if droneci_memory_limit is defined %}
mem_limit: {{ droneci_memory_limit }}
{% endif %}
{% if droneci_memory_reservation is defined %}
mem_reservation: {{ droneci_memory_reservation }}
2018-12-16 16:22:49 +00:00
{% endif %}
2018-12-13 22:09:22 +00:00
{% if droneci_volumes | default([]) | rejectattr("bind") %}
2018-12-13 22:09:22 +00:00
volumes:
{% for volume in droneci_volumes | rejectattr("bind") %}
{{ volume.name }}:
{% endfor %}
{% endif %}
{% if droneci_networks | default([]) %}
networks:
{% for network in droneci_networks %}
{{ network.name }}:
driver: {{ network.backend | default("bridge") }}
{% endfor %}
2018-12-13 22:09:22 +00:00
{% endif %}