Skip to content

Commit

Permalink
feat: Restructure to Ansible collection
Browse files Browse the repository at this point in the history
  • Loading branch information
konradasb committed Oct 30, 2023
1 parent 11011e3 commit 479f05a
Show file tree
Hide file tree
Showing 24 changed files with 372 additions and 135 deletions.
120 changes: 2 additions & 118 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,122 +1,6 @@
# ansible-role-fireactions
# Ansible collection for Fireactions

Ansible role to install and configure [Fireactions](https://github.com/hostinger/fireactions).

## Requirements

None.

## Dependencies

None.

## Role Variables

Available variables are listed below, along with default values (see `defaults/main.yml`):

```yaml
fireactions_version: 0.1.0
```
The version of Fireactions to install.
```yaml
fireactions_install_dir: /opt/fireactions
```
The installation directory for Fireactions.
```yaml
fireactions_os: linux
```
The OS to install Fireactions for. Currently only `linux` is supported.

```yaml
fireactions_arch: amd64
```

The architecture to install Fireactions for. Currently only `amd64` and `arm64` are supported.

```yaml
fireactions_create_group: true
```

Whether to create a group for Fireactions. Useful if you want to run Fireactions with already existing group.

```yaml
fireactions_group: fireactions
```

The group to create for Fireactions.

```yaml
fireactions_create_owner: true
```

Whether to create a user for Fireactions. Useful if you want to run Fireactions with already existing user.

```yaml
fireactions_owner: fireactions
```

The user to create for Fireactions.

```yaml
fireactions_config_file_path: "{{ fireactions_config_dir }}/config.yml"
```

The path to the Fireactions configuration file.

```yaml
fireactions_config_dir: /etc/fireactions
```

The configuration directory for Fireactions.

```yaml
fireactions_config_server_url: http://127.0.0.1:8080
```

The URL of the Fireactions server.

```yaml
fireactions_config_organisation: example
```

The organisation name for Fireactions. The name must match the organisation name in GitHub.

```yaml
fireactions_group: us-east-1
```

The group name for Fireactions. The group must already exist in Fireactions server.

```yaml
fireactions_cpu_overcommit_ratio: 1.0
```

CPU overcommit ratio is the ratio of CPU to allocate to the client compared to the actual CPU cores available on the host.

```yaml
fireactions_mem_overcommit_ratio: 1.0
```

RAM overcommit ratio is the ratio of RAM to allocate to the client compared to the actual RAM available on the host.

```yaml
fireactions_log_level: info
```

The log level for Fireactions.

## Example Playbook

```yaml
- hosts: all
roles:
- { role: hostinger.fireactions }
```
This is a collection which contains Ansible roles for installing and configuring [Fireactions](https://github.com/hostinger/fireactions) client and its dependencies.

## License

Expand Down
15 changes: 15 additions & 0 deletions galaxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
namespace: hostinger
name: fireactions
repository: https://github.com/hostinger/ansible-collection-fireactions
version: 0.0.1
readme: README.md
authors:
- konradasb
description: Ansible collection for deploying Fireactions and required dependencies
license:
- MIT
dependencies:
community.general: ">=4.5.0"
tags:
- fireactions
2 changes: 2 additions & 0 deletions meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
requires_ansible: ">=2.11"
3 changes: 2 additions & 1 deletion molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
- all

roles:
- hostinger.fireactions
- hostinger.fireactions.firecracker
- hostinger.fireactions.client
126 changes: 126 additions & 0 deletions roles/client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# client

Ansible role to install and configure [Fireactions](https://github.com/hostinger/fireactions) client.

## Requirements

None.

## Dependencies

- hostinger.fireactions.firecracker
- hostinger.fireactions.containerd
- hostinger.fireactions.cni
- hostinger.fireactions.tc-redirect-tap

## Role Variables

Available variables are listed below, along with default values (see `defaults/main.yml`):

```yaml
fireactions_version: 0.1.0
```
The version of Fireactions to install.
```yaml
fireactions_install_dir: /opt/fireactions
```
The installation directory for Fireactions.
```yaml
fireactions_os: linux
```
The OS to install Fireactions for. Currently only `linux` is supported.

```yaml
fireactions_arch: amd64
```

The architecture to install Fireactions for. Currently only `amd64` and `arm64` are supported.

```yaml
fireactions_create_group: true
```

Whether to create a group for Fireactions. Useful if you want to run Fireactions with already existing group.

```yaml
fireactions_group: fireactions
```

The group to create for Fireactions.

```yaml
fireactions_create_owner: true
```

Whether to create a user for Fireactions. Useful if you want to run Fireactions with already existing user.

```yaml
fireactions_owner: fireactions
```

The user to create for Fireactions.

```yaml
fireactions_config_file_path: "{{ fireactions_config_dir }}/config.yml"
```

The path to the Fireactions configuration file.

```yaml
fireactions_config_dir: /etc/fireactions
```

The configuration directory for Fireactions.

```yaml
fireactions_config_server_url: http://127.0.0.1:8080
```

The URL of the Fireactions server.

```yaml
fireactions_config_organisation: example
```

The organisation name for Fireactions. The name must match the organisation name in GitHub.

```yaml
fireactions_group: us-east-1
```

The group name for Fireactions. The group must already exist in Fireactions server.

```yaml
fireactions_cpu_overcommit_ratio: 1.0
```

CPU overcommit ratio is the ratio of CPU to allocate to the client compared to the actual CPU cores available on the host.

```yaml
fireactions_mem_overcommit_ratio: 1.0
```

RAM overcommit ratio is the ratio of RAM to allocate to the client compared to the actual RAM available on the host.

```yaml
fireactions_log_level: info
```

The log level for Fireactions.

## Example Playbook

```yaml
- hosts: all
roles:
- role: hostinger.fireactions.client
```

## License

See [LICENSE](LICENSE).
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions meta/main.yml → roles/client/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
galaxy_info:
role_name: fireactions
role_name: client
author: hostinger
description: BYOM (Bring Your Own Metal) and run self-hosted GitHub runners in ephemeral, fast and secure Firecracker based virtual machines.
description: Ansible role for installing Fireactions client
license: license (MIT)
min_ansible_version: "2.10"
platforms:
Expand Down
7 changes: 7 additions & 0 deletions roles/client/molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: Converge
hosts:
- all

roles:
- client
18 changes: 18 additions & 0 deletions roles/client/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: ubuntu-22.04
image: geerlingguy/docker-ubuntu2204-ansible:latest
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
command: ${MOLECULE_DOCKER_COMMAND:-""}
cgroupns_mode: host
pre_build_image: true
privileged: true
provisioner:
name: ansible
playbooks:
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions roles/client/templates/fireactions.service.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[Unit]
Description=Fireactions
Documentation=https://github.com/hostinger/fireactions
Requires=network.target
After=network.target

[Service]
User={{ fireactions_owner }}
Type=simple
ExecPreStart=/usr/bin/which fireactions
ExecPreStart=/usr/bin/which firecracker
ExecStart=fireactions client start --config {{ fireactions_config_file_path }}
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
File renamed without changes.
File renamed without changes.
Empty file added roles/containerd/.gitkeep
Empty file.
Loading

0 comments on commit 479f05a

Please sign in to comment.