Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
antmelekhin committed Aug 14, 2023
0 parents commit c88f006
Show file tree
Hide file tree
Showing 20 changed files with 465 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
skip_list:
- 'fqcn'
31 changes: 31 additions & 0 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: 'Molecule'
on:
pull_request:
push:
branches:
- main

jobs:
test:
name: 'Test'
runs-on: ubuntu-latest
strategy:
matrix:
include:
- distro: 'debian-11'
- distro: 'rockylinux-8'
- distro: 'ubuntu-20.04'

steps:
- name: 'Checkout the codebase'
uses: actions/checkout@v3

- name: 'Test role'
uses: gofrolist/molecule-action@v2
with:
molecule_command: test
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
MOLECULE_DISTRO: ${{ matrix.distro }}
19 changes: 19 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: 'Publish'
on:
release:
types:
- published

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: 'Checkout the codebase'
uses: actions/checkout@v3

- name: 'Publish to Ansible Galaxy'
uses: robertdebock/galaxy-action@1.2.0
with:
galaxy_api_key: ${{ secrets.GALAXY_API_KEY }}
git_branch: main
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: 'Release'
on:
push:
branches:
- main

jobs:
release:
name: 'Release'
runs-on: ubuntu-latest
# Skip running release workflow on forks
if: github.repository_owner == 'antmelekhin'
steps:
- name: 'Checkout the codebase'
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false

- name: 'Semantic Release'
uses: cycjimmy/semantic-release-action@v3
with:
semantic_version: 19.0.5
extra_plugins: |
@semantic-release/git@10.0.1
@semantic-release/changelog@6.0.3
conventional-changelog-conventionalcommits@5.0.0
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
94 changes: 94 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
branches: ['main']
preset: 'conventionalcommits'
ci: false

verifyConditions:
- '@semantic-release/changelog'
- '@semantic-release/git'
- '@semantic-release/github'

analyzeCommits:
- path: '@semantic-release/commit-analyzer'
releaseRules:
- type: 'breaking'
release: 'major'
- type: 'chore'
release: false
- type: 'ci'
release: false
- type: 'docs'
release: false
- type: 'feat'
release: 'minor'
- type: 'fix'
release: 'patch'
- type: 'improv'
release: 'minor'
- type: 'refactor'
release: 'patch'
- type: 'revert'
release: 'patch'
- type: 'style'
release: false
- type: 'test'
release: false

generateNotes:
- path: '@semantic-release/release-notes-generator'
writerOpts:
groupBy: 'type'
commitGroupsSort: 'title'
commitsSort: 'header'
linkCompare: true
linkReferences: true
presetConfig:
types:
- type: 'breaking'
section: 'Breaking changes!'
hidden: false
- type: 'chore'
section: 'Miscellaneous Chores'
hidden: true
- type: 'ci'
section: 'Continuous Integration'
hidden: false
- type: 'docs'
section: 'Documentation'
hidden: false
- type: 'feat'
section: 'Features'
hidden: false
- type: 'fix'
section: 'Fixes'
hidden: false
- type: 'improv'
section: 'Improvements'
hidden: false
- type: 'refactor'
section: 'Code Refactoring'
hidden: false
- type: 'revert'
section: 'Reverts'
hidden: false
- type: 'style'
section: 'Styles'
hidden: false
- type: 'test'
section: 'Tests'
hidden: false

prepare:
- path: '@semantic-release/changelog'
changelogFile: 'CHANGELOG.md'
changelogTitle: '# Changelog'
- path: '@semantic-release/git'
assets: ['CHANGELOG.md']
message: "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"

publish:
- path: '@semantic-release/github'

success: false

fail: false
33 changes: 33 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
# Based on ansible-lint config
extends: default

rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
colons:
max-spaces-after: -1
level: error
commas:
max-spaces-after: -1
level: error
comments: disable
comments-indentation: disable
document-start: disable
empty-lines:
max: 3
level: error
hyphens:
level: error
indentation: disable
key-duplicates: enable
line-length: disable
new-line-at-end-of-file: disable
new-lines:
type: unix
trailing-spaces: disable
truthy: disable
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Anton Melekhin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
Role Name
=========

An Ansible role for install GitLab Runners.

Requirements
------------

- Supported version of Ansible: 2.9 and highter.
- Supported platforms:
- Debian
- 10
- 11
- RHEL
- 7
- 8
- 9
- Ubuntu
- 18.04
- 20.04
- 22.04

Role Variables
--------------

- `gitlab_runner_package_version` The specific version of Gitlab Runner to install (default: `''`).
- `gitlab_runner_repository_mirror` Mirror of `Gitlab` repository (default: `https://packages.gitlab.com/runner/gitlab-runner`).
- `gitlab_runner_repository_key_url` URL to `Gitlab's` GPG public key file (default: `https://packages.gitlab.com/runner/gitlab-runner/gpgkey`)

Dependencies
------------

None.

Example Playbook
----------------

```yaml
---
- name: 'Install gitlab-runner'
hosts: all

roles:
- role: antmelekhin.gitlab_runner
```
License
-------
MIT
Author Information
------------------
Melekhin Anton.
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
gitlab_runner_package_version: ''
gitlab_runner_repository_mirror: 'https://packages.gitlab.com/runner/gitlab-runner'
gitlab_runner_repository_key_url: 'https://packages.gitlab.com/runner/gitlab-runner/gpgkey'
32 changes: 32 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
galaxy_info:
author: Melekhin Anton
role_name: gitlab_runner
namespace: antmelekhin
description: An Ansible role for install GitLab Runners.

license: MIT

min_ansible_version: '2.9'

platforms:
- name: Debian
versions:
- 'buster'
- 'bullseye'
- name: EL
versions:
- '7'
- '8'
- '9'
- name: Ubuntu
versions:
- 'bionic'
- 'focal'

galaxy_tags:
- gitlab
- runner
- git
- ci

dependencies: []
5 changes: 5 additions & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: Converge
hosts: all
roles:
- role: antmelekhin.gitlab_runner
23 changes: 23 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
dependency:
name: galaxy
enabled: true
driver:
name: docker
lint: |
set -e
yamllint .
ansible-lint
platforms:
- name: instance
image: 'antmelekhin/docker-systemd:${MOLECULE_DISTRO:-ubuntu-22.04}'
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
- /var/lib/containerd
cgroupns_mode: host
privileged: true
pre_build_image: true
provisioner:
name: ansible
verifier:
name: ansible
15 changes: 15 additions & 0 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: 'Verify'
hosts: all
gather_facts: false
tasks:
- name: 'Gathering Service Facts'
ansible.builtin.service_facts:

- name: 'Assert that sshd service is enabled and running'
ansible.builtin.assert:
that:
- ansible_facts.services['gitlab-runner.service'].state == 'running' or
ansible_facts.services['gitlab-runner.service'].state == 'active'
- ansible_facts.services['gitlab-runner.service'].status == 'enabled' or
ansible_facts.services['gitlab-runner.service'].status == 'enabled'
Loading

0 comments on commit c88f006

Please sign in to comment.