2018-11-23 15:19:21 +01:00
|
|
|
---
|
|
|
|
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
|
|
|
|
#
|
2019-04-24 14:20:04 +02:00
|
|
|
# tasks file for openmanage
|
2018-11-23 15:19:21 +01:00
|
|
|
|
|
|
|
# Manage repository [[[1
|
|
|
|
## Add repository
|
|
|
|
- name: Add OpenManage repository
|
|
|
|
apt_repository:
|
2021-09-01 11:52:45 +02:00
|
|
|
update_cache: false
|
2018-11-23 15:19:21 +01:00
|
|
|
repo: '{{ item.repo }}'
|
|
|
|
mode: '{{ item.mode | d(omit) }}'
|
|
|
|
filename: '{{ item.filename | d(omit) }}'
|
|
|
|
state: '{{ item.state | d("present") }}'
|
|
|
|
with_flattened:
|
|
|
|
- '{{ openmanage__repositories }}'
|
|
|
|
register: openmanage__register_repositories
|
2019-02-27 14:29:25 +01:00
|
|
|
until: openmanage__register_repositories is success
|
2018-11-23 15:19:21 +01:00
|
|
|
|
|
|
|
## Add repository key
|
2019-07-29 14:24:56 +02:00
|
|
|
### Don't remove the APT key, cause differents repos can have the same key
|
2018-11-23 15:19:21 +01:00
|
|
|
- name: Add OpenManage repo key
|
|
|
|
apt_key:
|
|
|
|
url: '{{ item.key_url | d(omit) }}'
|
|
|
|
id: '{{ item.key_id | d(omit) }}'
|
2019-04-10 14:23:21 +02:00
|
|
|
keyring: '/etc/apt/trusted.gpg.d/linux.dell.com.gpg'
|
2018-11-23 15:19:21 +01:00
|
|
|
keyserver: '{{ item.key_keyserver | d(omit) }}'
|
|
|
|
with_flattened:
|
|
|
|
- '{{ openmanage__repositories }}'
|
|
|
|
register: openmanage__register_key
|
2019-02-27 14:29:25 +01:00
|
|
|
until: openmanage__register_key is success
|
2019-07-29 14:24:56 +02:00
|
|
|
when: (openmanage__deploy_state == "present")
|
2018-11-23 15:19:21 +01:00
|
|
|
|
|
|
|
## Update cache
|
|
|
|
- name: Update APT cache
|
|
|
|
apt:
|
2021-09-01 11:52:45 +02:00
|
|
|
update_cache: '{{ true
|
2019-02-27 14:23:17 +01:00
|
|
|
if (openmanage__register_key is changed or
|
|
|
|
openmanage__register_repositories is changed)
|
|
|
|
else
|
2021-09-01 11:52:45 +02:00
|
|
|
false }}'
|
2019-02-27 14:34:12 +01:00
|
|
|
register: openmanage__register_update
|
|
|
|
until: openmanage__register_update is success
|
2019-02-27 14:23:17 +01:00
|
|
|
when: (openmanage__deploy_state == "present")
|
2018-11-26 11:48:59 +01:00
|
|
|
|
|
|
|
# Manage packages [[[1
|
2018-11-26 12:04:12 +01:00
|
|
|
## Manage depencies packages
|
|
|
|
- name: Ensure dependencies are present
|
|
|
|
package:
|
|
|
|
name: '{{ item }}'
|
|
|
|
state: "present"
|
|
|
|
install_recommends: '{{ openmanage__install_recommends | bool }}'
|
|
|
|
with_flattened:
|
|
|
|
- '{{ openmanage__dep_packages | to_nice_json }}'
|
2019-02-27 14:17:58 +01:00
|
|
|
register: pkg_dep_result
|
|
|
|
until: pkg_dep_result is success
|
2018-11-26 12:04:12 +01:00
|
|
|
when: (openmanage__deploy_state == "present")
|
|
|
|
|
2020-09-23 17:01:24 +02:00
|
|
|
## Manage Debian Stretch (or Ubuntu Xenial) specific packages
|
|
|
|
- name: "Ensure 910 specific packages (Stretch|Xenial) are in there desired state"
|
2020-09-23 15:36:06 +02:00
|
|
|
package:
|
|
|
|
name: '{{ item }}'
|
|
|
|
state: "present"
|
|
|
|
install_recommends: '{{ openmanage__install_recommends | bool }}'
|
|
|
|
with_flattened:
|
2020-09-23 17:01:24 +02:00
|
|
|
- '{{ openmanage__stretch_packages | to_nice_json }}'
|
|
|
|
register: pkg_stretch_result
|
|
|
|
until: pkg_stretch_result is success
|
2020-09-23 15:36:06 +02:00
|
|
|
when: (openmanage__deploy_state == "present" and
|
|
|
|
( (ansible_distribution == "Debian" and ansible_distribution_major_version is version("9", "<=")) or
|
2020-09-23 15:49:59 +02:00
|
|
|
(ansible_distribution == "Ubuntu" and ansible_distribution_version is version("16.04", "<="))))
|
2020-09-23 15:36:06 +02:00
|
|
|
|
2019-03-28 14:49:51 +01:00
|
|
|
## Manage base system packages
|
2018-11-26 11:48:59 +01:00
|
|
|
- name: Ensure base packages are in there desired state
|
|
|
|
package:
|
|
|
|
name: '{{ item }}'
|
|
|
|
state: '{{ "present" if (openmanage__deploy_state == "present") else "absent" }}'
|
|
|
|
install_recommends: '{{ openmanage__install_recommends | bool }}'
|
|
|
|
with_flattened:
|
|
|
|
- '{{ openmanage__base_packages | to_nice_json }}'
|
2019-02-27 14:17:58 +01:00
|
|
|
register: pkg_base_result
|
|
|
|
until: pkg_base_result is success
|
2018-11-26 11:53:23 +01:00
|
|
|
|
2019-04-01 16:53:32 +02:00
|
|
|
## Manage OMSA webgui packages
|
|
|
|
- name: Ensure OMSA-webgui packages are in there desired state
|
2019-03-28 14:49:51 +01:00
|
|
|
package:
|
|
|
|
name: '{{ item }}'
|
|
|
|
state: '{{ "present" if (openmanage__deploy_state == "present") and
|
|
|
|
(openmanage__webgui_state == "present")
|
|
|
|
else "absent" }}'
|
|
|
|
install_recommends: '{{ openmanage__install_recommends | bool }}'
|
|
|
|
with_flattened:
|
|
|
|
- '{{ openmanage__webgui_packages | to_nice_json }}'
|
|
|
|
register: pkg_webgui_result
|
|
|
|
until: pkg_webgui_result is success
|
2019-03-28 16:32:58 +01:00
|
|
|
notify: ['restart webgui service']
|
2019-03-28 14:49:51 +01:00
|
|
|
|
2020-09-17 16:17:05 +02:00
|
|
|
## Remove all OpenManage packages if requested
|
2020-09-21 17:03:38 +02:00
|
|
|
- name: Gather the Package facts
|
|
|
|
package_facts:
|
|
|
|
manager: auto
|
|
|
|
|
2020-09-17 16:17:05 +02:00
|
|
|
- name: Ensure to remove OpenManage related packages if requested
|
|
|
|
package:
|
|
|
|
name: 'srvadmin*'
|
|
|
|
state: "absent"
|
|
|
|
register: pkg_remove_result
|
|
|
|
until: pkg_remove_result is success
|
2020-09-21 17:03:38 +02:00
|
|
|
when:
|
|
|
|
- (openmanage__deploy_state == "absent")
|
|
|
|
- "'srvadmin' in ansible_facts.packages"
|
2020-09-17 16:17:05 +02:00
|
|
|
|
2021-09-02 17:38:01 +02:00
|
|
|
# Manage configuration [[[1
|
|
|
|
- name: Create SNMPD custom directory for systemd service
|
|
|
|
file:
|
|
|
|
path: "{{ openmanage__snmpd_service_override_path | dirname }}"
|
|
|
|
state: directory
|
|
|
|
mode: '0755'
|
|
|
|
when:
|
|
|
|
- openmanage__deploy_state == "present"
|
|
|
|
- ansible_distribution_release in ["buster"]
|
|
|
|
|
|
|
|
- name: Add SNMPD systemd custom configuration
|
|
|
|
template:
|
|
|
|
src: '{{ openmanage__snmpd_service_override_content }}'
|
|
|
|
dest: '{{ openmanage__snmpd_service_override_path }}'
|
|
|
|
owner: 'root'
|
|
|
|
group: 'root'
|
|
|
|
mode: '0644'
|
|
|
|
register: openmanage__snmpd_register_systemd_custom
|
|
|
|
when:
|
|
|
|
- openmanage__deploy_state == "present"
|
|
|
|
- ansible_distribution_release in ["buster"]
|
|
|
|
notify: ['Restart snmpd service']
|
|
|
|
|
2018-11-26 11:53:23 +01:00
|
|
|
# Executable [[[1
|
|
|
|
## Fix some permissions
|
|
|
|
- name: Ensure Executables can be run
|
|
|
|
file:
|
|
|
|
path: /opt/dell/srvadmin/sbin/racadm-wrapper-idrac7
|
|
|
|
mode: 0755
|
2018-12-03 15:46:48 +01:00
|
|
|
when: (openmanage__deploy_state == "present")
|
2018-11-26 14:14:24 +01:00
|
|
|
|
|
|
|
## Fix RAC1170 error
|
|
|
|
- name: Fix libssl error RAC1170
|
|
|
|
file:
|
|
|
|
src: "/usr/lib/x86_64-linux-gnu/libssl.so.1.0.2"
|
2019-04-10 14:22:54 +02:00
|
|
|
path: "/opt/dell/srvadmin/lib64/libssl.so"
|
2018-11-26 14:14:24 +01:00
|
|
|
state: link
|
2020-09-23 15:36:06 +02:00
|
|
|
when: (openmanage__deploy_state == "present" and
|
|
|
|
( (ansible_distribution == "Debian" and ansible_distribution_major_version is version("9", "<=")) or
|
2020-09-23 15:49:59 +02:00
|
|
|
(ansible_distribution == "Ubuntu" and ansible_distribution_version is version("16.04", "<="))))
|
2019-04-10 13:56:34 +02:00
|
|
|
|
|
|
|
## Manage symlinks for OpenManage/racadm apps
|
|
|
|
- name: Ensure some Executables are in PATH
|
|
|
|
file:
|
|
|
|
src: "/opt/dell/srvadmin/sbin/{{ item }}"
|
|
|
|
path: "/bin/{{ item }}"
|
2019-04-10 14:22:54 +02:00
|
|
|
state: "link"
|
2019-04-10 13:56:34 +02:00
|
|
|
with_items:
|
|
|
|
- 'omconfig'
|
|
|
|
- 'omexec'
|
|
|
|
- 'omreport'
|
|
|
|
- 'omupdate'
|
|
|
|
- 'racadm'
|
2019-04-10 14:22:54 +02:00
|
|
|
when: (openmanage__deploy_state == "present")
|
|
|
|
|
|
|
|
- name: Remove Executables symlinks
|
|
|
|
file:
|
|
|
|
path: "/bin/{{ item }}"
|
|
|
|
state: "absent"
|
|
|
|
with_items:
|
|
|
|
- 'omconfig'
|
|
|
|
- 'omexec'
|
|
|
|
- 'omreport'
|
|
|
|
- 'omupdate'
|
|
|
|
- 'racadm'
|
|
|
|
when: (openmanage__deploy_state == "absent")
|