From b7556696c3258b4d2c753397e1d03701f07e1b98 Mon Sep 17 00:00:00 2001 From: anima Date: Sun, 26 Jan 2025 20:57:26 +0100 Subject: [PATCH] add when on redeploy task ... --- README.md | 12 +++++++++++- tasks/main.yml | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7a605a2..da4cd7f 100644 --- a/README.md +++ b/README.md @@ -32,4 +32,14 @@ RUNNER_INSTANCE: https://your_gitea.com/ ``` Hint: A token can register multible runners, in some cases it can make sense var RUNNER_TOKEN and RUNNER_LABELS define in a group. -For all vars look at [defaults](defaults/main.yml)! \ No newline at end of file +For all vars look at [defaults](defaults/main.yml)! + +## features +### redeploy a runner +Somtimes it is need to redeploy a runner (with other token e.g.). in this case you can simply use this: + +```yaml +RUNNER_REDEPLOY: true +``` +Hint: should remove after usage! +With this option ansible delete the `.runner` file. Without this file ansible do a new registration for this runner. \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index 82fb467..3c30129 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -52,10 +52,11 @@ - name: flush handlers meta: flush_handlers -- name: dele .runner file for redeploy +- name: delete .runner file for redeploy ansible.builtin.file: state: absent path: "{{ RUNNER_DIR }}/.runner" + when: RUNNER_REDEPLOY - name: register runner notify: restart runner