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

49 lines
1.2 KiB
YAML

---
# Managing epoptes on 'client' role
- name: Getting epoptes server name
get_url:
url: "http://{{ ansible_local.domain.serverfqdn }}:3000/epoptes-srv"
dest: /tmp/epoptes-srv
register: get_epo_srv_name
- name: Checking for a correct name
shell: cat /tmp/epoptes-srv
register: epo_srv_name
when: get_epo_srv_name is changed
changed_when: "'none' not in epo_srv_name.stdout"
- name: Cleanup
file:
path: /tmp/epoptes-srv
state: absent
when: get_epo_srv_name is changed
- name: Ensuring epoptes-client is installed
apt:
name: epoptes-client
state: present
when: get_epo_srv_name is changed
- name: Configuring the client
replace:
dest: /etc/default/epoptes-client
regexp: "^#SERVER=server"
replace: "SERVER={{ epo_srv_name.stdout }}"
when: epo_srv_name is changed
- name: Checking for an already existent certificate
file:
path: /etc/epoptes/server.crt
state: file
register: crt_epo_exists
ignore_errors: yes
- name: Getting the epoptes server certificate
shell: /usr/sbin/epoptes-client -c
when: crt_epo_exists is failed
# I don't notify anymore, hoping that this would be done on first run after
# preseed and it should restart because of domain join.
#notify:
# - reboot