From 86ad871ecc1b4e9c9b1eae7164cb74fc265b4cdc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20-=20Le=20Filament?= <remi@le-filament.com>
Date: Fri, 11 Jun 2021 16:13:04 +0200
Subject: [PATCH] Role documentation

---
 README.md         | 37 ++++++++++++++++++++++++++++++-------
 defaults/main.yml | 37 ++++++++++++++++++++++++++++++++++++-
 meta/main.yml     | 26 ++++++++++++--------------
 3 files changed, 78 insertions(+), 22 deletions(-)

diff --git a/README.md b/README.md
index a3d0bdb..e64eaa9 100644
--- a/README.md
+++ b/README.md
@@ -1,22 +1,41 @@
-Role Name
-=========
+docker_mattermost
+=================
 
-A brief description of the role goes here.
+This role deploys Mattermost on Docker
 
 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.
+None
 
 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.
+Variables from default directory :
+* mm_url: URL on which Mattermost will be listening
+* mm_db_name: Database name
+* mm_db_user: Database user
+* mm_db_pass: Database password
+* default_maintenance_email: maintenance e-mail used to request Let's Encrypt certificate
+* Mail configuration (optional, if set, a postfix proxy will be deployed, otherwise a mailhog instance will be deployed for blocking e-mails)
+  * mailname: domain to which the users belong to
+  * mailserver: SMTP server to use for sending e-mails (defaults to smtp.{{ domain }})
+  * smtpport: SMTP server port (defaults to 465)
+  * smtpuser: SMTP username (defaults to smtpuser)
+  * smtppass: SMTP user password (defaults to veryUnsecurePassToBeModified)
+* Backups :
+  * swift parameters for 2 object storage instances where backups should be pushed daily
+  * auth_backup_pass : Passphrase for encryption of backups
+
 
 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 requires the following Ansible collection :
+* community.docker
+
+This Docker role supposes that Traefik is deployed as an inverseproxy in front of the deployed Dockers.
+The following role is used by Le Filament for deploying Traefik : docker_server (https://sources.le-filament.com/lefilament/ansible-roles/docker_server)
 
 Example Playbook
 ----------------
@@ -25,7 +44,11 @@ Including an example of how to use your role (for instance, with variables passe
 
     - hosts: servers
       roles:
-         - { role: username.rolename, x: 42 }
+         - { role: docker_mattermost }
+      vars:
+         - { mm_url: "mattermost.example.org" }
+         - { mm_db_pas: "veryUnsecurePassToBeModified" }
+         - { default_maintenance_email: "maintenance@example.org" }
 
 License
 -------
diff --git a/defaults/main.yml b/defaults/main.yml
index 9457e0c..0c5525c 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -1,2 +1,37 @@
 ---
-# defaults file for test
+# Mattermost URL
+mm_url: "mattermost.example.org"
+# Mattermost DB
+mm_db_name: "mattermost"
+mm_db_user: "mattermost"
+mm_db_pass: "veryUnsecurePassToBeModified"
+
+# Maintenance e-mail for Let's Encrypt certificate
+default_maintenance_email: maintenance@{{ domain }}
+
+# OPTIONAL - Mailserver, if defined a postfix proxy will be deployed, otherwise MailHog will be deployed
+# mailname: example.org
+# mailserver: smtp.example.org
+# smtpport: 465
+# smtpuser: smtpuser
+# smtppass: veryUnsecurePassToBeModified
+
+# Backups
+# Parameters for pushing backups to Object Storage - Instance 1
+swift_odoo_authurl: https://auth.cloud.ovh.net/v3/
+swift_odoo_authversion: 3
+swift_odoo_tenantid: "132e1fa"
+swift_odoo_tenantname: "12312534534"
+swift_odoo_username: "testuser"
+swift_odoo_password: "testpassword"
+swift_odoo_regionname: "GRA"
+# Parameters for pushing backups to Object Storage - Instance 2
+swift_odoo2_authurl: https://auth.cloud.ovh.net/v3/
+swift_odoo2_authversion: 3
+swift_odoo2_tenantid: "12323534ab"
+swift_odoo2_tenantname: "123124235345"
+swift_odoo2_username: "testuser"
+swift_odoo2_password: "testpassword"
+swift_odoo2_regionname: "DE"
+# Passphrase for backups encryption
+mm_backup_pass: notSecureEnoughPasswordToBeModified
diff --git a/meta/main.yml b/meta/main.yml
index 4ed7944..d8d07ee 100644
--- a/meta/main.yml
+++ b/meta/main.yml
@@ -1,20 +1,18 @@
+---
 galaxy_info:
   author: Rémi
-  description: your role description
+  description: This role deploys Mattermost on Docker
   company: Le Filament (https://le-filament.com)
-
   license: AGPL-3.0-or-later
-
   min_ansible_version: 2.1
-
   platforms:
-   - name: CentOS
-     versions:
-      - 7
-   - name: Ubuntu
-     versions:
-     - 16.04
-     - 18.04
-     - 20.04
-
-  galaxy_tags: []
+    - name: CentOS
+      versions:
+        - 7
+    - name: Ubuntu
+      versions:
+        - 16.04
+        - 18.04
+        - 20.04
+  galaxy_tags:
+    - mattermost
-- 
GitLab