forked from akhmadullin/ansible-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bitLV.yml
57 lines (46 loc) · 1.84 KB
/
bitLV.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
- hosts: all
gather_facts: false
tasks:
- name: Install python-apt
ansible.builtin.package:
name: python-apt
state: present
- name: Gather the package facts
ansible.builtin.package_facts:
manager: auto
- name: Check whether a package called BitDefender is installed
ansible.builtin.debug:
msg: "{{ ansible_facts.packages['bitdefender-security-tools'] | length }} versions of BitDefender are installed!"
when: "'bitdefender-security-tools' in ansible_facts.packages"
- name: Creates directory
file:
path: /tmp/bitdefender
state: directory
when: "'bitdefender-security-tools' not in ansible_facts.packages"
- name: Copy and unarchive Bitdefender file
unarchive:
src: /packages/LV/installer.tar
dest: /tmp/bitdefender/
remote_src: no
when: "'bitdefender-security-tools' not in ansible_facts.packages"
- name: set installer file permissions
file:
dest: /tmp/bitdefender/installer
mode: a+x
when: "'bitdefender-security-tools' not in ansible_facts.packages"
- name: execute BitDefender installer file
ansible.builtin.command: ./installer
args:
chdir: /tmp/bitdefender/
when: "'bitdefender-security-tools' not in ansible_facts.packages"
- name: Populate service facts
ansible.builtin.service_facts:
- name: Bitdefender service status
debug:
var: ansible_facts.services["bdsec-daemon.service"]
when: ansible_facts.services["bdsec-daemon.service"] is defined
- name: check if BitDefender service running
fail:
msg: Bitdefender Security Tools Daemon service is not installed
when: ansible_facts.services["bdsec-daemon.service"] is not defined