-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from MonolithProjects/develop
Develop to Master
- Loading branch information
Showing
8 changed files
with
181 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
- name: Cleanup | ||
user: ansible | ||
hosts: all | ||
become: yes | ||
vars: | ||
- runner_user: ansible | ||
- github_repo: ansible-github_actions_runner-testrepo | ||
- github_account: monolithprojects-testorg | ||
- runner_state: absent | ||
roles: | ||
- ansible-github_actions_runner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
- name: Dev test playbook | ||
user: ansible | ||
hosts: all | ||
gather_facts: yes | ||
become: yes | ||
vars: | ||
- runner_user: ansible | ||
- github_repo: ansible-github_actions_runner-testrepo | ||
- github_account: monolithprojects-testorg | ||
- runner_version: "latest" | ||
- runner_labels: | ||
- label1 | ||
- repo-runner | ||
- custom_env: | | ||
# HTTPS_PROXY=YOUR_URL_HERE | ||
roles: | ||
- robertdebock.epel | ||
- ansible-github_actions_runner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
provisioner: | ||
name: ansible | ||
config_options: | ||
defaults: | ||
verbosity: 0 | ||
playbooks: | ||
converge: converge.yml | ||
cleanup: cleanup.yml | ||
verify: verify.yml | ||
dependency: | ||
name: galaxy | ||
lint: | | ||
yamllint . | ||
ansible-lint . | ||
driver: | ||
name: docker | ||
platforms: | ||
- name: "${os:-ubuntu20}-${tag:-latest}" | ||
image: "${namespace:-monolithprojects}/systemd-${os:-ubuntu20}:${tag:-latest}" | ||
command: /sbin/init | ||
tmpfs: | ||
- /run | ||
- /tmp | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:ro | ||
privileged: yes | ||
pre_build_image: yes | ||
verifier: | ||
name: ansible | ||
scenario: | ||
name: custom_env | ||
test_sequence: | ||
- dependency | ||
- lint | ||
- destroy | ||
- syntax | ||
- create | ||
- converge | ||
- idempotence | ||
- verify | ||
- cleanup | ||
- destroy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
- role: robertdebock.epel | ||
version: 3.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
- name: validate Repo runners | ||
user: ansible | ||
hosts: all | ||
gather_facts: yes | ||
become: yes | ||
vars: | ||
- runner_user: ansible | ||
- github_repo: ansible-github_actions_runner-testrepo | ||
- github_account: monolithprojects-testorg | ||
- github_api_url: "https://api.github.com" | ||
- access_token: "{{ lookup('env', 'PERSONAL_ACCESS_TOKEN') }}" | ||
- runner_name: ubuntu16-latest | ||
|
||
tasks: | ||
- name: Check currently registered runners | ||
uri: | ||
url: "{{ github_api_url }}/repos/{{ github_owner | default(github_account) }}/{{ github_repo }}/actions/runners" | ||
headers: | ||
Authorization: "token {{ access_token }}" | ||
Accept: "application/vnd.github.v3+json" | ||
method: GET | ||
status_code: 200 | ||
force_basic_auth: yes | ||
register: registered_runners | ||
|
||
- debug: | ||
var: registered_runners.json.runners | ||
|
||
- name: Check Runner | ||
assert: | ||
that: | ||
- runner_name in registered_runners.json.runners|map(attribute='name')|list | ||
- registered_runners.json.runners|map(attribute='status') == ["online"] | ||
quiet: true | ||
|
||
- name: Check Labels (skipped if labels are OK) | ||
fail: | ||
msg: Woops some labels differ "{{ (registered_runners.json.runners.0 | json_query('labels[*].name') | difference(['self-hosted', 'Linux', 'X64', 'label1', 'repo-runner'])) }}" | ||
when: not (registered_runners.json.runners.0 | json_query('labels[*].name') | list ) == (['self-hosted', 'Linux', 'X64', 'label1', 'repo-runner'] | list) | ||
|
||
- name: Check custom env file is configured | ||
lineinfile: | ||
dest: /opt/actions-runner/.env | ||
line: "# HTTPS_PROXY=YOUR_URL_HERE" | ||
check_mode: yes | ||
register: presence | ||
failed_when: presence.changed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters