2018-12-13 22:09:22 +00:00
|
|
|
---
|
|
|
|
- block:
|
2019-11-24 16:29:04 +00:00
|
|
|
- name: Ensure service directory exists
|
|
|
|
file:
|
|
|
|
path: "{{ droneci_service_directory }}"
|
|
|
|
state: directory
|
|
|
|
mode: 0755
|
|
|
|
|
2018-12-13 22:09:22 +00:00
|
|
|
- name: Deploy compose file to '{{ droneci_service_directory }}'
|
|
|
|
template:
|
2020-06-14 21:03:58 +00:00
|
|
|
src: "services/droneci_compose.yml.j2"
|
2020-06-15 22:41:55 +00:00
|
|
|
dest: "{{ droneci_service_directory }}/docker-compose.yml"
|
2018-12-13 22:09:22 +00:00
|
|
|
owner: root
|
|
|
|
group: root
|
2020-06-14 21:03:58 +00:00
|
|
|
mode: 0640
|
2020-06-04 16:44:52 +00:00
|
|
|
validate: "docker-compose -f %s config -q"
|
2019-05-10 08:55:14 +00:00
|
|
|
|
2019-01-11 21:40:18 +00:00
|
|
|
- name: Copy license key file is defined
|
|
|
|
copy:
|
|
|
|
src: "{{ droneci_license_key }}"
|
|
|
|
dest: "{{ droneci_service_directory }}/{{ droneci_license_key | basename }}"
|
|
|
|
mode: 0600
|
|
|
|
when: droneci_license_key is defined
|
2019-11-24 16:29:04 +00:00
|
|
|
|
2020-06-04 16:44:52 +00:00
|
|
|
- name: Ensure Drone is up and running
|
|
|
|
docker_compose:
|
|
|
|
project_src: "{{ droneci_service_directory }}"
|
|
|
|
pull: yes
|
|
|
|
remove_orphans: yes
|
|
|
|
stopped: "{{ droneci_service_stopped }}"
|
|
|
|
state: present
|
|
|
|
# temp. disable changes; breaks idempotency for whatever reason
|
|
|
|
changed_when: False
|
2018-12-13 22:09:22 +00:00
|
|
|
become: True
|
|
|
|
become_user: root
|