Skip to content

Commit

Permalink
Merge pull request #10 from MonolithProjects/develop
Browse files Browse the repository at this point in the history
Develop to Master

Former-commit-id: a92c31d
  • Loading branch information
MonolithProjects authored Apr 5, 2020
2 parents 07e04f0 + 47aafc3 commit 2a165f2
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
actions-runner-linux-*
*.gz
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Requirements

* Supported Linux distros:
* CentOS/RHEL 7,8
* Debian 9,10
* Fedora 16+
* Ubuntu 16,18

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

```yaml
# Runner user - user inder which is the local runner service running
# Runner user - user under which is the local runner service running
runner_user: runner

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

# Version of the GitHub Actions Runner
runner_version: "2.165.2"
runner_version: "latest"

# If found, replace already registered runner
replace_runner: yes
Expand All @@ -65,7 +66,7 @@ github_server: "https://github.com"
Example Playbook
----------------

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.
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.

```yaml
---
Expand All @@ -74,7 +75,7 @@ In this example the role will deploy (or redeploy) the GitHub Actions runner ser
become: yes
vars:
- runner_version: "2.165.2"
- runner_user: runner
- runner_user: ansible
- github_account: myuser
- github_repo: my_awesome_repo
roles:
Expand Down
4 changes: 2 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
# Runner user - user inder which is the local runner service running
# Runner user - user under which is the local runner service running
runner_user: runner

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

# Version of the GitHub Actions Runner
runner_version: "2.165.2"
runner_version: "latest"

# If found, replace already registered runner
replace_runner: yes
Expand Down
8 changes: 4 additions & 4 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
- name: Fedora
versions:
- all
# - name: Debian
# versions:
# - jessie
# - stretch
- name: Debian
versions:
- buster
- stretch
- name: Ubuntu
versions:
- xenial
Expand Down

This file was deleted.

1 change: 1 addition & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
hosts: all
become: yes
vars:
- runner_version: "2.168.0"
- runner_user: ansible
- github_repo: ansible-github_actions_runner-testrepo
- github_account: monolithprojects
Expand Down
20 changes: 20 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,26 @@ platforms:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: yes
pre_build_image: yes
- name: Debian9
image: monolithprojects/systemd-debian9:latest
command: /sbin/init
tmpfs:
- /run
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: yes
pre_build_image: yes
- name: Debian10
image: monolithprojects/systemd-debian10:latest
command: /sbin/init
tmpfs:
- /run
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: yes
pre_build_image: yes
provisioner:
name: ansible
playbooks:
Expand Down
38 changes: 32 additions & 6 deletions tasks/install_deps.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
---
- name: Install dependencies on Debian Stretch / Ubuntu Xenial systems
- name: Install dependencies on Debian Stretch
package:
pkg:
- liblttng-ust0
- libkrb5-3
- zlib1g
- libssl1.1
- libicu57
state: present
update_cache: yes
when: (ansible_distribution == "Debian" and ansible_distribution_major_version == "9")
tags:
- install

- name: Install dependencies on Debian Buster
package:
pkg:
- liblttng-ust0
- libkrb5-3
- zlib1g
- libssl1.1
- libicu63
state: present
update_cache: yes
when: (ansible_distribution == "Debian" and ansible_distribution_major_version == "10")
tags:
- install

- name: Install dependencies on Ubuntu Xenial systems
package:
pkg:
- liblttng-ust0
Expand All @@ -9,12 +37,11 @@
- libicu55
state: present
update_cache: yes
when: (ansible_distribution == "Debian" and ansible_distribution_major_version == "9") or
(ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "16")
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "16")
tags:
- install

- name: Install dependencies on Debian Buster / Ubuntu Bionic systems
- name: Install dependencies on Ubuntu Bionic systems
package:
pkg:
- liblttng-ust0
Expand All @@ -24,8 +51,7 @@
- libicu60
state: present
update_cache: yes
when: (ansible_distribution == "Debian" and ansible_distribution_major_version == "10") or
(ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "18")
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "18")
tags:
- install

Expand Down
25 changes: 23 additions & 2 deletions tasks/install_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,35 @@
tags:
- install

- name: Find the latest runner version
uri:
url: "https://api.github.com/repos/actions/runner/releases/latest"
url_username: "{{ github_account }}"
url_password: "{{ access_token }}"
method: GET
force_basic_auth: yes
return_content: yes
status_code: 200
body_format: json
register: api_response
run_once: yes
delegate_to: localhost
when: runner_version == "latest"
tags:
- install

- name: Set runner_version variable (if it is latest)
set_fact:
runner_version: "{{ api_response.json.tag_name | regex_replace('^v', '') }}"
when: runner_version == "latest"

- name: Download runner package version - "{{ runner_version }}"
get_url:
url: "https://github.com/actions/runner/releases/download/v{{ runner_version }}/actions-runner-linux-x64-{{ runner_version }}.tar.gz"
dest: "./actions-runner-linux-{{ runner_version }}.tar.gz"
force: no
run_once: yes
delegate_to: localhost
when: runner_version != "latest"
tags:
- install

Expand All @@ -29,7 +50,7 @@
tags:
- install

- name: Register runner
- name: Register runner (if new installation)
command: "{{ runner_dir }}/./config.sh --url {{ github_server }}/{{ github_account }}/{{ github_repo }} \
--token {{ registration.json.token }} --unattended"
args:
Expand Down
5 changes: 5 additions & 0 deletions tasks/uninstall_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
tags:
- uninstall

- name: Refresh services facts
service_facts:
tags:
- uninstall

- name: Remove GitHub Actions Runner service
file:
path: "{{ item }}"
Expand Down

0 comments on commit 2a165f2

Please sign in to comment.