client-pull-installation/roles/domain/tasks/epoptes.yml

52 lines
1.3 KiB
YAML

---
- name: "Configuro il pc docente come Epoptes Server"
replace:
regexp: "^#SOCKET_GROUP=epoptes$"
replace: 'SOCKET_GROUP="{{ domainshort }}\docenti"'
dest: /etc/default/epoptes
sudo: yes
when: role == 'docenti'
- name: Trovo il nome dell'epoptes server
get_url:
url: "http://{{ serverfqdn }}:3000/epoptes-srv"
dest: /tmp/epoptes-srv
when: role == 'client'
register: get_epo_srv_name
- name: Verifico il nome, altrimenti salto
shell: cat /tmp/epoptes-srv
register: epo_srv_name
when: role == 'client' and get_epo_srv_name|changed
changed_when: "'none' not in epo_srv_name.stdout"
- name: Configuro il client per Epoptes
replace:
regexp: "^#SERVER=server"
replace: "SERVER={{ epo_srv_name.stdout }}"
dest: /etc/default/epoptes-client
when: role == 'client' and epo_srv_name|changed
sudo: yes
- name: Verifica certificato
file:
path: /etc/epoptes/server.crt
status: file
when: role == 'client' and epo_srv_name|changed
register: crt_epo_exists
ignore_errors: yes
- name: Prendo il certificato
shell: /usr/sbin/epoptes-client -c
sudo: yes
when: role == 'client' and crt_epo_exists|failed
notify:
- reboot
- name: Pulisco
file:
path: /tmp/epoptes-srv
state: absent
sudo: yes
when: get_epo_srv_name|changed