Update 'tasks/main.yml' #7

Merged
jens merged 10 commits from jens-patch-2 into main 2021-09-09 10:01:49 +00:00
3 changed files with 36 additions and 31 deletions

View File

@ -1,23 +1,45 @@
---
- name: "Restart drone"
service:
name: "drone"
state: "restarted"
# handlers are executed in the order they are written in the handlers file, not the order they are notified.
- name: "Build drone"
command: 'go build'
become: true
become_user : "{{ drone_user }}"
notify: "Restart drone"
args:
chdir: "{{ drone_home }}/drone/cmd/drone-server"
- name: "Unzip runner"
unarchive:
src: "{{ drone_home }}/drone_runner_exec_linux_amd64.tar.gz"
remote_src: yes
dest: /usr/local/bin/
notify:
- "Install drone runner exec"
- "Stop drone runner exec"
- "Start drone runner exec"
- name: "Stop drone runner exec"
command: "drone-runner-exec service stop"
when: ansible_service_mgr == "systemd"
- name: "Install drone runner exec"
command: "drone-runner-exec service install"
when: ansible_service_mgr == "systemd"
notify:
- "Reload systemd"
- name: "Stop drone runner exec"
command: "drone-runner-exec service stop"
- name: "Reload systemd"
systemd:
daemon_reload: true
when: ansible_service_mgr == "systemd"
- name: "Start drone runner exec"
command: "drone-runner-exec service start"
when: ansible_service_mgr == "systemd"
- name: "Reload systemd"
systemd:
daemon_reload: true
- name: "Restart drone"
service:
name: "drone"
state: "restarted"
when: ansible_service_mgr == "systemd"

View File

@ -1,6 +1,6 @@
galaxy_info:
role_name: ansible_role_drone
author: Jens Timmerman
role_name: drone
author: jens
description: This role installs drone ci p (https://github.com/drone/drone)
issue_tracker_url: https://gitea.caret.be/jens/ansible-role-drone/issues

View File

@ -22,7 +22,7 @@
force: true
become: true
become_user : "{{ drone_user }}"
register: gitclone
notify: "Build drone"
Review

this doesn't really help, this always returns changed, even when running withing 1 second,
perhaps the 'forced' is doing this? But forced is needed to discard local changes...

this doesn't really help, this always returns changed, even when running withing 1 second, perhaps the 'forced' is doing this? But forced is needed to discard local changes...
Review

Forced does this, but is needed as stated, the notify here could indeed be omitted.

Forced does this, but is needed as stated, the notify here could indeed be omitted.
- name: "Setup systemd service"
template:
@ -36,14 +36,6 @@
- "Restart drone"
when: ansible_service_mgr == "systemd"
- name: "Build drone"
command: 'go build'
become: true
become_user : "{{ drone_user }}"
notify: "Restart drone"
args:
chdir: "{{ drone_home }}/drone/cmd/drone-server"
when: gitclone.changed # noqa no-handler
- name: "Clone runner"
get_url:
@ -51,18 +43,9 @@
dest: "{{ drone_home }}"
become: true
become_user : "{{ drone_user }}"
register: gitclonerunner
notify: "Unzip runner"
- name: "Unzip runner"
unarchive:
src: "{{ drone_home }}/drone_runner_exec_linux_amd64.tar.gz"
remote_src: yes
dest: /usr/local/bin/
notify:
- "Install drone runner exec"
- "Stop drone runner exec"
- "Start drone runner exec"
- name: "Make local runner config dir"
file:
path: "/etc/drone-runner-exec/"