-
Notifications
You must be signed in to change notification settings - Fork 2
/
rhelvm_start.yml
65 lines (49 loc) · 2.04 KB
/
rhelvm_start.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
62
---
- name: configure demo
hosts: localhost
connection: local
gather_facts: false
become: yes
collections:
- awx.awx
tasks:
- name: install some programs
dnf:
name:
- nano
- nmap
- vim
- wget
state: present
- name: download splunk forwarder rpm
get_url:
url: https://d7wz6hmoaavd0.cloudfront.net/products/universalforwarder/releases/8.2.1/linux/splunkforwarder-8.2.1-ddff1c41e5cf-linux-2.6-x86_64.rpm
dest: /tmp/splunkforwarder-8.2.1-ddff1c41e5cf-linux-2.6-x86_64.rpm
- name: install splunk forwarder
dnf:
name: /tmp/splunkforwarder-8.2.1-ddff1c41e5cf-linux-2.6-x86_64.rpm
disable_gpg_check: true
state: present
- name: create symlink to splunk binary
ansible.builtin.file:
src: /opt/splunkforwarder/bin/splunk
dest: /usr/bin/splunk
state: link
- name: copy user-seed.conf
copy:
src: files/user-seed.conf
dest: /opt/splunkforwarder/etc/system/local/user-seed.conf
- name: configure splunk forwarder - accept license and set user/password
shell: /opt/splunkforwarder/bin/splunk restart --accept-license --answer-yes --no-prompt || /bin/true
- name: configure splunk forwarder - add forward server
shell: /opt/splunkforwarder/bin/splunk add forward-server splunk:9997 -auth admin:splunk123! || /bin/true
- name: create start_controller_job.sh file in splunk container
shell: |
ssh -o StrictHostKeyChecking=no splunk 'cat <<EOF >> /opt/splunk/bin/scripts/start_controller_job.sh
curl -f -k -H 'Content-Type: application/json' -XPOST --user admin:ansible123! https://tower/api/v2/job_templates/9/launch/
EOF'
- name: make start_controller_job.sh file executeable
shell: |
ssh -o StrictHostKeyChecking=no splunk 'chmod +x /opt/splunk/bin/scripts/start_controller_job.sh'
- name: import configure controller playook
import_tasks: configure_controller.yml