2018-09-10 11:33:08 +02:00
|
|
|
---
|
|
|
|
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
|
|
|
|
#
|
|
|
|
# tasks file for fusioninventory
|
|
|
|
|
2018-09-10 13:59:45 +02:00
|
|
|
# Manage dependent packages [[[1
|
2018-09-13 10:02:07 +02:00
|
|
|
- name: Ensure dependent packages are installed
|
2018-09-10 13:59:45 +02:00
|
|
|
package:
|
|
|
|
name: '{{ item }}'
|
2018-09-13 10:02:07 +02:00
|
|
|
state: 'present'
|
2018-09-10 13:59:45 +02:00
|
|
|
with_flattened:
|
2018-09-17 11:27:26 +02:00
|
|
|
- '{{ fusioninventory__agent_depend_packages | to_nice_json }}'
|
2019-02-27 14:07:23 +01:00
|
|
|
register: pkg_dep_result
|
|
|
|
until: pkg_dep_result is success
|
2018-09-13 10:02:07 +02:00
|
|
|
when: fusioninventory__agent_deploy_state == "present"
|
2018-09-10 13:59:45 +02:00
|
|
|
|
2018-09-10 11:33:08 +02:00
|
|
|
# Manage agent package [[[1
|
2018-09-10 14:55:42 +02:00
|
|
|
- name: Ensure fusioninventory-agent package from URL
|
2018-09-10 11:33:08 +02:00
|
|
|
apt:
|
2018-09-17 17:53:49 +02:00
|
|
|
deb: '{{ fusioninventory__agent_package_url }}'
|
2019-02-27 14:07:23 +01:00
|
|
|
register: pkg_agent_url_result
|
|
|
|
until: pkg_agent_url_result is success
|
2018-09-10 11:33:08 +02:00
|
|
|
when: fusioninventory__agent_package_url != ""
|
2018-09-13 10:21:44 +02:00
|
|
|
and fusioninventory__agent_deploy_state == "present"
|
2018-09-10 11:33:08 +02:00
|
|
|
|
2018-09-10 14:55:42 +02:00
|
|
|
- name: Ensure fusioninventory-agent package from REPOS
|
2018-09-10 11:33:08 +02:00
|
|
|
package:
|
|
|
|
name: 'fusioninventory-agent'
|
2018-09-13 10:21:44 +02:00
|
|
|
state: '{{ "present" if (fusioninventory__agent_deploy_state == "present")
|
|
|
|
else "absent" }}'
|
2019-02-27 14:07:23 +01:00
|
|
|
register: pkg_agent_repo_result
|
|
|
|
until: pkg_agent_repo_result is success
|
2018-09-10 11:33:08 +02:00
|
|
|
when: fusioninventory__agent_package_url == ""
|
2018-09-13 10:21:44 +02:00
|
|
|
or fusioninventory__agent_deploy_state == "absent"
|
2018-09-10 11:33:08 +02:00
|
|
|
|
2018-09-10 14:02:41 +02:00
|
|
|
# Manage agent configuration file [[[1
|
|
|
|
- name: Create Fusioninventory-agent configuration
|
|
|
|
template:
|
|
|
|
src: '{{ fusioninventory__agent_conf_src }}'
|
|
|
|
dest: "/etc/fusioninventory/agent.cfg"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: '0644'
|
|
|
|
when: fusioninventory__agent_deploy_state == "present"
|
2018-09-10 14:55:42 +02:00
|
|
|
notify: ['restart fusioninventory-agent service']
|