55 lines
1.5 KiB
YAML
55 lines
1.5 KiB
YAML
---
|
|
- name: copy config for drone server
|
|
template:
|
|
src: "drone-server.env.j2"
|
|
dest: "/etc/drone/drone-server.env"
|
|
register: drone_server_config
|
|
tags:
|
|
- configuration
|
|
|
|
- name: Creates sqlite directory
|
|
file:
|
|
path: "{{ drone_sqlite_dir }}"
|
|
state: directory
|
|
mode: 0755
|
|
when: drone_database_driver == "sqlite"
|
|
register: drone_sqlite_folder
|
|
tags:
|
|
- drone-server
|
|
|
|
- name: run drone server with sqlite database
|
|
docker_container:
|
|
name: drone-server
|
|
image: "drone/drone:{{ drone_version }}"
|
|
state: started
|
|
restart_policy: always
|
|
ports:
|
|
- "{{ drone_host_port }}:80"
|
|
volumes:
|
|
- "{{ drone_sqlite_dir }}:/data"
|
|
env_file: /etc/drone/drone-server.env
|
|
when: ((drone_server_config is defined and drone_server_config.changed) or
|
|
(drone_sqlite_folder is defined and drone_sqlite_folder.changed)) and
|
|
drone_database_driver == "sqlite"
|
|
tags:
|
|
- drone-server
|
|
|
|
- name: run drone server with postgres or mysql database
|
|
docker_container:
|
|
name: drone-server
|
|
image: "drone/drone:{{ drone_version }}"
|
|
state: started
|
|
restart_policy: always
|
|
ports:
|
|
- "{{ drone_host_port }}:80"
|
|
links:
|
|
- "{{ drone_database_driver }}"
|
|
volumes:
|
|
- "{{ drone_sqlite_dir }}:/data"
|
|
env_file: /etc/drone/drone-server.env
|
|
when: ((drone_server_config is defined and drone_server_config.changed) or
|
|
(drone_postgres_data_dir is defined and drone_postgres_data_dir.changed)) or
|
|
drone_database_driver != "sqlite"
|
|
tags:
|
|
- drone-server
|