Skip to content
Snippets Groups Projects
Commit 205afeac authored by Temur Maisuradze's avatar Temur Maisuradze
Browse files

start stop restart and update scripts for cortex

parent 65f7076c
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,7 @@ RUN echo "[thehive-project]" > /etc/yum.repos.d/thehive.repo && \ ...@@ -10,7 +10,7 @@ RUN echo "[thehive-project]" > /etc/yum.repos.d/thehive.repo && \
yum install -y epel-release && \ yum install -y epel-release && \
rpm --import https://raw.githubusercontent.com/TheHive-Project/TheHive/master/PGP-PUBLIC-KEY && \ rpm --import https://raw.githubusercontent.com/TheHive-Project/TheHive/master/PGP-PUBLIC-KEY && \
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch && \ rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch && \
yum install -y cortex supervisor daemonize vim net-tools telnet htop python3-pip.noarch git gcc python3-devel.x86_64 ssdeep-devel.x86_64 python3-wheel.noarch libexif-devel.x86_64 libexif.x86_64 perl-Image-ExifTool.noarch gcc-c++ whois && \ yum install -y cortex supervisor rsync daemonize vim net-tools telnet htop python3-pip.noarch git gcc python3-devel.x86_64 ssdeep-devel.x86_64 python3-wheel.noarch libexif-devel.x86_64 libexif.x86_64 perl-Image-ExifTool.noarch gcc-c++ whois && \
rpm -Uvh https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-6.8.13.rpm && \ rpm -Uvh https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-6.8.13.rpm && \
chown -R elasticsearch:elasticsearch /etc/elasticsearch && \ chown -R elasticsearch:elasticsearch /etc/elasticsearch && \
mkdir -p /home/cortex && \ mkdir -p /home/cortex && \
......
--- ---
- name: Copy cacert to ca-trust dir - include: start.yml
remote_user: root
copy:
src: "files/{{ca_cn}}.crt"
dest: /etc/pki/ca-trust/source/anchors/ca.crt
tags: tags:
- start - start
- startcortex - include: stop.yml
- name: Install cacert to root truststore
remote_user: root
command: "update-ca-trust"
tags:
- start
- startcortex
- name: Copy certificates in cortex conf dir
remote_user: cortex
copy:
src: "{{ item }}"
dest: "/etc/cortex/{{ item }}"
mode: 0600
with_items:
- "{{ inventory_hostname }}.p12"
- "{{ inventory_hostname }}.crt"
- "{{ inventory_hostname }}.key"
- cacerts.jks
- "{{ca_cn}}.crt"
tags:
- start
- startcortex
- name: Configure embedded Elasticsearch 6
remote_user: root
template:
src: jvm.options.j2
dest: /etc/elasticsearch/jvm.options
tags:
- start
- startcortex
- name: Start embedded Elasticsearch 6
remote_user: root
command: "supervisorctl start elasticsearch"
tags:
- start
- startcortex
- name: Configure Cortex
remote_user: cortex
template:
src: application.conf.j2
dest: /etc/cortex/application.conf
tags: tags:
- start - stop
- startcortex - stop-cortex
- include: update-config.yml
- name: Start Cortex
remote_user: root
command: "supervisorctl start cortex"
tags: tags:
- start - update-config
- startcortex - update-cortex-config
- include: restart.yml
- name: Wait for Cortex
remote_user: root
wait_for:
host: "{{groups['cortex'][0]}}"
port: 9001
state: started
delay: 5
tags: tags:
- start - restart
- startcortex - restart-cortex
- name: Set Autostart for supervisord's services
shell: "sed -i 's/autostart=false/autostart=true/g' /etc/supervisord.conf"
tags:
- start
- name: Stop Elasticsearch
remote_user: root
command: "supervisorctl stop elasticsearch"
tags:
- stop
- stopelasticsearch
- name: Stop Cortex
remote_user: root
command: "supervisorctl stop cortex"
tags:
- stop
- stopcortex
--- ---
- name: Restart embedded Elasticsearch 6 - name: Restart Elasticsearch
remote_user: root remote_user: root
command: "supervisorctl restart elasticsearch" command: "supervisorctl restart elasticsearch"
......
...@@ -7,3 +7,4 @@ ...@@ -7,3 +7,4 @@
- name: Stop Cortex - name: Stop Cortex
remote_user: root remote_user: root
command: "supervisorctl stop cortex" command: "supervisorctl stop cortex"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment