-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathansible-deploy.yml
61 lines (53 loc) · 1.41 KB
/
ansible-deploy.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
58
59
60
61
- name: install/uninstall bioslow.py on remote hosts
hosts: all
gather_facts: no
become: true
vars:
state: present
bioslow_args: "-u ms -t 1000"
tasks:
- name: install depencies
vars:
pkgs:
- bcc
package:
name: "{{ pkgs }}"
when: state == "present"
- name: install script
copy:
src: bioslow
dest: /usr/local/bin/bioslow
owner: root
mode: "0755"
when: state == "present"
- name: uninstall script
file:
path: /etc/systemd/system/bioslow.service
state: "{{ state }}"
when: state == "absent"
- name: install systemd service
template:
src: bioslow.service.j2
dest: /etc/systemd/system/bioslow.service
when: state == "present"
- name: start systemd service
systemd:
daemon_reload: true
service: "bioslow"
state: "restarted"
when: state == "present"
- name: stop systemd service
systemd:
daemon_reload: true
service: "bioslow"
state: "stopped"
when: state == "absent"
register: stop_service
failed_when:
- stop_service.failed == true
- '"Could not find the requested service" not in stop_service.msg'
- name: uninstall systemd service
file:
path: /etc/systemd/system/bioslow.service
state: "{{ state }}"
when: state == "absent"