46 lines
1.5 KiB
YAML
46 lines
1.5 KiB
YAML
---
|
|
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
|
|
#
|
|
# tasks file for fusioninventory
|
|
|
|
# Manage dependent packages [[[1
|
|
- name: Ensure dependent packages are installed
|
|
package:
|
|
name: '{{ item }}'
|
|
state: 'present'
|
|
with_flattened:
|
|
- '{{ fusioninventory__agent_depend_packages | to_nice_json }}'
|
|
register: pkg_dep_result
|
|
until: pkg_dep_result is success
|
|
when: fusioninventory__agent_deploy_state == "present"
|
|
|
|
# Manage agent package [[[1
|
|
- name: Ensure fusioninventory-agent package from URL
|
|
apt:
|
|
deb: '{{ fusioninventory__agent_package_url }}'
|
|
register: pkg_agent_url_result
|
|
until: pkg_agent_url_result is success
|
|
when: ((fusioninventory__agent_package_url) and
|
|
(fusioninventory__agent_deploy_state == "present"))
|
|
|
|
- name: Ensure fusioninventory-agent package from REPOS
|
|
package:
|
|
name: 'fusioninventory-agent'
|
|
state: '{{ "present" if (fusioninventory__agent_deploy_state == "present")
|
|
else "absent" }}'
|
|
register: pkg_agent_repo_result
|
|
until: pkg_agent_repo_result is success
|
|
when: ((not fusioninventory__agent_package_url) or
|
|
(fusioninventory__agent_deploy_state == "absent"))
|
|
|
|
# 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"
|
|
notify: ['restart fusioninventory-agent service']
|