Restart agent's service if needed.
This commit is contained in:
		
							parent
							
								
									d542926e9a
								
							
						
					
					
						commit
						7d75c9720c
					
				|  | @ -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. | ||||||
|  |  | ||||||
|  | @ -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 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -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 }}' | ||||||
|  | @ -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'] | ||||||
|  |  | ||||||
		Reference in New Issue