forked from davestephens/ansible-nas
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
228 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,6 +214,10 @@ | |
tags: | ||
- flatnotes | ||
|
||
- role: formio | ||
tags: | ||
- formio | ||
|
||
- role: freshrss | ||
tags: | ||
- freshrss | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
formio_enabled: false | ||
formio_available_externally: false | ||
|
||
# directories | ||
formio_data_directory: "{{ docker_home }}/formio" | ||
|
||
# network | ||
formio_port: "3019" | ||
formio_hostname: "formio" | ||
formio_network_name: "formio" | ||
|
||
# specs | ||
formio_memory: 1g | ||
formio_db_memory: 1g | ||
|
||
# docker | ||
formio_container_name: formio | ||
formio_image_name: "garfieldwtf/formio" | ||
formio_image_version: latest | ||
formio_db_container_name: formio-mongodb | ||
formio_db_image_name: mongo | ||
formio_db_image_version: latest | ||
formio_user_id: "1000" | ||
formio_group_id: "1000" | ||
|
||
# formio | ||
formio_mongo_initdb_root_username: "formio" | ||
formio_mongo_initdb_root_password: "formio" | ||
formio_email_type: "smtp" | ||
formio_email_host: "smtp.gmail.com" | ||
formio_email_port: "587" | ||
formio_email_secure: "false" | ||
formio_email_ignore_tls: "false" | ||
formio_email_auth_user: "" | ||
formio_email_auth_password: "" | ||
formio_email_allow_unauthorized_certs: "true" | ||
formio_debug: "formio:*" | ||
formio_node_config: | ||
mongo: "mongodb://{{ formio_mongo_initdb_root_username }}:{{ formio_mongo_initdb_root_password }}@{{ formio_db_container_name }}:27017" | ||
domain: "https://{{ formio_hostname }}.{{ ansible_nas_domain }}" | ||
email: | ||
type: "{{ formio_email_type }}" | ||
settings: | ||
email: | ||
smtp: | ||
host: "{{ formio_email_host }}" | ||
port: "{{ formio_email_port }}" | ||
secure: "{{ formio_email_secure }}" | ||
ignoreTLS: "{{ formio_email_ignore_tls }}" | ||
auth: | ||
user: "{{ formio_email_auth_user }}" | ||
pass: "{{ formio_email_auth_password }}" | ||
allowUnauthorizedCerts: "{{ formio_email_allow_unauthorized_certs }}" | ||
formio_root_email: "formio@{{ ansible_nas_domain }}" | ||
formio_root_password: "{{ formio_mongo_initdb_root_password }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# FormIO | ||
|
||
Homepage: [https://github.com/formio/formio](https://github.com/formio/formio) | ||
|
||
A Form and Data Management Platform for Progressive Web Applications. | ||
|
||
## Usage | ||
|
||
Set `formio_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file. | ||
|
||
formio web interface can be found at [http://ansible_nas_host_or_ip:3019](http://ansible_nas_host_or_ip:3019). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
provisioner: | ||
inventory: | ||
group_vars: | ||
all: | ||
formio_enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
- name: Stop | ||
hosts: all | ||
become: true | ||
tasks: | ||
- name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role" | ||
ansible.builtin.include_role: | ||
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" | ||
vars: | ||
formio_enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
- name: Verify | ||
hosts: all | ||
gather_facts: false | ||
tasks: | ||
- name: Include vars | ||
ansible.builtin.include_vars: | ||
file: ../../defaults/main.yml | ||
|
||
- name: Get formio db container state | ||
community.docker.docker_container: | ||
name: "{{ formio_db_container_name }}" | ||
register: result_db | ||
|
||
- name: Get formio container state | ||
community.docker.docker_container: | ||
name: "{{ formio_container_name }}" | ||
register: result | ||
|
||
- name: Check if formio containers are running | ||
ansible.builtin.assert: | ||
that: | ||
- result_db.container['State']['Status'] == "running" | ||
- result_db.container['State']['Restarting'] == false | ||
- result.container['State']['Status'] == "running" | ||
- result.container['State']['Restarting'] == false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
- name: Verify | ||
hosts: all | ||
gather_facts: false | ||
tasks: | ||
- name: Include vars | ||
ansible.builtin.include_vars: | ||
file: ../../defaults/main.yml | ||
|
||
- name: Try and stop and remove formio db | ||
community.docker.docker_container: | ||
name: "{{ formio_db_container_name }}" | ||
state: absent | ||
register: result_db | ||
|
||
- name: Try and stop and remove formio | ||
community.docker.docker_container: | ||
name: "{{ formio_container_name }}" | ||
state: absent | ||
register: result | ||
|
||
- name: Check if formio is stopped | ||
ansible.builtin.assert: | ||
that: | ||
- not result_db.changed | ||
- not result.changed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../requirements.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
- name: Start FormIO | ||
block: | ||
- name: Create FormIO Directories | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: directory | ||
with_items: | ||
- "{{ formio_data_directory }}" | ||
|
||
- name: Create FormIO network | ||
community.docker.docker_network: | ||
name: "{{ formio_network_name }}" | ||
|
||
- name: Create FormIO Db Docker Container | ||
community.docker.docker_container: | ||
name: "{{ formio_db_container_name }}" | ||
image: "{{ formio_db_image_name }}:{{ formio_db_image_version }}" | ||
pull: true | ||
volumes: | ||
- "{{ formio_data_directory }}/data/mdb-data:/data/db:rw" | ||
networks: | ||
- name: "{{ formio_network_name }}" | ||
network_mode: "{{ formio_network_name }}" | ||
container_default_behavior: no_defaults | ||
env: | ||
MONGO_INITDB_ROOT_USERNAME: "{{ formio_mongo_initdb_root_username }}" | ||
MONGO_INITDB_ROOT_PASSWORD: "{{ formio_mongo_initdb_root_password }}" | ||
labels: | ||
traefik.enable: "false" | ||
restart_policy: always | ||
memory: "{{ formio_db_memory }}" | ||
|
||
- name: Create FormIO Docker Container | ||
community.docker.docker_container: | ||
container_default_behavior: no_defaults | ||
name: "{{ formio_container_name }}" | ||
image: "{{ formio_image_name }}:{{ formio_image_version }}" | ||
pull: true | ||
networks: | ||
- name: "{{ formio_network_name }}" | ||
network_mode: "{{ formio_network_name }}" | ||
ports: | ||
- "{{ formio_port }}:3001" | ||
command: npm run start:prod | ||
env: | ||
DEBUG: "{{ formio_debug }}" | ||
NODE_CONFIG: "{{ formio_node_config | to_json }}" | ||
ROOT_EMAIL: "{{ formio_root_email }}" | ||
ROOT_PASSWORD: "{{ formio_root_password }}" | ||
restart_policy: unless-stopped | ||
memory: "{{ formio_memory }}" | ||
labels: | ||
traefik.enable: "{{ formio_available_externally | string }}" | ||
traefik.http.routers.formio.rule: "Host(`{{ formio_hostname }}.{{ ansible_nas_domain }}`)" | ||
traefik.http.routers.formio.tls.certresolver: "letsencrypt" | ||
traefik.http.routers.formio.tls.domains[0].main: "{{ ansible_nas_domain }}" | ||
traefik.http.routers.formio.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" | ||
traefik.http.services.formio.loadbalancer.server.port: "3001" | ||
when: formio_enabled is true | ||
|
||
- name: Stop FormIO | ||
block: | ||
- name: Stop FormIO db | ||
community.docker.docker_container: | ||
name: "{{ formio_db_container_name }}" | ||
state: absent | ||
|
||
- name: Stop FormIO | ||
community.docker.docker_container: | ||
name: "{{ formio_container_name }}" | ||
state: absent | ||
when: formio_enabled is false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
title: "FormIO" | ||
description: "A Form and Data Management Platform for Progressive Web Applications." | ||
--- | ||
|
||
Homepage: [https://github.com/formio/formio](https://github.com/formio/formio) | ||
|
||
A Form and Data Management Platform for Progressive Web Applications. | ||
|
||
## Usage | ||
|
||
Set `formio_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file. | ||
|
||
formio web interface can be found at [http://ansible_nas_host_or_ip:3019](http://ansible_nas_host_or_ip:3019). |