Advertisement
D0cEvil

Ansible - ELK deployment Playbook (temp)

Dec 27th, 2022
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.62 KB | Software | 0 0
  1. ---
  2. - hosts: db
  3.   remote_user: root
  4.   tasks:
  5.   #- name: "Change Time Zone"
  6.    #  command: \cp /usr/share/zoneinfo/America/Toronto /etc/localtime
  7.  
  8.    - name: "JAVA Deployment"
  9.      yum:
  10.        name: ['java-1.8.0-openjdk', 'java-1.8.0-openjdk-devel']
  11.        state: present
  12.      become: True
  13.  
  14.    - name: "Create JAVA config file"
  15.      copy:
  16.        dest: "/etc/profile.d/java8.sh"
  17.        content: |
  18.         export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which javac)))))
  19.          export PATH=\$PATH:\$JAVA_HOME/bin
  20.          export CLASSPATH=.:\$JAVA_HOME/jre/lib:\$JAVA_HOME/lib:\$JAVA_HOME/lib/tools.jar
  21.  
  22.    #- name: "Set JAVA source"
  23.    #  command: source /etc/profile.d/java8.sh
  24.  
  25.    #- name: "Verifyng JAVAversion"
  26.    #  command: java -version
  27.    #  command: alternatives --list
  28.    #  command: alternatives --config java
  29.  
  30.    - name: "Import repository key"
  31.      ansible.builtin.rpm_key:
  32.        state: present
  33.        key: https://artifacts.elastic.co/GPG-KEY-elasticsearch
  34.  
  35.    - name: "Create ELK repository file"
  36.      copy:
  37.        dest: "/etc/yum.repos.d/elasticsearch.repo"
  38.        content: |
  39.         [elasticsearch]
  40.          name=Elasticsearch repository for 7.x packages
  41.          baseurl=https://artifacts.elastic.co/packages/7.x/yum
  42.          gpgcheck=1
  43.          gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
  44.          enabled=0
  45.          autorefresh=1
  46.          type=rpm-md
  47.  
  48.    - name: "YUM updating"
  49.      command: yum update -y
  50.  
  51.    - name: "Installing ELK stack"
  52.      yum:
  53.        name: ['elasticsearch', 'kibana', 'logstash', 'filebeat']
  54.        state: present
  55.      become: True
  56.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement