-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlinuxpatch.yml
More file actions
42 lines (37 loc) · 1.17 KB
/
linuxpatch.yml
File metadata and controls
42 lines (37 loc) · 1.17 KB
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
---
- name: Download, run linuxpatch.com install script and manage service
hosts: all
become: yes
vars:
lp_key: "your_lp_key_here"
lp_url: "https://linuxpatch.com/"
tasks:
- name: Check if /opt/linuxpatch/bin/linuxpatch exists
stat:
path: /opt/linuxpatch/bin/linuxpatch
register: linuxpatch_file
- name: Download install.sh from linuxpatch.com
get_url:
url: "{{ lp_url }}/install.sh"
dest: /tmp/install.sh
mode: '0755'
when: not linuxpatch_file.stat.exists
- name: Run install.sh with LP_KEY as environment variable
command: /tmp/install.sh
environment:
LP_KEY: "{{ lp_key }}"
args:
chdir: /tmp
when: not linuxpatch_file.stat.exists
register: install_result
- name: Clean up install.sh
file:
path: /tmp/install.sh
state: absent
when: not linuxpatch_file.stat.exists and install_result is succeeded
- name: Ensure linuxpatch-agent service is running and enabled
service:
name: linuxpatch-agent
state: started
enabled: yes
when: linuxpatch_file.stat.exists or install_result is succeeded