Skip to content

Commit

Permalink
more release automation
Browse files Browse the repository at this point in the history
  • Loading branch information
wzzrd committed Feb 16, 2024
1 parent 884c703 commit 78d28ed
Show file tree
Hide file tree
Showing 9 changed files with 190 additions and 73 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/ansible_lint.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/molecule_client.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/molecule_server.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Molecule Tests atuin client

on:
push:
tags:
- 'v*'

jobs:
deploy_to_galaxy:
runs-on: ubuntu-latest
steps:
- name: Deploy Ansible Galaxy Collection
uses: artis3n/ansible_galaxy_collection@v2
with:
publish: false
api_key: ${{ secrets.GALAXY_API_KEY }}
52 changes: 52 additions & 0 deletions .github/workflows/tests-and-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Molecule Tests atuin client

on: push

jobs:
lint-all-files:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: run-ansible-lint
uses: ansible/[email protected]

molecule-atuin-client:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: "${{ github.repository }}"
- name: Run molecule tests for atuin_client role
uses: gofrolist/molecule-action@v2
with:
molecule_working_dir: ${{ github.repository }}/roles/atuin_client
molecule_args: --scenario-name docker --driver-name docker
env:
ANSIBLE_FORCE_COLOR: '1'

molecule-atuin-server:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: "${{ github.repository }}"
- name: Run molecule tests for atuin_server role
uses: gofrolist/molecule-action@v2
with:
molecule_working_dir: ${{ github.repository }}/roles/atuin_server
molecule_args: --scenario-name default --driver-name docker
env:
ANSIBLE_FORCE_COLOR: '1'

tag-new-versions:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: salsify/action-detect-and-tag-new-version@v2
with:
version-command: |
awk ' /version: / { print $2 } ' galaxy.yml | tr -d '"'
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.0]

### Changed

- Initial release
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
# Ansible Collection - wzzrd.atuin

Documentation for the collection.
This collection enables the deployment and configuration of the atuin binary and required configuration.

The collection contains both a client and a server role. The server role depends on the client role for installation of the binary, after which the server role configures the server and the systemd service.

Each role contains a README.md file explaining the optional and mandatory variables.

Example Playbooks
-----------------

This role is used in the following way in a playbook:

```yaml
- hosts: atuin_server
vars:
atuin_client_version: 18.0.1
atuin_server_db_uri: "postgres://atuin:atuinpw@dbserver/atuindb"

roles:
- role: wzzrd.atuin.atuin_server

- hosts: atuin_clients
vars:
atuin_client_version: 18.0.1

roles:
- role: wzzrd.atuin.atuin_client
```
License
-------
BSD-3-Clause
Author Information
------------------
This role was created by Maxim Burgerhout <[email protected]> as part fo the wzzrd.atuin Ansible collection.
Please log issues at https://github.com/wzzrd/ansible-collection-atuin.
41 changes: 30 additions & 11 deletions roles/atuin_client/README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,57 @@
Role Name
wzzrd.atuin_client
=========

A brief description of the role goes here.
Configures atuin client component

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

Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
It is mandatory to provide a value for the `atuin_client_version` variable.

The role will fail without a value for `atuin_client_version`. This variable is used by the `wzzrd.atuin_client` role to install the atuin binary. It is expected to be a string naming an atuin version: `18.0.1` is a valid value that will make the role succeeed.

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

A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
| Variable name | Default value | Meaning | Mandatory |
|---------------|---------------|---------|-----------|
| atuin_client_version | None | Version of atuin to install | true |
| atuin_client_bin_dir | /usr/local/bin | Location for the atuin binary | false |
| atuin_client_libc_variant | gnu | Which libc implementation to download a binary for | false |

The `atuin_client_libc_variant` expects one of two options: musl or gnu. Choosing gnu will make the role download the atuin binary compiled for an OS with a recent build of glibc. Choosing musl will download a binary compiled and statically linked to the musl libc implementation. This allows you to run atuin on systems with incompatible versions of glibc.

Mind that the musl build (at the time of writing) is only available for x86_64 Linux. Trying to install that build on aarch64 Linux will not work.

The only resort in that case is to use cargo to install atuin. I might implement that in a future version of this role.

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

A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
None

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

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
This role is used in the following way in a playbook:

```yaml
- hosts: atuin_clients
vars:
atuin_client_version: 18.0.1

- hosts: servers
roles:
- { role: username.rolename, x: 42 }
roles:
- role: wzzrd.atuin.atuin_client
```
License
-------
BSD
BSD-3-Clause
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
This role was created by Maxim Burgerhout <[email protected]> as part fo the wzzrd.atuin Ansible collection.
Please log issues at https://github.com/wzzrd/ansible-collection-atuin.
52 changes: 41 additions & 11 deletions roles/atuin_server/README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,68 @@
Role Name
wzzrd.atuin_server
=========

A brief description of the role goes here.
Configures atuin server component

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

Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
It is mandatory to provide values for the `atuin_client_version` and `atuin_server_db_uri` variables.

The role will fail without a value for `atuin_client_version`. This variable is used by the `wzzrd.atuin_client` role to install the atuin binary. It is expected to be a string naming an atuin version: `18.0.1` is a valid value that will make the role succeeed.

The role will succeed, and the atuin server process will start without `atuin_server_db_uri` but will not be fully functional. It expects a PostgreSQL connection URI in the form `postgres://user:password@server/database`.

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

A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
| Variable name | Default value | Meaning | Mandatory |
|---------------|---------------|---------|-----------|
| atuin_client_version | None | Version of atuin to install | true |
| atuin_server_db_uri | None | PostgreSQL database connection URI (see below) | true |
| atuin_server_user | atuin | The name of the user owning the atuin server process | false |
| atuin_server_group | atuin | The name of the group owning the atuin server process | false |
| atuin_server_home | /home/atuin | The home directory for the atuin server user | false |
| atuin_server_host | "{{ ansible_default_ipv4.address }}" | IP address the atuin server process will listen on | false |
| atuin_server_port | 8888 | The port the atuin server process will listen on | false |
| atuin_server_open_registration | false | Whether or not the server will freely allow registration | false |
| atuin_server_max_history_length | 8192 | Maximum length of one history entry | false |
| atuin_server_max_record_size | 1073741824 | Maximum length of one record entry | false |
| atuin_server_page_size | 1100 | Default page size for requests | false |
| atuin_server_enable_metrics | false | Whether metrics are enabled | false |
| atuin_server_metrics_host | 127.0.0.1 | IP address for the metrics process | false |
| atuin_server_metrics_port | 9001 | Port for the metrics process | false |
| atuin_server_enable_tls | false | Whether or not to use TLS for the atuin server process | false |
| atuin_server_cert_path | "" | Path to an SSL certificate | false |
| atuin_server_pkey_path | "" | Path to the SSL certificate private key | false |

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

A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
This role depends on the `wzzrd.atuin_client role`, distributed in the same collection. The `atuin_client` role handles the download of the correct binary (and possibly upgrading an existing binary), the `atuin_server` role handles the server configuration, the systemd unit file, and the ownership of the atuin server process.

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

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
This role is used in the following way in a playbook:

- hosts: servers
roles:
- { role: username.rolename, x: 42 }
```yaml
- hosts: atuin_server
vars:
atuin_client_version: 18.0.1
atuin_server_db_uri: "postgres://atuin:atuinpw@dbserver/atuindb"

roles:
- role: wzzrd.atuin.atuin_server
```
License
-------
BSD
BSD-3-Clause
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
This role was created by Maxim Burgerhout <[email protected]> as part fo the wzzrd.atuin Ansible collection.
Please log issues at https://github.com/wzzrd/ansible-collection-atuin.

0 comments on commit 78d28ed

Please sign in to comment.