Skip to content
Snippets Groups Projects
Commit 90be3710 authored by Nicolas KAROLAK's avatar Nicolas KAROLAK
Browse files

simplify roles organization and renames

parent eba3e448
No related branches found
No related tags found
No related merge requests found
Showing
with 113 additions and 72 deletions
...@@ -7,4 +7,7 @@ exclude_paths: ...@@ -7,4 +7,7 @@ exclude_paths:
- playbooks/upgrade.yml - playbooks/upgrade.yml
- roles/_*/ - roles/_*/
skip_list:
- '701'
... ...
roles/import/files/on-upload filter=lfs diff=lfs merge=lfs -text roles/mediaimport/files/on-upload filter=lfs diff=lfs merge=lfs -text
...@@ -12,7 +12,7 @@ inventories/* ...@@ -12,7 +12,7 @@ inventories/*
inventories/local*/host_vars/localhost.yml inventories/local*/host_vars/localhost.yml
playbooks/_* playbooks/_*
roles/_* roles/_*
logs/ ./logs/
log/ log/
# packer # packer
......
SHELL := /bin/bash SHELL := /bin/bash
DOCKER_IMAGE_NAME := registry.ubicast.net/mediaserver/envsetup DOCKER_IMAGE_NAME := registry.ubicast.net/mediaserver/envsetup
ifdef debug
MOLECULE_FLAGS += --debug
endif
ifdef keep
MOLECULE_TEST_FLAGS += --destroy=never
endif
VENV := /tmp/pyvensetup VENV := /tmp/pyvensetup
PIP_BIN = $(shell command -v $(VENV)/bin/pip3 || command -v pip3 || echo pip3) PIP_BIN = $(shell command -v $(VENV)/bin/pip3 || command -v pip3 || echo pip3)
PIP_COMPILE_BIN = $(shell command -v $(VENV)/bin/pip-compile || command -v pip-compile) PIP_COMPILE_BIN = $(shell command -v $(VENV)/bin/pip-compile || command -v pip-compile)
...@@ -15,6 +9,14 @@ ANSIBLE_LINT_BIN = $(shell command -v ansible-lint || command -v $(VENV)/bin/ans ...@@ -15,6 +9,14 @@ ANSIBLE_LINT_BIN = $(shell command -v ansible-lint || command -v $(VENV)/bin/ans
YAMLLINT_BIN = $(shell command -v yamllint || command -v $(VENV)/bin/yamllint) YAMLLINT_BIN = $(shell command -v yamllint || command -v $(VENV)/bin/yamllint)
FLAKE8_BIN = $(shell command -v flake8 || command -v $(VENV)/bin/flake8) FLAKE8_BIN = $(shell command -v flake8 || command -v $(VENV)/bin/flake8)
# molecule tests flags
ifdef debug
MOLECULE_FLAGS += --debug
endif
ifdef keep
MOLECULE_TEST_FLAGS += --destroy=never
endif
.PHONY: all .PHONY: all
## TARGET: DESCRIPTION: ARGS ## TARGET: DESCRIPTION: ARGS
all: help all: help
...@@ -50,7 +52,7 @@ lint: ...@@ -50,7 +52,7 @@ lint:
$(ANSIBLE_LINT_BIN) site.yml $(ANSIBLE_LINT_BIN) site.yml
.PHONY: test .PHONY: test
## test: Run development tests on the project : debug=1, keep=1 ## test: Run development tests on the project : debug=1, keep=1, SKYREACH_SYSTEM_KEY=<xxx>
test: test:
ifndef SKYREACH_SYSTEM_KEY ifndef SKYREACH_SYSTEM_KEY
$(error SKYREACH_SYSTEM_KEY is undefined) $(error SKYREACH_SYSTEM_KEY is undefined)
......
...@@ -62,16 +62,16 @@ mymediaserver ...@@ -62,16 +62,16 @@ mymediaserver
mymediaworker mymediaworker
mymediavault mymediavault
[monitor] [msmonitor]
mymediaserver mymediaserver
[postgres] [postgres]
mymediaserver mymediaserver
[manager] [mirismanager]
mymediaserver mymediaserver
[server] [mediaserver]
mymediaserver mymediaserver
[wowza] [wowza]
...@@ -80,10 +80,10 @@ mymediaserver ...@@ -80,10 +80,10 @@ mymediaserver
[celerity] [celerity]
mymediaserver mymediaserver
[worker] [mediaworker]
mymediaworker mymediaworker
[vault] [mediavault]
mymediavault mymediavault
``` ```
......
...@@ -11,37 +11,37 @@ make deploy i=inventories/my-customer ...@@ -11,37 +11,37 @@ make deploy i=inventories/my-customer
### MediaWorker ### MediaWorker
```sh ```sh
make deploy i=inventories/my-customer l=worker make deploy i=inventories/my-customer l=mediaworker
``` ```
### Monitor ### Monitor
```sh ```sh
make deploy i=inventories/my-customer l=monitor make deploy i=inventories/my-customer l=msmonitor
``` ```
### MirisManager ### MirisManager
```sh ```sh
make deploy i=inventories/my-customer l=manager make deploy i=inventories/my-customer l=mirismanager
``` ```
### MediaServer ### MediaServer
```sh ```sh
make deploy i=inventories/my-customer l=server make deploy i=inventories/my-customer l=mediaserver
``` ```
### MediaImport ### MediaImport
```sh ```sh
make deploy i=inventories/my-customer l=import make deploy i=inventories/my-customer l=mediaimport
``` ```
### MediaVault ### MediaVault
```sh ```sh
make deploy i=inventories/my-customer l=vault make deploy i=inventories/my-customer l=mediavault
``` ```
### Celerity ### Celerity
...@@ -73,9 +73,9 @@ make deploy i=inventories/my-customer l=netcapture ...@@ -73,9 +73,9 @@ make deploy i=inventories/my-customer l=netcapture
Instead of deploying all host remotely through SSH, you can also clone the envsetup repository on the server as `root` in `~/envsetup`, then enter in the directory, configure the activation or system key and run one of those commands: Instead of deploying all host remotely through SSH, you can also clone the envsetup repository on the server as `root` in `~/envsetup`, then enter in the directory, configure the activation or system key and run one of those commands:
```sh ```sh
make deploy i=inventories/local-server make deploy i=inventories/local-mediaserver
make deploy i=inventories/local-worker make deploy i=inventories/local-mediaworker
make deploy i=inventories/local-vault make deploy i=inventories/local-mediavault
``` ```
## Known issues ## Known issues
......
...@@ -28,13 +28,13 @@ Then you need the groups that will be applied to the machine, for example for a ...@@ -28,13 +28,13 @@ Then you need the groups that will be applied to the machine, for example for a
"type": "ansible", "type": "ansible",
[...] [...]
"groups": [ "groups": [
"monitor", "msmonitor",
"postgres", "postgres",
"manager", "mirismanager",
"wowza", "wowza",
"celerity", "celerity",
"server", "mediaserver",
"import" "mediaimport"
] ]
} }
] ]
...@@ -52,7 +52,7 @@ For a worker: ...@@ -52,7 +52,7 @@ For a worker:
"type": "ansible", "type": "ansible",
[...] [...]
"groups": [ "groups": [
"worker" "mediaworker"
] ]
} }
] ]
......
...@@ -8,16 +8,16 @@ mymediaworker ansible_host=10.0.0.2 ...@@ -8,16 +8,16 @@ mymediaworker ansible_host=10.0.0.2
; groups list and their members ; groups list and their members
[monitor] [msmonitor]
mymediaserver mymediaserver
[postgres] [postgres]
mymediaserver mymediaserver
[manager] [mirismanager]
mymediaserver mymediaserver
[server] [mediaserver]
mymediaserver mymediaserver
[wowza] [wowza]
...@@ -26,13 +26,13 @@ mymediaserver ...@@ -26,13 +26,13 @@ mymediaserver
[celerity] [celerity]
mymediaserver mymediaserver
[worker] [mediaworker]
mymediaworker mymediaworker
[import] [mediaimport]
mymediaserver mymediaserver
[vault] [mediavault]
[netcapture] [netcapture]
......
localhost ansible_connection=local localhost ansible_connection=local
[monitor] [msmonitor]
localhost localhost
[postgres] [postgres]
localhost localhost
[manager] [mirismanager]
localhost localhost
[server] [mediaserver]
localhost localhost
[wowza] [wowza]
...@@ -18,8 +18,10 @@ localhost ...@@ -18,8 +18,10 @@ localhost
[celerity] [celerity]
localhost localhost
[worker] [mediaworker]
localhost localhost
[import] [mediaimport]
localhost localhost
; vim:ft=dosini
localhost ansible_connection=local localhost ansible_connection=local
[monitor] [msmonitor]
localhost localhost
[postgres] [postgres]
localhost localhost
[manager] [mirismanager]
localhost localhost
[server] [mediaserver]
localhost localhost
[wowza] [wowza]
...@@ -18,5 +18,7 @@ localhost ...@@ -18,5 +18,7 @@ localhost
[celerity] [celerity]
localhost localhost
[import] [mediaimport]
localhost localhost
; vim:ft=dosini
localhost ansible_connection=local localhost ansible_connection=local
[vault] [mediavault]
localhost localhost
; vim:ft=dosini
localhost ansible_connection=local localhost ansible_connection=local
[worker] [mediaworker]
localhost localhost
; vim:ft=dosini
#!/usr/bin/env ansible-playbook
---
- name: PYTHON
hosts: all
gather_facts: false
tasks:
- name: ensure python3 is installed
register: python_install
changed_when: "'es_pyinstall' in python_install.stdout_lines"
raw: command -v python3 || echo es_pyinstall && apt update && apt install -y python3-minimal python3-apt
- name: Converge
hosts: all
pre_tasks:
- name: check running in a docker container
register: check_if_docker
stat:
path: /.dockerenv
- name: set docker flag variable
set_fact:
in_docker: "{{ check_if_docker.stat.exists | d(false) }}"
roles:
- base
- postgres
- msmonitor
- mirismanager
- wowza
- celerity
- mediaworker
- mediaserver
- mediaimport
- mediavault
- netcapture
post_tasks:
- name: deploy letsencrypt certificate
when: letsencrypt_enabled | d(false)
include_role:
name: letsencrypt
- name: configure network
when: network_apply | d(false)
include_role:
name: network
- name: configure proxy
when: proxy_apply | d(false)
include_role:
name: proxy
...
--- ---
dependency:
name: galaxy
driver: driver:
name: docker name: docker
lint:
name: yamllint
platforms: platforms:
- name: debian-buster-${CI_PIPELINE_ID:-default} - name: debian-buster-${CI_PIPELINE_ID:-default}
image: registry.ubicast.net/docker/debian-systemd:buster image: registry.ubicast.net/docker/debian-systemd:buster
...@@ -16,15 +12,15 @@ platforms: ...@@ -16,15 +12,15 @@ platforms:
tmpfs: tmpfs:
- /tmp - /tmp
- /run - /run
- /run/lock
groups: groups:
- celerity - celerity
- manager - mirismanager
- monitor - msmonitor
- wowza
- postgres - postgres
- server - mediaserver
- worker - mediaworker
- import - mediaimport
- netcapture - netcapture
provisioner: provisioner:
name: ansible name: ansible
...@@ -33,22 +29,5 @@ provisioner: ...@@ -33,22 +29,5 @@ provisioner:
ANSIBLE_LIBRARY: ../../library ANSIBLE_LIBRARY: ../../library
ANSIBLE_ACTION_PLUGINS: ../../plugins/action ANSIBLE_ACTION_PLUGINS: ../../plugins/action
ANSIBLE_PYTHON_INTERPRETER: /usr/bin/python3 ANSIBLE_PYTHON_INTERPRETER: /usr/bin/python3
lint:
name: ansible-lint
env:
ANSIBLE_ROLES_PATH: ../../roles
ANSIBLE_LIBRARY: ../../library
ANSIBLE_ACTION_PLUGINS: ../../plugins/action
ANSIBLE_PYTHON_INTERPRETER: /usr/bin/python3
inventory:
group_vars:
all:
ansible_python_interpreter: /usr/bin/python3
playbooks:
converge: ../../site.yml
verifier: verifier:
name: testinfra name: testinfra
lint:
name: flake8
options:
max-line-length: 90
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment