2
0
Fork 0

Merge branch 'Yoda-BZH-service-status-management'

This commit is contained in:
Jeremy Gardais 2023-08-07 14:21:33 +02:00
commit c500fbc6d9
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
4 changed files with 23 additions and 0 deletions

View File

@ -2,6 +2,7 @@
### Enhancement ### Enhancement
* Upgrade package version from URL from 2.4 to 2.6 (thanks to @roumano - issue #15). * Upgrade package version from URL from 2.4 to 2.6 (thanks to @roumano - issue #15).
* Allow service to be managed, (thanks to @yodabzh - issue #17).
### Fix ### Fix
* Switch to Github URL to download deb file (thanks to @roumano - PR #16). * Switch to Github URL to download deb file (thanks to @roumano - PR #16).

View File

@ -24,6 +24,8 @@ A role to manage FusionInventory agent installation and configuration.
* **fusioninventory__agent_service_name**: The service name to manage [default: `fusioninventory-agent`]. * **fusioninventory__agent_service_name**: The service name to manage [default: `fusioninventory-agent`].
* **fusioninventory__agent_service_manage**: If the fusioninventory agent service should be managed [default: `true`]. * **fusioninventory__agent_service_manage**: If the fusioninventory agent service should be managed [default: `true`].
* **fusioninventory__agent_conf_src**: Template used to provide agent configuration file [default: `../templates/etc/fusioninventory/agent.cfg.j2`]. * **fusioninventory__agent_conf_src**: Template used to provide agent configuration file [default: `../templates/etc/fusioninventory/agent.cfg.j2`].
* **fusioninventory__agent_service_status**: Service state, can be started, stopped, restarted, reloaded [default : `started`].
* **fusioninventory__agent_service_enabled**: Service status, can be enabled (`true`) or disabled (`false`) [default: `true`].
### Config Specific Variables ### Config Specific Variables

View File

@ -44,6 +44,19 @@ fusioninventory__agent_deploy_state: 'present'
# The service name to manage. # The service name to manage.
# #
fusioninventory__agent_service_name: 'fusioninventory-agent' fusioninventory__agent_service_name: 'fusioninventory-agent'
# ]]]
# .. envvar:: fusioninventory__agent_service_status [[[
#
# The targeted service status.
#
fusioninventory__agent_service_status: 'started'
# ]]]
# .. envvar:: fusioninventory__agent_service_enabled [[[
#
# The targeted service status.
#
fusioninventory__agent_service_enabled: true
# ]]] # ]]]
# .. envvar:: fusioninventory__agent_service_manage [[[ # .. envvar:: fusioninventory__agent_service_manage [[[

View File

@ -56,3 +56,10 @@
mode: '0644' mode: '0644'
when: fusioninventory__agent_deploy_state == "present" when: fusioninventory__agent_deploy_state == "present"
notify: ['restart fusioninventory-agent service'] notify: ['restart fusioninventory-agent service']
- name: Ensure the service is in the correct state
service:
name: "{{ fusioninventory__agent_service_name }}"
state: "{{ fusioninventory__agent_service_status }}"
enabled: "{{ fusioninventory__agent_service_enabled }}"
when: fusioninventory__agent_deploy_state == "present"