2019-06-14 10:13:13 +02:00
|
|
|
---
|
2019-06-14 17:36:38 +02:00
|
|
|
- name: verify that required parameters are set for drone agent setup
|
|
|
|
fail:
|
|
|
|
msg: "Variable '{{ item }}' is not defined for drone agent setup"
|
|
|
|
when: item not in vars
|
|
|
|
with_items:
|
|
|
|
- drone_server_host
|
|
|
|
tags:
|
|
|
|
- configuration
|
|
|
|
|
2019-06-14 17:30:07 +02:00
|
|
|
- name: copy config for drone agent
|
|
|
|
template:
|
|
|
|
src: "drone-agent.env.j2"
|
|
|
|
dest: "/etc/drone/drone-agent.env"
|
|
|
|
register: drone_agent_config
|
|
|
|
tags:
|
|
|
|
- configuration
|
|
|
|
|
2019-06-14 10:13:13 +02:00
|
|
|
- name: run drone agent
|
|
|
|
docker_container:
|
|
|
|
name: "drone-agent"
|
|
|
|
image: "drone/agent:{{ drone_version }}"
|
|
|
|
state: started
|
|
|
|
restart_policy: always
|
|
|
|
volumes:
|
|
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
2019-06-14 17:30:07 +02:00
|
|
|
env_file: /etc/drone/drone-agent.env
|
|
|
|
when: drone_agent_config is defined and drone_agent_config.changed
|
2019-06-14 10:13:13 +02:00
|
|
|
tags:
|
|
|
|
- drone-agent
|