feat(env): add server and agent config

This commit is contained in:
Bo-Yi Wu 2019-06-14 23:30:07 +08:00
parent f0a2a0222f
commit af8b241df5
4 changed files with 56 additions and 16 deletions

View File

@ -1,4 +1,12 @@
--- ---
- name: copy config for drone agent
template:
src: "drone-agent.env.j2"
dest: "/etc/drone/drone-agent.env"
register: drone_agent_config
tags:
- configuration
- name: run drone agent - name: run drone agent
docker_container: docker_container:
name: "drone-agent" name: "drone-agent"
@ -7,9 +15,7 @@
restart_policy: always restart_policy: always
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
env: env_file: /etc/drone/drone-agent.env
DRONE_RPC_SERVER={{ drone_rpc_server }} when: drone_agent_config is defined and drone_agent_config.changed
DRONE_RPC_SECRET={{ drone_rpc_secret }}
DRONE_RUNNER_CAPACITY={{ drone_runner_capacity }}
tags: tags:
- drone-agent - drone-agent

View File

@ -1,5 +1,13 @@
--- ---
- name: Creates directory - 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: file:
path: "{{ item }}" path: "{{ item }}"
state: directory state: directory
@ -19,16 +27,7 @@
- "{{ drone_host_port }}:80" - "{{ drone_host_port }}:80"
volumes: volumes:
- "{{ drone_dir }}:/data" - "{{ drone_dir }}:/data"
env: env_file: /etc/drone/drone-server.env
DRONE_SERVER_HOST: "{{ drone_server_host }}" when: drone_server_config is defined and drone_server_config.changed
DRONE_SERVER_PROTO: "{{ drone_server_proto }}"
DRONE_TLS_AUTOCERT: "false"
DRONE_RPC_SECRET: "{{ drone_rpc_secret }}"
DRONE_AGENTS_ENABLED: "true"
DRONE_GITHUB_SERVER: "https://github.com"
DRONE_GITHUB_CLIENT_ID: "{{ drone_github_client_id }}"
DRONE_GITHUB_CLIENT_SECRET: "{{ drone_github_client_secret }}"
DRONE_LOGS_PRETTY: "{{ drone_logs_pretty }}"
DRONE_LOGS_COLOR: "{{ drone_logs_color }}"
tags: tags:
- drone-server - drone-server

View File

@ -0,0 +1,10 @@
{% if drone_rpc_server is defined %}
DRONE_RPC_SERVER={{ drone_rpc_server }}
{% endif %}
{% if drone_rpc_secret is defined %}
DRONE_RPC_SECRET={{ drone_rpc_secret }}
{% endif %}
{% if drone_runner_capacity is defined %}
DRONE_RUNNER_CAPACITY={{ drone_runner_capacity }}
{% endif %}
DRONE_LOGS_DEBUG=true

View File

@ -0,0 +1,25 @@
{% if drone_server_host is defined %}
DRONE_SERVER_HOST={{ drone_server_host }}
{% endif %}
{% if drone_server_proto is defined %}
DRONE_SERVER_PROTO={{ drone_server_proto }}
{% endif %}
DRONE_TLS_AUTOCERT=false
{% if drone_rpc_secret is defined %}
DRONE_RPC_SECRET={{ drone_rpc_secret }}
{% endif %}
DRONE_AGENTS_ENABLED=true
DRONE_GITHUB_SERVER=https://github.com
{% if drone_github_client_id is defined %}
DRONE_GITHUB_CLIENT_ID={{ drone_github_client_id }}
{% endif %}
{% if drone_github_client_secret is defined %}
DRONE_GITHUB_CLIENT_SECRET={{ drone_github_client_secret }}
{% endif %}
{% if drone_logs_pretty is defined %}
DRONE_LOGS_PRETTY={{ drone_logs_pretty }}
{% endif %}
{% if drone_logs_color is defined %}
DRONE_LOGS_COLOR={{ drone_logs_color }}
{% endif %}
DRONE_LOGS_DEBUG=true