Skip to content

Commit 2a165f2

Browse files
Merge pull request #10 from MonolithProjects/develop
Develop to Master Former-commit-id: a92c31d
2 parents 07e04f0 + 47aafc3 commit 2a165f2

10 files changed

+93
-20
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
actions-runner-linux-*
1+
*.gz

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Requirements
1414

1515
* Supported Linux distros:
1616
* CentOS/RHEL 7,8
17+
* Debian 9,10
1718
* Fedora 16+
1819
* Ubuntu 16,18
1920

@@ -34,14 +35,14 @@ Role Variables
3435
This is a copy from `defaults/main.yml`
3536

3637
```yaml
37-
# Runner user - user inder which is the local runner service running
38+
# Runner user - user under which is the local runner service running
3839
runner_user: runner
3940

4041
# Directory where the local runner will be installed
4142
runner_dir: /opt/actions-runner
4243

4344
# Version of the GitHub Actions Runner
44-
runner_version: "2.165.2"
45+
runner_version: "latest"
4546

4647
# If found, replace already registered runner
4748
replace_runner: yes
@@ -65,7 +66,7 @@ github_server: "https://github.com"
6566
Example Playbook
6667
----------------
6768

68-
In this example the role will deploy (or redeploy) the GitHub Actions runner service (default version ins ) and register the runner for the GitHub repo.
69+
In this example the role will deploy (or redeploy) the GitHub Actions runner service (version 2.165.2) and register the runner for the GitHub repo.
6970

7071
```yaml
7172
---
@@ -74,7 +75,7 @@ In this example the role will deploy (or redeploy) the GitHub Actions runner ser
7475
become: yes
7576
vars:
7677
- runner_version: "2.165.2"
77-
- runner_user: runner
78+
- runner_user: ansible
7879
- github_account: myuser
7980
- github_repo: my_awesome_repo
8081
roles:

defaults/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
# Runner user - user inder which is the local runner service running
2+
# Runner user - user under which is the local runner service running
33
runner_user: runner
44

55
# Directory where the local runner will be installed
66
runner_dir: /opt/actions-runner
77

88
# Version of the GitHub Actions Runner
9-
runner_version: "2.165.2"
9+
runner_version: "latest"
1010

1111
# If found, replace already registered runner
1212
replace_runner: yes

meta/main.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
- name: Fedora
1515
versions:
1616
- all
17-
# - name: Debian
18-
# versions:
19-
# - jessie
20-
# - stretch
17+
- name: Debian
18+
versions:
19+
- buster
20+
- stretch
2121
- name: Ubuntu
2222
versions:
2323
- xenial

molecule/default/actions-runner-linux.tar.gz.REMOVED.git-id

-1
This file was deleted.

molecule/default/converge.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
hosts: all
55
become: yes
66
vars:
7+
- runner_version: "2.168.0"
78
- runner_user: ansible
89
- github_repo: ansible-github_actions_runner-testrepo
910
- github_account: monolithprojects

molecule/default/molecule.yml

+20
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,26 @@ platforms:
4444
- /sys/fs/cgroup:/sys/fs/cgroup:ro
4545
privileged: yes
4646
pre_build_image: yes
47+
- name: Debian9
48+
image: monolithprojects/systemd-debian9:latest
49+
command: /sbin/init
50+
tmpfs:
51+
- /run
52+
- /tmp
53+
volumes:
54+
- /sys/fs/cgroup:/sys/fs/cgroup:ro
55+
privileged: yes
56+
pre_build_image: yes
57+
- name: Debian10
58+
image: monolithprojects/systemd-debian10:latest
59+
command: /sbin/init
60+
tmpfs:
61+
- /run
62+
- /tmp
63+
volumes:
64+
- /sys/fs/cgroup:/sys/fs/cgroup:ro
65+
privileged: yes
66+
pre_build_image: yes
4767
provisioner:
4868
name: ansible
4969
playbooks:

tasks/install_deps.yml

+32-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
---
2-
- name: Install dependencies on Debian Stretch / Ubuntu Xenial systems
2+
- name: Install dependencies on Debian Stretch
3+
package:
4+
pkg:
5+
- liblttng-ust0
6+
- libkrb5-3
7+
- zlib1g
8+
- libssl1.1
9+
- libicu57
10+
state: present
11+
update_cache: yes
12+
when: (ansible_distribution == "Debian" and ansible_distribution_major_version == "9")
13+
tags:
14+
- install
15+
16+
- name: Install dependencies on Debian Buster
17+
package:
18+
pkg:
19+
- liblttng-ust0
20+
- libkrb5-3
21+
- zlib1g
22+
- libssl1.1
23+
- libicu63
24+
state: present
25+
update_cache: yes
26+
when: (ansible_distribution == "Debian" and ansible_distribution_major_version == "10")
27+
tags:
28+
- install
29+
30+
- name: Install dependencies on Ubuntu Xenial systems
331
package:
432
pkg:
533
- liblttng-ust0
@@ -9,12 +37,11 @@
937
- libicu55
1038
state: present
1139
update_cache: yes
12-
when: (ansible_distribution == "Debian" and ansible_distribution_major_version == "9") or
13-
(ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "16")
40+
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "16")
1441
tags:
1542
- install
1643

17-
- name: Install dependencies on Debian Buster / Ubuntu Bionic systems
44+
- name: Install dependencies on Ubuntu Bionic systems
1845
package:
1946
pkg:
2047
- liblttng-ust0
@@ -24,8 +51,7 @@
2451
- libicu60
2552
state: present
2653
update_cache: yes
27-
when: (ansible_distribution == "Debian" and ansible_distribution_major_version == "10") or
28-
(ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "18")
54+
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "18")
2955
tags:
3056
- install
3157

tasks/install_runner.yml

+23-2
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,35 @@
1010
tags:
1111
- install
1212

13+
- name: Find the latest runner version
14+
uri:
15+
url: "https://api.github.com/repos/actions/runner/releases/latest"
16+
url_username: "{{ github_account }}"
17+
url_password: "{{ access_token }}"
18+
method: GET
19+
force_basic_auth: yes
20+
return_content: yes
21+
status_code: 200
22+
body_format: json
23+
register: api_response
24+
run_once: yes
25+
delegate_to: localhost
26+
when: runner_version == "latest"
27+
tags:
28+
- install
29+
30+
- name: Set runner_version variable (if it is latest)
31+
set_fact:
32+
runner_version: "{{ api_response.json.tag_name | regex_replace('^v', '') }}"
33+
when: runner_version == "latest"
34+
1335
- name: Download runner package version - "{{ runner_version }}"
1436
get_url:
1537
url: "https://github.com/actions/runner/releases/download/v{{ runner_version }}/actions-runner-linux-x64-{{ runner_version }}.tar.gz"
1638
dest: "./actions-runner-linux-{{ runner_version }}.tar.gz"
1739
force: no
1840
run_once: yes
1941
delegate_to: localhost
20-
when: runner_version != "latest"
2142
tags:
2243
- install
2344

@@ -29,7 +50,7 @@
2950
tags:
3051
- install
3152

32-
- name: Register runner
53+
- name: Register runner (if new installation)
3354
command: "{{ runner_dir }}/./config.sh --url {{ github_server }}/{{ github_account }}/{{ github_repo }} \
3455
--token {{ registration.json.token }} --unattended"
3556
args:

tasks/uninstall_runner.yml

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
tags:
99
- uninstall
1010

11+
- name: Refresh services facts
12+
service_facts:
13+
tags:
14+
- uninstall
15+
1116
- name: Remove GitHub Actions Runner service
1217
file:
1318
path: "{{ item }}"

0 commit comments

Comments
 (0)