2019-06-16 12:27:55 +02:00
# Ansible Role: drone
2019-06-14 09:41:26 +02:00
2019-06-16 12:27:55 +02:00
This role will install drone [agents][1] + [server][2] using [docker ](https://www.docker.com/ )
2019-06-14 09:41:26 +02:00
2019-06-16 12:27:55 +02:00
[1]:https://docs.drone.io/administration/agents/
[2]:https://docs.drone.io/administration/server/
## Requirements
2019-06-14 09:41:26 +02:00
2019-06-16 12:27:55 +02:00
This role requires: [docker installed ](https://docs.docker.com/install/ ) on the server
2019-06-14 09:41:26 +02:00
2019-06-16 12:54:50 +02:00
### Role Variables
2019-06-14 09:41:26 +02:00
2019-06-16 12:54:50 +02:00
Change the `drone_host_port` for expose port if conflict and update the `drone_version` from [github release page ](https://github.com/drone/drone/releases ).
2019-06-14 09:41:26 +02:00
2019-06-16 12:54:50 +02:00
```yml
drone_version: "latest"
drone_host_port: "8080"
```
2019-06-14 09:41:26 +02:00
2019-06-16 12:54:50 +02:00
Install the drone server or agent via the following config. Default is `false` .
2019-06-14 09:41:26 +02:00
2019-06-16 12:54:50 +02:00
```yml
drone_server_enable: "false"
drone_agent_enable: "false"
```
2019-06-14 09:41:26 +02:00
2019-06-16 12:54:50 +02:00
Default database is `sqlite` and drone can be installed with `mysql` or `postgres` database. See the followings.
2019-06-14 09:41:26 +02:00
2019-06-16 12:54:50 +02:00
```yml
drone_database_driver: "postgres"
drone_postgres_data_dir: "/var/lib/postgresql/data"
drone_postgres_password: "drone"
drone_postgres_user: "drone"
drone_postgres_db: "drone
```
2019-06-14 09:41:26 +02:00
2019-06-16 12:54:50 +02:00
mysql database (5.7 version)
2019-06-14 09:41:26 +02:00
2019-06-16 12:54:50 +02:00
```yml
drone_database_driver: "mysql"
drone_mysql_data_dir: "/var/lib/mysql/data"
drone_mysql_password: "drone"
drone_mysql_user: "drone"
drone_mysql_db: "drone"
```
2019-06-14 09:41:26 +02:00
2019-06-16 12:54:50 +02:00
### additional parameters
2019-06-14 09:41:26 +02:00
2019-06-16 12:54:50 +02:00
The ansible role offers additional parameters - please check `defaults/main.yml` file.
## Example Playbook
2019-06-16 13:48:54 +02:00
import the drone role from
```
2019-06-16 15:27:47 +02:00
$ ansible-galaxy install appleboy.drone
2019-06-16 13:48:54 +02:00
```
Add the following in playbook.
```yml
2019-06-16 12:54:50 +02:00
- hosts: drone
vars_files:
- vars/main.yml
roles:
- { role: appleboy.drone }
2019-06-16 13:48:54 +02:00
```
2019-06-16 12:54:50 +02:00
Inside `vars/main.yml` for `drone-server`
```yml
drone_server_enable: "true"
drone_version: "latest"
drone_github_client_id: "e2bdde88b88f7ccf873a"
drone_github_client_secret: "b0412c975bbf2b6fcd9b3cf5f19c8165b1c14d0c"
drone_server_host: "368a7a66.ngrok.io"
drone_server_proto: "https"
drone_rpc_secret: "30075d074bfd9e74cfd0b84a5886b986"
drone_database_driver: "mysql"
drone_database_datasource: "drone:drone@tcp(mysql:3306)/drone?parseTime=true"
```
for drone-agent:
```yml
drone_agent_enable: "true"
drone_version: "latest"
drone_rpc_server: "http://192.168.64.2:8081"
drone_rpc_secret: "30075d074bfd9e74cfd0b84a5886b986"
```