2
0
Fork 0

Restart agent's service if needed.

This commit is contained in:
Jeremy Gardais 2018-09-10 14:55:42 +02:00
parent d542926e9a
commit 7d75c9720c
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
4 changed files with 12 additions and 2 deletions

View File

@ -5,3 +5,4 @@
* Install dependent packages for fusioninventory-agent. * Install dependent packages for fusioninventory-agent.
* Install fusioninventory-agent package from URL. * Install fusioninventory-agent package from URL.
* Generate agent's configuration file. * Generate agent's configuration file.
* Restart agent's service if needed.

View File

@ -49,6 +49,7 @@ This role will:
* Install needed dependent packages of fusioninventory-agent. * Install needed dependent packages of fusioninventory-agent.
* Install fusioninventory-agent package from official project package/URL. * Install fusioninventory-agent package from official project package/URL.
* Generate agent's configuration file. * Generate agent's configuration file.
* Manage agent's systemd service.
## Development ## Development

7
handlers/main.yml Normal file
View File

@ -0,0 +1,7 @@
---
# handlers file for fusioninventory-agent
- name: restart fusioninventory-agent service
service:
name: '{{ fusioninventory__agent_service_name }}'
state: "restarted"
enabled: '{{ fusioninventory__agent_service_manage | bool }}'

View File

@ -12,13 +12,13 @@
- '{{ fusioninventory__agent_depend_packages }}' - '{{ fusioninventory__agent_depend_packages }}'
# Manage agent package [[[1 # Manage agent package [[[1
- name: Ensure fusioninventory agent package from URL - name: Ensure fusioninventory-agent package from URL
apt: apt:
deb: '{{ fusioninventory__agent_package_url | d(omit) }}' deb: '{{ fusioninventory__agent_package_url | d(omit) }}'
state: '{{ "present" if (fusioninventory__agent_deploy_state == "present") else "absent" }}' state: '{{ "present" if (fusioninventory__agent_deploy_state == "present") else "absent" }}'
when: fusioninventory__agent_package_url != "" when: fusioninventory__agent_package_url != ""
- name: Ensure fusioninventory agent package from REPOS - name: Ensure fusioninventory-agent package from REPOS
package: package:
name: 'fusioninventory-agent' name: 'fusioninventory-agent'
state: '{{ "present" if (fusioninventory__agent_deploy_state == "present") else "absent" }}' state: '{{ "present" if (fusioninventory__agent_deploy_state == "present") else "absent" }}'
@ -33,3 +33,4 @@
group: root group: root
mode: '0644' mode: '0644'
when: fusioninventory__agent_deploy_state == "present" when: fusioninventory__agent_deploy_state == "present"
notify: ['restart fusioninventory-agent service']