Compare commits

...

24 Commits

Author SHA1 Message Date
Andrea Dell'Amico 48d7ecb348
Racchiusa tra doppi apici tutta la variabile del mapping. 2024-05-30 17:09:05 +02:00
Andrea Dell'Amico e95bb92fc7
Altri tentativi di aggiustare i parametri. 2024-05-30 15:02:28 +02:00
Andrea Dell'Amico bf9943994a
Nuovo tentativo di fix ai separatori nel template. 2024-05-30 14:32:27 +02:00
Andrea Dell'Amico 8318ecf7be
Nuovo tentativo di fix ai separatori. 2024-05-30 14:29:02 +02:00
Andrea Dell'Amico ffa5177bec
Nuovo tentativo di fix ai separatori. 2024-05-30 14:28:12 +02:00
Andrea Dell'Amico 9c573014c1
Nuovo tentativo di fix ai separatori. 2024-05-30 14:27:31 +02:00
Andrea Dell'Amico a528558a57
Nuovo tentativo di fix ai separatori. 2024-05-30 14:26:17 +02:00
Andrea Dell'Amico 883816a354
Nuovo tentativo di fix ai separatori. 2024-05-30 14:25:22 +02:00
Andrea Dell'Amico 0c52fcc5aa
Nuovo tentativo di fix ai separatori. 2024-05-30 14:23:12 +02:00
Andrea Dell'Amico 3d5462191a
Fix ai divisori dei campi del mapping. 2024-05-30 14:16:15 +02:00
Andrea Dell'Amico ba93602f5f Merge pull request 'Feature/3456' (!7) from Feature/3456 into master
Reviewed-on: ePAS-ISTI/ansible-role-epas-client-timbrature#7
2024-05-30 14:10:44 +02:00
Giancarlo Panichi 58e18ae12f Aggiorato per supportare la nuova gestione della pausa pranzo 2024-05-30 12:11:43 +02:00
Giancarlo Panichi 380fa30fe5 Aggiornato escape di caratteri. 2024-05-24 18:52:14 +02:00
Giancarlo Panichi 4bb4897e44 Aggiornato escape. 2024-05-24 17:32:45 +02:00
Giancarlo Panichi 1178672916 Aggiornato per supportare la nuova gestione della pausa pranzo. 2024-05-24 17:26:50 +02:00
Andrea Dell'Amico ed301fb05e
Do not create the label when the volume is remote. 2023-05-29 20:28:36 +02:00
Andrea Dell'Amico ca136f40b5
Do not add the label if the volume is remote 2023-05-29 20:21:27 +02:00
Andrea Dell'Amico 9d466e4abc
External volume 2023-05-29 20:16:57 +02:00
Andrea Dell'Amico 5b7753778d Merge pull request 'Only the 'latest' image exists' (#6) from adellam/ansible-role-epas-client-timbrature:master into master 2020-10-27 17:33:28 +01:00
Andrea Dell'Amico 819a8b69e1 Merge pull request 'Also fix the variable that sets the image name' (#5) from adellam/ansible-role-epas-client-timbrature:master into master 2020-10-27 17:11:53 +01:00
Andrea Dell'Amico fb624c54ca Merge pull request 'Change the variable that sets the server name.' (#4) from adellam/ansible-role-epas-client-timbrature:master into master 2020-10-27 17:08:10 +01:00
Andrea Dell'Amico 904f420092 Merge pull request 'Fix the volumes definition' (#3) from adellam/ansible-role-epas-client-timbrature:master into master 2020-10-27 17:06:04 +01:00
Andrea Dell'Amico 0458ae2177 Merge pull request 'Fix the README' (#2) from adellam/ansible-role-epas-client-timbrature:master into master 2020-10-27 16:28:57 +01:00
Andrea Dell'Amico 76e32ed1a1 Merge pull request 'Client timbrature installato come stack docker' (#1) from adellam/ansible-role-epas-client-timbrature:master into master 2020-10-27 16:27:25 +01:00
7 changed files with 72 additions and 28 deletions

11
.project Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ansible-role-epas-client-timbrature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"ansible.python.interpreterPath": "/opt/local/bin/python3.10"
}

View File

@ -11,10 +11,7 @@ The most important variables are listed below:
``` yaml
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_image: 'consiglionazionalericerche/epas-client:area-cnr-pisa'
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'
@ -22,6 +19,7 @@ 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_stampings_server_protocol: 'ftp'
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'
@ -33,6 +31,10 @@ 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'
epas_client_timbrature_fix_causale_pausa_pranzo: 'False'
epas_client_timbrature_causale_pausa_pranzo_min_hour: '12'
epas_client_timbrature_causale_pausa_pranzo_max_hour: '15'
epas_client_timbrature_send_all_stampings_everytime: 'True'
```
Dependencies

View File

@ -1,17 +1,25 @@
---
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:latest'
#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:latest'
epas_client_timbrature_docker_registry: ''
epas_client_timbrature_docker_registry_user: ''
epas_client_timbrature_docker_registry_pwd: ''
epas_client_timbrature_docker_client_timbrature_image: 'consiglionazionalericerche/epas-client:area-cnr-pisa'
epas_client_timbrature_docker_client_timbrature_data_node: 'localhost'
epas_client_timbrature_data_remote_volume: false
epas_client_timbrature_data_remote_volume_opts: "nfsvers=4,addr=127.0.0.1,rw"
epas_client_timbrature_data_remote_volume_dev: ":/mnt"
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_stampings_server_protocol: 'ftp'
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'
@ -23,3 +31,13 @@ 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'
epas_client_timbrature_regex_stamping: '^(?P<operazione>\\\d{2})(?P<lettore>\\\d{2})[!|\\\s](?P<causale>\\\d{4})\\\w(?P<matricolaFirma>[\\\w,\\\s,.]{17})(?P<anno>\\\d\\\d)(?P<mese>\\\d\\\d)(?P<giorno>\\\d\\\d)(?P<ora>\\\d\\\d)(?P<minuti>\\\d\\\d)$'
epas_client_timbrature_offset_anno_badge: '1980'
epas_client_timbrature_fix_causale_pausa_pranzo: 'False'
epas_client_timbrature_mapping_causali_client_server: "" # Default '{\'0000\': None, \'2345\': None,\'0001\':\'motiviDiServizio\'}'
epas_client_timbrature_causale_pausa_pranzo_min_hour: '12'
epas_client_timbrature_causale_pausa_pranzo_max_hour: '15'
epas_client_timbrature_send_all_stampings_everytime: 'True'

View File

@ -1,25 +1,11 @@
galaxy_info:
author: Andrea Dell'Amico
description: Systems Architect
namespace: adellam
role_name: epas_client_timbrature
description: Role that installs the EPAS client that collects data from the badge readers
company: ISTI-CNR
issue_tracker_url: https://support.d4science.org/projects/d4science-operation
license: EUPL 1.2+
min_ansible_version: 2.8
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
platforms:
- name: Ubuntu
versions:
- bionic
- name: EL
versions:
- 7
min_ansible_version: "2.9"
galaxy_tags:
- epas

View File

@ -7,6 +7,7 @@
labels:
epas_client: 'timbrature'
labels_state: 'merge'
when: not epas_client_timbrature_data_remote_volume
- 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
@ -14,8 +15,10 @@
- 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 }}
# If registry not is docker hub
#
#- 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:

View File

@ -8,6 +8,14 @@ networks:
volumes:
{{ epas_client_timbrature_data_volume }}:
{% if epas_client_timbrature_data_remote_volume %}
driver: local
driver_opts:
type: nfs4
o: "{{ epas_client_timbrature_data_remote_volume_opts }}"
device: "{{ epas_client_timbrature_data_remote_volume_dev }}"
{% endif %}
services:
{{ epas_client_timbrature_service_name }}:
@ -21,6 +29,7 @@ services:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
environment:
- STAMPINGS_SERVER_PROTOCOL={{ epas_client_timbrature_stampings_server_protocol }} # Protocollo per prelevare le timbrature. Possibili valori: smartclock, local, ftp, sftp
- 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
@ -32,6 +41,14 @@ services:
- 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
- REGEX_STAMPING={{ epas_client_timbrature_regex_stamping }}
- OFFSET_ANNO_BADGE={{ epas_client_timbrature_offset_anno_badge }}
- FIX_CAUSALE_PAUSA_PRANZO={{ epas_client_timbrature_fix_causale_pausa_pranzo}}
- "MAPPING_CAUSALI_CLIENT_SERVER={% raw %}{{% endraw %}{{ epas_client_timbrature_mapping_causali_client_server }}{% raw %}}{% endraw %}"
- CAUSALE_PAUSA_PRANZO_MIN_HOUR={{ epas_client_timbrature_causale_pausa_pranzo_min_hour }} # Default: 12
- CAUSALE_PAUSA_PRANZO_MAX_HOUR={{ epas_client_timbrature_causale_pausa_pranzo_max_hour }} # Default: 15
- SEND_ALL_STAMPINGS_EVERYTIME={{ epas_client_timbrature_send_all_stampings_everytime }}
#- 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
@ -42,7 +59,11 @@ services:
placement:
constraints:
- node.role == worker
{% if not epas_client_timbrature_data_remote_volume %}
- {{ epas_client_timbrature_node_constraints }}
{% endif %}
restart_policy:
condition: on-failure
delay: 5s