ansibleguy.sw_semaphore

<a href="https://www.ansible-semaphore.com/">
<img src="https://repository-images.githubusercontent.com/23267883/6521ff0c-6a8d-4b67-897e-40354ecd5391" alt="Ansible-Semaphore - modern UI for Ansible" width="600"/>
</a>

# Ansible Role - Ansible-Semaphore

This role sets up [Ansible Semaphore](https://github.com/ansible-semaphore/semaphore) on a Linux server.

Semaphore is a simple alternative to [Ansible AWX](https://github.com/ansibleguy/sw_awx). (_A web interface to use Ansible_)

<a href='https://ko-fi.com/ansible0guy' target='_blank'><img height='35' style='border:0px;height:46px;' src='https://az743702.vo.msecnd.net/cdn/kofi3.png?v=0' border='0' alt='Buy me a coffee' />

[![Molecule Test Status](https://badges.ansibleguy.net/sw_semaphore.molecule.svg)](https://github.com/ansibleguy/_meta_cicd/blob/latest/templates/usr/local/bin/cicd/molecule.sh.j2)
[![YamlLint Test Status](https://badges.ansibleguy.net/sw_semaphore.yamllint.svg)](https://github.com/ansibleguy/_meta_cicd/blob/latest/templates/usr/local/bin/cicd/yamllint.sh.j2)
[![PyLint Test Status](https://badges.ansibleguy.net/sw_semaphore.pylint.svg)](https://github.com/ansibleguy/_meta_cicd/blob/latest/templates/usr/local/bin/cicd/pylint.sh.j2)
[![Ansible-Lint Test Status](https://badges.ansibleguy.net/sw_semaphore.ansiblelint.svg)](https://github.com/ansibleguy/_meta_cicd/blob/latest/templates/usr/local/bin/cicd/ansiblelint.sh.j2)
[![Ansible Galaxy](https://badges.ansibleguy.net/galaxy.badge.svg)](https://galaxy.ansible.com/ui/standalone/roles/ansibleguy/sw_semaphore)

Molecule Logs: [Short](https://badges.ansibleguy.net/log/molecule_sw_semaphore_test_short.log), [Full](https://badges.ansibleguy.net/log/molecule_sw_semaphore_test.log)

**Tested on:**
* Debian 11

## Installation

```bash
# Install the latest version
ansible-galaxy role install git+https://github.com/ansibleguy/sw_semaphore

# Install from Galaxy
ansible-galaxy install ansibleguy.sw_semaphore

# Or install to a custom role path
ansible-galaxy install ansibleguy.sw_semaphore --roles-path ./roles

# Install dependencies
ansible-galaxy install -r requirements.yml

Usage

Want a simple Ansible interface? Check out my Ansible WebUI.

Configuration

Basic configuration:

semaphore:
  nginx:
    domain: 'semaphore.test.ansibleguy.net'

  # optional:
  # version: '2.8.90'
  # admin:
  #   user: 'admin'
  #   name: 'AnsibleGuy'
  #   email: '[email protected]'

Customize the configuration as needed:

semaphore:
  manage:
    webserver: true  # install and set up local nginx with minimum certificate
    database: true  # install and set up local MariaDB
    backup: true  # set up daily local database backup (if managed)
    user: true  # create service user 'semaphore'
    ansible_cfg: true  # create /home/semaphore/.ansible.cfg
    admin: true  # add admin user after installation

  version: '2.8.90'  # version info: https://github.com/ansible-semaphore/semaphore/releases

  persistent_requirements: false

  admin:
    user: 'admin'
    email: '[email protected]'
    pwd: !vault |
      $ANSIBLE_VAULT;1.1;AES256
      ...

  config:  # configuration key-value pairs as seen in 'config.json': https://docs.ansible-semaphore.com/administration-guide/configuration
    concurrency_mode: 'node'
    email_sender: '[email protected]'
    email_host: 'mail.template.ansibleguy.net'
    email_alert: true

    # optional
    ldap_enable: true
    ldap_needtls: true
    ldap_binddn: 'service_semaphore'
    ldap_bindpassword: !vault |
      $ANSIBLE_VAULT;1.1;AES256
      ...
    ldap_server: 'ldap.template.ansibleguy.net:636'
    ldap_searchfilter: '(&(mail=%s)(objectClass=person)(memberOf:=CN=semaphore,OU=Groups,DC=template,DC=ansibleguy,DC=net))'  # login with email; must be in 'semaphore' group

    # optional => see: https://docs.ansible-semaphore.com/administration-guide/security#database-encryption
    cookie_hash: !vault |
      $ANSIBLE_VAULT;1.1;AES256
      ...
    cookie_encryption: !vault |
      $ANSIBLE_VAULT;1.1;AES256
      ...
    access_key_encryption: !vault |
      $ANSIBLE_VAULT;1.1;AES256
      ...

  requirements:  # requirements for the execution environment
    pip: ['httpx']  # any Python3 modules
    collections: ['community.general']  # any Ansible collections (if persistent_requirements=true)
    roles: []  # any Ansible roles (if persistent_requirements=true)

  ansible_config:  # /home/semaphore/.ansible.cfg => if manage.ansible_cfg=true; see: https://docs.ansible.com/ansible/latest/reference_appendices/config.html
    defaults:  # section
      remote_port: 48322
      vault_id_match: 'semaphore'
    diff:
      context: 2

  backup:
    retention_days: 30

You might want to use 'ansible-vault' to encrypt your passwords:

ansible-vault encrypt_string

Running the Playbook

To run the playbook:

ansible-playbook -K -D -i inventory/hosts.yml playbook.yml

There are some useful tags you can use:

  • webserver
  • database
  • config
  • requirements

To debug errors, set the 'debug' variable at runtime:

ansible-playbook -K -D -i inventory/hosts.yml playbook.yml -e debug=yes

Features

  • Package Installation

    • Ansible-Semaphore in the specified version
    • Python3 PIP
    • Python3 Virtual Environment
      • Ansible
      • common Ansible Jinja-Filter dependencies
    • Git
  • Configuration

    • Service: 'semaphore.service'

    • Service user: 'semaphore'

    • Default Configuration:

      • Directories:
        • Venv: '/var/local/lib/semaphore_venv'
        • Config: '/etc/semaphore'
        • Backup: '/var/backups/semaphore'
        • Tmp/Run: '/tmp/.semaphore'
    • Default Options:

      • Nginx proxy => using THIS Role
      • MariaDB database => using THIS Role
      • Daily local database backup (if the database is managed)
        • Backup service: 'semaphore-backup.service'
      • Provisioning 'ansible.cfg' for service user
      • Adding admin user after installation
    • Default Options to Exclude:

      • Persistent requirements
        • Update service: 'semaphore-requirements.service'

Additional Info

  • Note: This role currently supports Debian-based systems only.

  • Note: Most of the role's features can be excluded if not needed.

    For all available options, see the default config file located in the main defaults file!

  • Warning: Not all settings/variables you provide will be checked for validity. Incorrect configurations may cause problems!

  • Note: If you prefer using Docker, check out the official Docker image of Ansible-Semaphore instead!

  • Info: Persistent requirements can help speed up executions.

    It will install & update Ansible roles & collections using an external service/timer.

    By default, Semaphore will need to reinstall them ON EACH EXECUTION.

    To use this feature, ensure that the requirements files do not exist in your repositories:

    • $REPO/collections/requirements.yml
    • $REPO/roles/requirements.yml

```

Informazioni sul progetto

Ansible role to provision Ansible-Semaphore on a linux server

Installa
ansible-galaxy install ansibleguy.sw_semaphore
Licenza
gpl-3.0
Download
2.1k
Proprietario
[email protected] | GPG: https://badges.ansibleguy.net/public.gpg