forked from davestephens/ansible-nas
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Add Maker Management Platform (#161)
- Loading branch information
Showing
11 changed files
with
194 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 |
---|---|---|
|
@@ -521,6 +521,10 @@ | |
tags: | ||
- miniserve | ||
|
||
- role: mmp | ||
tags: | ||
- mmp | ||
|
||
- role: mosquitto | ||
tags: | ||
- mosquitto | ||
|
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 @@ | ||
--- | ||
mmp_enabled: false | ||
mmp_available_externally: false | ||
|
||
# directories | ||
mmp_data_directory: "{{ docker_home }}/mmp" | ||
|
||
# network | ||
mmp_ui_port: "8152" | ||
mmp_agent_port: "8153" | ||
mmp_hostname: "mmp" | ||
mmp_network_name: "mmp" | ||
|
||
# specs | ||
mmp_agent_memory: 1g | ||
mmp_ui_memory: 1g | ||
|
||
# docker | ||
mmp_agent_container_name: mmp-agent | ||
mmp_agent_image_name: "ghcr.io/maker-management-platform/agent" | ||
mmp_agent_image_version: main | ||
mmp_ui_container_name: mmp-ui | ||
mmp_ui_image_name: "ghcr.io/maker-management-platform/mmp-ui" | ||
mmp_ui_image_version: master | ||
mmp_user_id: "1000" | ||
mmp_group_id: "1000" |
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 @@ | ||
# Maker Management Platform | ||
|
||
Homepage: [https://github.com/Maker-Management-Platform/docs](https://github.com/Maker-Management-Platform/docs) | ||
|
||
Maker Management Platform, or mmp, aims to simplify and unify the management of a variety of digital assets related to 3d printing, manufacturing, laser engraving and such. | ||
|
||
## Usage | ||
|
||
Set `mmp_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file. | ||
|
||
Maker Management Platform web interface can be found at [http://ansible_nas_host_or_ip:8152](http://ansible_nas_host_or_ip:8152). |
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: | ||
mmp_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: | ||
mmp_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 mmp db container state | ||
community.docker.docker_container: | ||
name: "{{ mmp_db_container_name }}" | ||
register: result_db | ||
|
||
- name: Get mmp container state | ||
community.docker.docker_container: | ||
name: "{{ mmp_container_name }}" | ||
register: result | ||
|
||
- name: Check if mmp 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 mmp db | ||
community.docker.docker_container: | ||
name: "{{ mmp_db_container_name }}" | ||
state: absent | ||
register: result_db | ||
|
||
- name: Try and stop and remove mmp | ||
community.docker.docker_container: | ||
name: "{{ mmp_container_name }}" | ||
state: absent | ||
register: result | ||
|
||
- name: Check if mmp 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,69 @@ | ||
--- | ||
- name: Start Mmp | ||
block: | ||
- name: Create mmp Directories | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: directory | ||
with_items: | ||
- "{{ mmp_data_directory }}" | ||
|
||
- name: Create Mmp network | ||
community.docker.docker_network: | ||
name: "{{ mmp_network_name }}" | ||
|
||
- name: Create Mmp Agent Docker Container | ||
community.docker.docker_container: | ||
name: "{{ mmp_agent_container_name }}" | ||
image: "{{ mmp_agent_image_name }}:{{ mmp_agent_image_version }}" | ||
pull: true | ||
ports: | ||
- "{{ mmp_agent_port }}:8000" | ||
volumes: | ||
- "{{ mmp_data_directory }}/library:/library:rw" | ||
- "{{ mmp_data_directory }}/data:/data:rw" | ||
networks: | ||
- name: "{{ mmp_network_name }}" | ||
network_mode: "{{ mmp_network_name }}" | ||
container_default_behavior: no_defaults | ||
labels: | ||
traefik.enable: "false" | ||
restart_policy: always | ||
memory: "{{ mmp_agent_memory }}" | ||
|
||
- name: Create Mmp UI Docker Container | ||
community.docker.docker_container: | ||
container_default_behavior: no_defaults | ||
name: "{{ mmp_ui_container_name }}" | ||
image: "{{ mmp_ui_image_name }}:{{ mmp_ui_image_version }}" | ||
pull: true | ||
networks: | ||
- name: "{{ mmp_network_name }}" | ||
network_mode: "{{ mmp_network_name }}" | ||
ports: | ||
- "{{ mmp_ui_port }}:8081" | ||
env: | ||
AGENT_ADDRESS: "{{ mmp_agent_container_name }}:8000" | ||
restart_policy: unless-stopped | ||
memory: "{{ mmp_ui_memory }}" | ||
labels: | ||
traefik.enable: "{{ mmp_available_externally | string }}" | ||
traefik.http.routers.mmp.rule: "Host(`{{ mmp_hostname }}.{{ ansible_nas_domain }}`)" | ||
traefik.http.routers.mmp.tls.certresolver: "letsencrypt" | ||
traefik.http.routers.mmp.tls.domains[0].main: "{{ ansible_nas_domain }}" | ||
traefik.http.routers.mmp.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" | ||
traefik.http.services.mmp.loadbalancer.server.port: "8081" | ||
when: mmp_enabled is true | ||
|
||
- name: Stop Mmp | ||
block: | ||
- name: Stop Mmp db | ||
community.docker.docker_container: | ||
name: "{{ mmp_db_container_name }}" | ||
state: absent | ||
|
||
- name: Stop Mmp | ||
community.docker.docker_container: | ||
name: "{{ mmp_container_name }}" | ||
state: absent | ||
when: mmp_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: "Maker Management Platform" | ||
description: "Management of a variety of digital assets related to 3d printing, manufacturing, laser engraving and such." | ||
--- | ||
|
||
Homepage: [https://github.com/Maker-Management-Platform/docs](https://github.com/Maker-Management-Platform/docs) | ||
|
||
Maker Management Platform, or mmp, aims to simplify and unify the management of a variety of digital assets related to 3d printing, manufacturing, laser engraving and such. | ||
|
||
## Usage | ||
|
||
Set `mmp_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file. | ||
|
||
Maker Management Platform web interface can be found at [http://ansible_nas_host_or_ip:8152](http://ansible_nas_host_or_ip:8152). |