Rewritten epoptes client management.
This commit is contained in:
parent
d7589283fb
commit
b9eae6b189
@ -1,48 +1,26 @@
|
|||||||
---
|
---
|
||||||
# Managing epoptes on 'client' role
|
# 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
|
- name: Ensuring epoptes-client is installed
|
||||||
apt:
|
apt:
|
||||||
name: epoptes-client
|
name: epoptes-client
|
||||||
state: present
|
state: present
|
||||||
when: get_epo_srv_name is changed
|
|
||||||
|
|
||||||
- name: Configuring the client
|
- name: Getting epoptes server name
|
||||||
replace:
|
shell: "curl http://{{ ansible_local.domain.serverfqdn }}:3000/epoptes-srv"
|
||||||
dest: /etc/default/epoptes-client
|
register: epoptes_srv
|
||||||
regexp: "^#SERVER=server"
|
|
||||||
replace: "SERVER={{ epo_srv_name.stdout }}"
|
|
||||||
when: epo_srv_name is changed
|
|
||||||
|
|
||||||
- name: Checking for an already existent certificate
|
- name: Assure epoptes has the correct server
|
||||||
file:
|
lineinfile:
|
||||||
path: /etc/epoptes/server.crt
|
path: /etc/default/epoptes-client
|
||||||
state: file
|
regexp: '^SERVER='
|
||||||
register: crt_epo_exists
|
line: "SERVER={{ epoptes_srv.stdout }}"
|
||||||
ignore_errors: yes
|
insertafter: '^#SERVER'
|
||||||
|
state: present
|
||||||
|
register: changed_srv
|
||||||
|
|
||||||
- name: Getting the epoptes server certificate
|
- name: Getting the certificate in case it was changed
|
||||||
shell: /usr/sbin/epoptes-client -c
|
shell: /usr/sbin/epoptes-client -c
|
||||||
when: crt_epo_exists is failed
|
when: changed_srv is changed
|
||||||
# I don't notify anymore, hoping that this would be done on first run after
|
notify:
|
||||||
# preseed and it should restart because of domain join.
|
- reboot
|
||||||
#notify:
|
|
||||||
# - reboot
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user