2020-03-26 11:36:08 +01:00
2021-06-21 19:04:24 +02:00
2021-09-01 20:16:55 +02:00
2021-09-01 20:33:48 +02:00
2020-09-11 10:23:00 +02:00
2021-04-06 16:15:13 +02:00
2021-05-07 17:19:27 +02:00
ref
2021-08-13 16:53:48 +02:00
2020-09-15 12:30:55 +02:00
2021-06-29 11:32:17 +02:00
2020-06-17 19:37:42 +02:00
2020-06-11 09:41:08 +02:00
2020-08-17 09:19:57 +02:00
2021-09-01 19:41:20 +02:00
2021-07-29 17:11:51 +02:00
2021-05-14 12:27:26 +02:00
2021-05-31 12:30:30 +02:00
2021-06-08 18:58:07 +02:00
2021-09-01 19:41:20 +02:00
2021-04-06 16:15:13 +02:00
2021-08-25 14:46:01 +02:00
2021-09-01 20:16:55 +02:00
2021-09-01 20:16:55 +02:00

Ansible Playbooks

Ansible Lint

Collection of Ansible playbooks and roles.

Roles

Role dependency graph:

Role details:

Role Description
blackbox-exporter Deploy Blackbox exporter container.
bigbluebutton-exporter Deploy BigBlueButton exporter container.
bigbluebutton Install BigBlueButton with https and greenlight.
bookstack Deploy BookStack container.
cadvisor Deploy cAdvisor Docker container.
certbot Deploy Let's Encrypt certificates.
clean Cleanup Ansible roles.
commento Deploy Commento container.
debug Debug Ansible variables.
* docker-compose Deploy Docker Compose project.
docker-network Configure Docker network.
docker-volume Configure Docker volume.
docker-swarm Configure Docker Swarm.
docker Install Docker for Ubuntu and CentOS.
elasticsearch Deploy ElasticSearch Docker cluster.
fail2ban Install and configure fail2ban.
fstab Configure the fstab file.
grafana Deploy Grafana Docker container.
iam Configures users and groups.
keycloak Deploy Keycloak Docker container.
kibana Deploy Kibana Docker container.
locale Set system locale.
logstash Deploy Logstash Docker container.
maintenance Maintain operating system and disk space.
metricbeat Deploy Metricbeat Docker container.
moodle Deploy Moodle container.
mysql Deploy MySQL database container.
nextcloud-apps Install, update and remove Nextcloud apps.
nextcloud-exporter Deploy Nextcloud exporter container.
nextcloud Deploy Nextcloud container.
nginx-waf Deploy Nginx with ModSecurity and Core Rule Set.
nginx Deploy Nginx proxy with Certbot.
node-exporter Deploy Node exporter container and install custom metric script.
odoo-apps Install Odoo apps from file, url, public or private GitHub repo.
odoo-data Generate Odoo data modules.
odoo-enterprise Checkout the Odoo Enterprise git repository.
odoo-scripts Install Odoo scripts.
odoo Deploy Odoo container.
onlyoffice-documentserver Deploy OnlyOffice Document Server container.
openldap Deploy OpenLDAP Docker container.
package Set env vars and install packages.
pgadmin Install pgAdmin container.
postgres-exporter Deploy PostgreSQL exporter container.
postgres Deploy PostgreSQL database container.
prometheus Deploy Prometheus Docker container.
redis Deploy Redis container.
remark42 Deploy Remark42 container.
restic-client Configure Restic client backup jobs.
restic-server Deploy Restic server container.
simple-mail-forwarder Deploy Simple Mail Forwarder container container.
s3cmd Install and configure s3cmd.
ufw Configure UFW rules.
update Install system and package updates.
vercel Manage vercel domain and dns entries.

WIP:

Usage

Clone this repository.

git clone https://github.com/Mint-System/Ansible-Playbooks.git

Set this the task alias.

alias task=./task

Setup

Navigate to the playbook folder.

cd Ansible-Playbooks

Generate a password file for Ansible vault.

task generate-passwordfile $PASSWORD

Initialize and install Ansible.

task init; task install-ansible

Install Python and Ansible dependencies.

task install-packages

Create an inventory and configure a role.

Ansbile Documentation > Build Your Inventory

Deployment

List inventory

ansible-inventory --list -y -i inventories/setup | grep -E 'ansible_host'

Test connection

ansible all -m ping -i inventories/odoo

Deploy multiple inventories

ansible-playbook -i inventories/setup -i inventories/odoo -i inventories/proxy odoo.yml

Deploy Odoo stack

ansible-playbook -i inventories/odoo odoo.yml

Deploy role only

ansible-playbook -i inventories/odoo odoo.yml -t postgres

Deploy without dependencies

ansible-playbook -i inventories/odoo odoo.yml --skip-tags depends

Deploy role to specific host

ansible-playbook -i inventories/odoo odoo.yml -t docker -l host.example.com

Deploy role to specific group with non-default user

ansible-playbook -i inventories/odoo docker.yml -t docker -l europe -u username

Clean Odoo stack

ansible-playbook -i inventories/odoo clean.yml -t odoo,odoo-volume,odoo-data-dir,postgres,postgres-volume

Clean role only

ansible-playbook -i inventories/odoo clean.yml -t docker-network

Clean dry run

ansible-playbook -i inventories/odoo odoo.yml -t odoo --check

Install odoo-scripts and odoo-apps locally

ansible-playbook -i inventories/odoo localhost.yml --skip-tags depends

List all Odoo databses.

ansible all -i inventories/odoo -a "docker-odoo-list -c {{ odoo_hostname }}"

Docs

Quality

Lint the project using Ansible lint.

task lint

Config

Whenever possible use env variables to configure the container.

Env Config

    env:
      POSTGRES_USER: "{{ postgres_user }}"
      POSTGRES_PASSWORD: "{{ postgres_password }}"
      POSTGRES_DB: "{{ postgres_db }}"

Data

To persist data use Docker volumes.

Volume Mount

Mount the folder without subfolder.

    volumes:
      - "{{ postgres_volume_name }}:/var/lib/postgresql/data"

For Ansible config files use file mounts.

Bind Mount

    volumes:
      - "{{ nginx_data_dir }}/:/etc/nginx/conf.d/:ro"

Guidelines

Every role folder must contain a README.md file.

Mark fix-me-comments with # FIXME: <your text>.

Naming

Template for role vars:

# Basics:
# Url to Docker repsitory
ROLENAME_image: URL
ROLENAME_hostname: SHORTNAME + COUNTER
ROLENAME_port:
ROLENAME_volume_name: SHORTNAME_data + COUNTER
ROLENAME_data_dir: /usr/share/SHORTNAME + COUNTER
# Database connection:
ROLENAME_db_type: mysql
ROLENAME_db_user:
ROLENAME_db_password: "{{ vault_ROLENAME_db_password }}"
ROLENAME_db_hostname:
ROLENAME_db_name:
# Credentials user:
ROLENAME_user:
ROLENAME_password: "{{ vault_ROLENAME_password }}"
# Credentials admin:
ROLENAME_admin_user:
ROLENAME_admin_password: "{{ vault_ROLENAME_admin_password }}"
# Named database connection:
ROLENAME_postgres_hostname:
ROLENAME_postgres_user:
ROLENAME_postgres_password: "{{ vault_ROLENAME_postgres_password }}"
# SMTP
ROLENAME_smtp_hostname:
ROLENAME_smtp_auth:
ROLENAME_smtp_secure:
ROLENAME_smtp_port:
ROLENAME_smtp_domain:
ROLENAME_smtp_from:
ROLENAME_smtp_username:
ROLENAME_smtp_password:

Role names must be lower case and may contain a -.

Role and Tags

Roles can have multiple tags.

example one tag

To define a Postgres role, you would:

  • Create role postges
  • Assign the tag postgres
  • Create a task file postgres.yml

example multiple tags

To define a Nginx role with a config tag, you would:

  • Create role nginx
  • Assign the tags nginx and nginx-config
  • Create the task files nginx.yml and nginx-config.yml

In the main.yml you would include the tasks as followed:

- name: "Include {{ role_name }} config tasks"
  include_tasks: "{{ role_name }}-config.yml"
  when: nginx_data_dir is defined
  tags:
    - nginx
    - nginx-config

- name: "Include {{ role_name }} tasks"
  include_tasks: "{{ role_name }}.yml"
  when: nginx_image is defined
  tags:
    - nginx
S
Description
No description provided
Readme AGPL-3.0
255 MiB
0 Stars 3 Watchers 0 Forks
Languages
Shell 88.2%
Python 6.9%
JavaScript 2.6%
Dockerfile 1.3%
HTML 0.5%
Other 0.5%