2018-12-13 22:09:22 +00:00
|
|
|
|
#jinja2:lstrip_blocks: True
|
2019-08-27 20:04:33 +00:00
|
|
|
|
{{ ansible_managed | comment }}
|
2020-06-17 19:20:54 +00:00
|
|
|
|
version: "2.4"
|
2018-12-13 22:09:22 +00:00
|
|
|
|
|
|
|
|
|
services:
|
2020-06-04 16:44:52 +00:00
|
|
|
|
droneci:
|
|
|
|
|
container_name: {{ droneci_container_name }}
|
|
|
|
|
image: {{ droneci_image }}
|
2020-06-16 20:04:08 +00:00
|
|
|
|
restart: {{ droneci_restart_policy }}
|
2020-06-04 16:44:52 +00:00
|
|
|
|
{% if droneci_exposed_ports | default([]) %}
|
2018-12-13 22:09:22 +00:00
|
|
|
|
ports:
|
2020-06-04 16:44:52 +00:00
|
|
|
|
{% for port in droneci_exposed_ports %}
|
|
|
|
|
- {{ port | quote }}
|
|
|
|
|
{% endfor %}
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% if droneci_volumes | default([]) %}
|
2018-12-13 22:09:22 +00:00
|
|
|
|
volumes:
|
2020-06-04 16:44:52 +00:00
|
|
|
|
{% 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:
|
2020-06-04 16:44:52 +00:00
|
|
|
|
{% for host in droneci_extra_hosts %}
|
|
|
|
|
- {{ host | quote }}
|
|
|
|
|
{% endfor %}
|
2018-12-14 00:23:33 +00:00
|
|
|
|
{% endif %}
|
2019-05-10 10:09:06 +00:00
|
|
|
|
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') }}
|
2019-05-10 08:55:14 +00:00
|
|
|
|
- DRONE_AGENTS_ENABLED=true
|
2019-01-11 20:27:47 +00:00
|
|
|
|
- DRONE_RPC_SECRET={{ droneci_secret }}
|
2020-06-04 16:44:52 +00:00
|
|
|
|
- DRONE_USER_CREATE=username:{{ droneci_admin_user }},admin:true
|
2021-01-14 09:50:32 +00:00
|
|
|
|
{% if droneci_user_filter is defined and droneci_user_filter | length > 0 %}
|
|
|
|
|
- DRONE_USER_FILTER={{ droneci_user_filter | join(",") }}
|
|
|
|
|
{% endif %}
|
2021-01-15 10:15:15 +00:00
|
|
|
|
{% if droneci_repository_filter is defined and droneci_repository_filter | length > 0 %}
|
|
|
|
|
- DRONE_REPOSITORY_FILTER={{ droneci_repository_filter }}
|
2021-01-15 10:19:17 +00:00
|
|
|
|
{% endif %}
|
2019-01-11 20:27:47 +00:00
|
|
|
|
- DRONE_LOGS_COLOR=true
|
|
|
|
|
- DRONE_LOGS_PRETTY=true
|
|
|
|
|
- DRONE_TLS_AUTOCERT=false
|
2020-09-25 07:43:04 +00:00
|
|
|
|
- DRONE_DATADOG_ENABLED=false
|
2020-09-25 09:14:01 +00:00
|
|
|
|
- DRONE_DATADOG_ENDPOINT=dummy
|
|
|
|
|
- DRONE_DATADOG_TOKEN=dummy
|
2020-09-25 07:43:04 +00:00
|
|
|
|
- DRONE_PROMETHEUS_ANONYMOUS_ACCESS={{ droneci_prometheus_anonymous_access | bool | lower }}
|
2021-01-14 10:26:06 +00:00
|
|
|
|
{% if droneci_db_secret is defined %}
|
|
|
|
|
- DRONE_DATABASE_SECRET={{ droneci_db_secret }}
|
|
|
|
|
{% endif %}
|
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 %}
|
2021-01-14 09:50:32 +00:00
|
|
|
|
{% if droneci_scm_provider | lower == "gitea" %}
|
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 }}
|
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 }}
|
2021-01-14 09:50:32 +00:00
|
|
|
|
{% elif droneci_scm_provider | lower == "github" %}
|
|
|
|
|
- DRONE_GITHUB_CLIENT_ID={{ droneci_github_client_id }}
|
|
|
|
|
- DRONE_GITHUB_CLIENT_SECRET={{ droneci_github_client_secret }}
|
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(',') }}
|
2020-06-15 22:02:40 +00:00
|
|
|
|
{% 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 %}
|
2020-06-16 19:46:28 +00:00
|
|
|
|
{% if droneci_volumes | default([]) | rejectattr("bind") | list | length > 0 %}
|
2018-12-13 22:09:22 +00:00
|
|
|
|
|
|
|
|
|
volumes:
|
2020-06-04 16:44:52 +00:00
|
|
|
|
{% for volume in droneci_volumes | rejectattr("bind") %}
|
|
|
|
|
{{ volume.name }}:
|
|
|
|
|
{% endfor %}
|
|
|
|
|
{% endif %}
|
2020-06-16 19:46:28 +00:00
|
|
|
|
{% if droneci_networks | default([]) | length > 0 %}
|
2020-06-04 16:44:52 +00:00
|
|
|
|
|
|
|
|
|
networks:
|
|
|
|
|
{% for network in droneci_networks %}
|
|
|
|
|
{{ network.name }}:
|
|
|
|
|
driver: {{ network.backend | default("bridge") }}
|
|
|
|
|
{% endfor %}
|
2018-12-13 22:09:22 +00:00
|
|
|
|
{% endif %}
|