Compare commits
4 Commits
917bf2e100
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 81e398b255 | |||
| 352c94c173 | |||
| 6ebeaf01dd | |||
| 7780e384c4 |
@@ -1,4 +1,4 @@
|
|||||||
RUNNER_VERSION: "0.2.11"
|
RUNNER_VERSION: "0.3.0"
|
||||||
RUNNER_DOWNLOAD_URL: "https://dl.gitea.com/act_runner/{{ RUNNER_VERSION }}/act_runner-{{ RUNNER_VERSION }}-linux-amd64"
|
RUNNER_DOWNLOAD_URL: "https://dl.gitea.com/act_runner/{{ RUNNER_VERSION }}/act_runner-{{ RUNNER_VERSION }}-linux-amd64"
|
||||||
RUNNER_TOKEN:
|
RUNNER_TOKEN:
|
||||||
RUNNER_INSTANCE: https://git.exampe.com/
|
RUNNER_INSTANCE: https://git.exampe.com/
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html
|
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html
|
||||||
|
# https://docs.ansible.com/projects/ansible/latest/collections/ansible/builtin/file_module.html
|
||||||
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service_module.html
|
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service_module.html
|
||||||
|
# https://docs.ansible.com/projects/ansible/latest/collections/ansible/builtin/command_module.html
|
||||||
---
|
---
|
||||||
- name: delete .runner file for redeploy
|
- name: delete .runner file for redeploy
|
||||||
|
tags: [install, config]
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
state: absent
|
state: absent
|
||||||
path: "{{ RUNNER_DIR }}/.runner"
|
path: "{{ RUNNER_DIR }}/.runner"
|
||||||
when: RUNNER_REDEPLOY
|
when: RUNNER_REDEPLOY
|
||||||
|
|
||||||
- name: register runner
|
- name: register runner
|
||||||
|
tags: [install, config]
|
||||||
notify: restart runner
|
notify: restart runner
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: "{{ RUNNER_DIR }}/{{ RUNNER_NAME }} register --no-interactive --instance {{ RUNNER_INSTANCE }} --token {{ RUNNER_TOKEN }}"
|
cmd: "{{ RUNNER_DIR }}/{{ RUNNER_NAME }} register --no-interactive --instance {{ RUNNER_INSTANCE }} --token {{ RUNNER_TOKEN }}"
|
||||||
@@ -17,6 +21,7 @@
|
|||||||
- RUNNER_TOKEN != None
|
- RUNNER_TOKEN != None
|
||||||
|
|
||||||
- name: ensure correct access rights for .runner file
|
- name: ensure correct access rights for .runner file
|
||||||
|
tags: [install, config]
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ RUNNER_DIR }}/.runner"
|
path: "{{ RUNNER_DIR }}/.runner"
|
||||||
owner: "{{ RUNNER_USER }}"
|
owner: "{{ RUNNER_USER }}"
|
||||||
@@ -24,12 +29,21 @@
|
|||||||
mode: '0660'
|
mode: '0660'
|
||||||
|
|
||||||
- name: enable runner
|
- name: enable runner
|
||||||
|
tags: [install, config]
|
||||||
notify: restart runner
|
notify: restart runner
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: "{{ RUNNER_SERVICE_NAME }}"
|
name: "{{ RUNNER_SERVICE_NAME }}"
|
||||||
enabled: yes
|
enabled: yes
|
||||||
|
|
||||||
|
- name: create scripts dir
|
||||||
|
tags: [install, config]
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ RUNNER_SCRIPT_DIR }}"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
- name: create default scripts
|
- name: create default scripts
|
||||||
|
tags: [install, config]
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
dest: "{{ RUNNER_SCRIPT_DIR }}/{{ item.name }}"
|
dest: "{{ RUNNER_SCRIPT_DIR }}/{{ item.name }}"
|
||||||
content: "{{ item.content }}"
|
content: "{{ item.content }}"
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service_module.html
|
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service_module.html
|
||||||
---
|
---
|
||||||
- name: create runner user
|
- name: create runner user
|
||||||
|
tags: [install]
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
name: "{{ RUNNER_USER }}"
|
name: "{{ RUNNER_USER }}"
|
||||||
create_home: yes
|
create_home: yes
|
||||||
@@ -13,6 +14,7 @@
|
|||||||
home: "{{ RUNNER_DIR }}"
|
home: "{{ RUNNER_DIR }}"
|
||||||
|
|
||||||
- name: download runner
|
- name: download runner
|
||||||
|
tags: [install]
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
run_once: true
|
run_once: true
|
||||||
ansible.builtin.get_url:
|
ansible.builtin.get_url:
|
||||||
@@ -21,6 +23,8 @@
|
|||||||
mode: '0440'
|
mode: '0440'
|
||||||
|
|
||||||
- name: copy runner binary
|
- name: copy runner binary
|
||||||
|
tags: [install]
|
||||||
|
notify: restart runner
|
||||||
copy:
|
copy:
|
||||||
src: "{{ RUNNER_DOWNLOAD_DIR }}/{{ RUNNER_NAME }}"
|
src: "{{ RUNNER_DOWNLOAD_DIR }}/{{ RUNNER_NAME }}"
|
||||||
dest: "{{ RUNNER_DIR }}/{{ RUNNER_NAME }}"
|
dest: "{{ RUNNER_DIR }}/{{ RUNNER_NAME }}"
|
||||||
@@ -29,6 +33,7 @@
|
|||||||
mode: '0770'
|
mode: '0770'
|
||||||
|
|
||||||
- name: create runner config
|
- name: create runner config
|
||||||
|
tags: [install]
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: config.yml.j2
|
src: config.yml.j2
|
||||||
dest: "{{ RUNNER_DIR }}/config.yml"
|
dest: "{{ RUNNER_DIR }}/config.yml"
|
||||||
@@ -37,6 +42,7 @@
|
|||||||
mode: '0660'
|
mode: '0660'
|
||||||
|
|
||||||
- name: create runner service file
|
- name: create runner service file
|
||||||
|
tags: [install]
|
||||||
notify: reload daemons
|
notify: reload daemons
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: runner.service.j2
|
src: runner.service.j2
|
||||||
|
|||||||
Reference in New Issue
Block a user