41 lines
1.5 KiB
YAML
41 lines
1.5 KiB
YAML
|
---
|
||
|
#
|
||
|
# Example ansible playbook for installation of jload on AIX.
|
||
|
#
|
||
|
# ansible-playbook -i target-host-or-ip, -k -u root --extra-vars "sysmon_url=http://169.50.182.146:80/metrics" setup-client.yml
|
||
|
#
|
||
|
|
||
|
- name: "Install sysmon client and plugins on CentOS/RHEL"
|
||
|
hosts: all
|
||
|
gather_facts: no
|
||
|
tasks:
|
||
|
- name: Sysmon | Install java runtime
|
||
|
yum:
|
||
|
name: java-11-openjdk-headless
|
||
|
state: present
|
||
|
- name: Sysmon | Install sysmon-client RPM package
|
||
|
yum:
|
||
|
name: https://git.data.coop/api/packages/nellemann/generic/sysmon/v1.1.2/sysmon-client-1.1.2-1.noarch.rpm
|
||
|
disable_gpg_check: true
|
||
|
state: present
|
||
|
- name: Sysmon | Install sysmon-plugins RPM package
|
||
|
yum:
|
||
|
name: https://git.data.coop/api/packages/nellemann/generic/sysmon/v1.1.2/sysmon-plugins-1.1.2-1.noarch.rpm
|
||
|
disable_gpg_check: true
|
||
|
state: present
|
||
|
- name: Sysmon | Setup service to start from cron at boot
|
||
|
ansible.builtin.cron:
|
||
|
name: "sysmon-client"
|
||
|
special_time: reboot
|
||
|
job: "/opt/sysmon/client/bin/client -s {{ sysmon_url }} </dev/null >/dev/null 2>&1 &"
|
||
|
- name: Sysmon | Check if sysmon-client is running
|
||
|
shell: "ps -ef | grep 'sysmon-client' | grep -v 'grep'"
|
||
|
register: result
|
||
|
failed_when: result.rc not in [ 0, 1 ]
|
||
|
- name: Debug running_processes
|
||
|
debug:
|
||
|
var: result.stdout
|
||
|
- name: Sysmon | Start sysmon-client service if not running
|
||
|
shell: "nohup /opt/sysmon/client/bin/client -s {{ sysmon_url }} </dev/null >/dev/null 2>&1 &"
|
||
|
when: result.stdout == ""
|