Client timbrature installato come stack docker
This commit is contained in:
parent
eaf601cbe7
commit
77081054ad
74
README.md
74
README.md
|
@ -1,31 +1,69 @@
|
|||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
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.
|
||||
A role that installs ePAS, electronic Personnel Attendance System. <https://epas.projects.iit.cnr.it>
|
||||
|
||||
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.
|
||||
The most important variables are listed below:
|
||||
|
||||
``` yaml
|
||||
epas_docker_stack_name: 'epas_prod'
|
||||
epas_docker_service_server_name: 'epas'
|
||||
epas_docker_registry: 'docker-registry.services.iit.cnr.it'
|
||||
epas_docker_server_image: '{{ epas_docker_registry }}/epas/epas:stable'
|
||||
epas_docker_registry_user: 'epas.user'
|
||||
epas_docker_registry_pwd: 'use a vault file'
|
||||
epas_docker_network: 'epas_net'
|
||||
epas_attachments_node: 'localhost'
|
||||
epas_attachments_volume: 'epas_attachments_data'
|
||||
epas_node_constraints: 'node.labels.epas_storage == attachments'
|
||||
epas_behind_haproxy: True
|
||||
epas_haproxy_public_net: 'haproxy-public'
|
||||
# DB
|
||||
# Set to true if postgresql must be a container too
|
||||
epas_dockerized_db: False
|
||||
# IMPORTANT. Set it to True for the server that is going to host the DB
|
||||
epas_docker_db_node: False
|
||||
epas_pg_version: '12'
|
||||
epas_db_image: 'postgres:{{ epas_pg_version }}-alpine'
|
||||
# The default hostname is the name of the container service
|
||||
epas_db_host: 'postgres'
|
||||
epas_db_name: 'epas_prod_db'
|
||||
epas_db_allowed_hosts:
|
||||
- '127.0.0.1'
|
||||
#epas_db_pwd: 'set it in a vault file'
|
||||
epas_db_user: 'epas_prod_user'
|
||||
epas_db_volume: 'epas_prod_pg_data'
|
||||
epas_db_constraints: '[node.labels.pg_data==epas_db]'
|
||||
epas_pg_data_volume: 'epas_db_data'
|
||||
epas_pg_backups_volume: 'epas_db_data'
|
||||
psql_db_data: '{{ epas_psql_pg_data }}'
|
||||
# Environment
|
||||
epas_server_hostname: 'epas.example.com'
|
||||
## SMTP
|
||||
epas_smtp_server: 'localhost'
|
||||
epas_smtp_port: 587
|
||||
epas_smtp_channel: 'starttls'
|
||||
epas_smtp_from: 'epas@cnr.it'
|
||||
epas_smtp_protocol: 'smtp'
|
||||
epas_smtp_authentication: True
|
||||
epas_smtp_user: ''
|
||||
epas_smtp_password: 'use a vault file'
|
||||
## LDAP
|
||||
epas_ldap_login: 'false'
|
||||
epas_ldap_url: 'ldap://ldap.example.org:389'
|
||||
epas_ldap_timeout: 1000
|
||||
epas_ldap_base_dn: 'ou=People,dc=example,dc=org'
|
||||
epas_ldap_login_return_uri: '/.'
|
||||
epas_ldap_eppn_attribute_name: 'eduPersonPrincipalName'
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
A docker swarm cluster is required
|
||||
|
||||
License
|
||||
-------
|
||||
|
@ -35,4 +73,4 @@ EUPL-1.2
|
|||
Author Information
|
||||
------------------
|
||||
|
||||
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
||||
Andrea Dell'Amico, <andrea.dellamico@isti.cnr.it>
|
||||
|
|
|
@ -1,2 +1,25 @@
|
|||
---
|
||||
# defaults file for ansible-role-template
|
||||
epas_client_timbrature_stack_name: 'epas_c_timbrature'
|
||||
epas_client_timbrature_service_name: 'epas_timbrature'
|
||||
epas_client_timbrature_docker_registry: 'docker-registry.services.iit.cnr.it'
|
||||
epas_client_timbrature_docker_registry_user: 'epas.user'
|
||||
epas_client_timbrature_docker_registry_pwd: 'use a vault file'
|
||||
epas_client_timbrature_docker_client_timbrature_image: '{{ epas_client_timbrature_docker_registry }}/epas/area-pisa-client:stable'
|
||||
epas_client_timbrature_docker_client_timbrature_data_node: 'localhost'
|
||||
epas_client_timbrature_data_volume: 'epas_dati_timbrature'
|
||||
epas_client_timbrature_node_constraints: 'node.labels.epas_client == timbrature'
|
||||
epas_client_timbrature_behind_haproxy: False
|
||||
epas_client_timbrature_haproxy_public_net: 'haproxy-public'
|
||||
epas_client_timbrature_compose_dir: '/srv/epas_client_timbrature'
|
||||
|
||||
epas_client_timbrature_ftp_server_name: '127.0.0.1'
|
||||
epas_client_timbrature_ftp_username: 'anonymous'
|
||||
#epas_client_timbrature_ftp_pwd: 'use a vault file'
|
||||
epas_client_timbrature_ftp_server_dir: 'AT'
|
||||
epas_client_timbrature_ftp_file_prefix: 'x'
|
||||
epas_client_timbrature_epas_server_name: 'epas.example.com'
|
||||
epas_client_timbrature_epas_server_protocol: 'https'
|
||||
epas_client_timbrature_epas_server_port: 443
|
||||
epas_client_timbrature_user: 'user'
|
||||
#epas_client_timbrature_password: 'use a vault file'
|
||||
epas_client_timbrature_loglevel: 'INFO'
|
||||
|
|
|
@ -1,61 +1,26 @@
|
|||
galaxy_info:
|
||||
author: your name
|
||||
description: your description
|
||||
author: Andrea Dell'Amico
|
||||
description: Systems Architect
|
||||
company: ISTI-CNR
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
issue_tracker_url: https://redmine-s2i2s.isti.cnr.it/projects/provisioning
|
||||
issue_tracker_url: https://support.d4science.org/projects/d4science-operation
|
||||
|
||||
# Some suggested licenses:
|
||||
# - BSD (default)
|
||||
# - MIT
|
||||
# - GPLv2
|
||||
# - GPLv3
|
||||
# - Apache
|
||||
# - CC-BY
|
||||
license: EUPL-1.2
|
||||
license: EUPL 1.2+
|
||||
|
||||
min_ansible_version: 2.8
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||
# repo for this role. During role install, if no tags are available,
|
||||
# Galaxy will use this branch. During import Galaxy will access files on
|
||||
# this branch. If Travis integration is configured, only notifications for this
|
||||
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||
# (usually master) will be used.
|
||||
#github_branch:
|
||||
|
||||
#
|
||||
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
#
|
||||
# platforms:
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
platforms:
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- bionic
|
||||
- name: EL
|
||||
versions:
|
||||
- 7
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
galaxy_tags:
|
||||
- epas
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
|
||||
|
|
|
@ -1,2 +1,29 @@
|
|||
---
|
||||
# tasks file for ansible-role-template
|
||||
- name: Manage the installation of the ePAS client configuration of the swarm service
|
||||
block:
|
||||
- name: Add the label that will be used as a constraint for the data volume
|
||||
docker_node:
|
||||
hostname: '{{ epas_client_timbrature_docker_client_timbrature_data_node }}'
|
||||
labels:
|
||||
epas_client: 'timbrature'
|
||||
labels_state: 'merge'
|
||||
|
||||
- name: Create the directory where the compose file will be placed
|
||||
file: dest={{ epas_client_timbrature_compose_dir }} state=directory owner=root group=root mode=0750
|
||||
|
||||
- name: Install the docker compose file
|
||||
template: src=epas-client-timbrature-docker-compose.yml.j2 dest={{ epas_client_timbrature_compose_dir }}/docker-epas-client-timbrature-stack.yml owner=root group=root mode='0400'
|
||||
|
||||
- name: Login into the IIT registry
|
||||
shell: docker login -u {{ epas_client_timbrature_docker_registry_user }} -p {{ epas_client_timbrature_docker_registry_pwd }} {{ epas_client_timbrature_docker_registry }}
|
||||
|
||||
- name: Start the ePAS stack
|
||||
docker_stack:
|
||||
name: '{{ epas_client_timbrature_stack_name }}'
|
||||
state: present
|
||||
with_registry_auth: True
|
||||
compose:
|
||||
- '{{ epas_client_timbrature_compose_dir }}/docker-epas-client-timbrature-stack.yml'
|
||||
|
||||
when: docker_swarm_manager_node is defined and docker_swarm_manager_node
|
||||
tags: [ 'epas', 'epas_client', 'epas_client_timbrature' ]
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
version: '3.2'
|
||||
|
||||
{% if epas_client_timbrature_behind_haproxy %}
|
||||
networks:
|
||||
{{ epas_client_timbrature_haproxy_public_net }}:
|
||||
external: true
|
||||
{% endif %}
|
||||
|
||||
volumes:
|
||||
{{ epas_attachments_volume }}:
|
||||
{% if epas_dockerized_db %}
|
||||
{{ epas_pg_backups_volume }}:
|
||||
{{ epas_db_volume }}:
|
||||
{% endif %}
|
||||
|
||||
services:
|
||||
{{ epas_client_timbrature_docker_service_server_name }}:
|
||||
image: {{ epas_client_timbrature_docker_server_image }}
|
||||
{% if epas_client_timbrature_behind_haproxy %}
|
||||
networks:
|
||||
- {{ epas_client_timbrature_haproxy_public_net }}
|
||||
{% endif %}
|
||||
volumes:
|
||||
- {{ epas_client_timbrature_data_volume }}:/client/data
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
environment:
|
||||
- FTP_SERVER_NAME={{ epas_client_timbrature_ftp_server_name }} # Obbligatorio
|
||||
- FTP_USERNAME={{ epas_client_timbrature_ftp_username }} # Obbligatorio
|
||||
- FTP_PASSWORD={{ epas_client_timbrature_ftp_pwd }} # Obbligatorio
|
||||
- FTP_SERVER_DIR={{ epas_client_timbrature_ftp_server_dir }} # Opzionale. default: AT
|
||||
- FTP_FILE_PREFIX={{ epas_client_timbrature_ftp_file_prefix }} # Opzionale. default: AT
|
||||
- SERVER_HOST={{ epas_client_timbrature_epas_server_name }} # default: link al container con alias epas (docker-compose v2)
|
||||
- SERVER_PROTOCOL={{ epas_client_timbrature_epas_server_protocol }} # default: http. (http, https)
|
||||
- SERVER_PORT={{ epas_client_timbrature_epas_server_port }} # default: 9000
|
||||
- EPAS_CLIENT_USER={{ epas_client_timbrature_user }} # utente configurato in epas dentro sorgenti timbrature
|
||||
- EPAS_CLIENT_PASSWORD={{ epas_client_timbrature_password }}
|
||||
- LOG_LEVEL={{ epas_client_timbrature_loglevel }} # Default: INFO
|
||||
#- CRON=*/30 7-22 * * * # Default: ogni mezz'ora tra le 7 e le 22. utilizzare il formato richiesto dal crontab. Riferimenti -> https://en.wikipedia.org/wiki/Cron#Examples
|
||||
deploy:
|
||||
mode: replicated
|
||||
replicas: 1
|
||||
{% if epas_client_timbrature_behind_haproxy %}
|
||||
endpoint_mode: dnsrr
|
||||
{% endif %}
|
||||
placement:
|
||||
constraints:
|
||||
- node.role == worker
|
||||
- {{ epas_client_timbrature_node_constraints }}
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
delay: 5s
|
||||
max_attempts: 3
|
||||
window: 120s
|
||||
logging:
|
||||
driver: 'journald'
|
Loading…
Reference in New Issue