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

stop, update and restart configs for thehive

parent f183de90
No related branches found
No related tags found
No related merge requests found
FROM {{repo}}/openjdk:{{version}}{{suffix}} FROM {{repo}}/openjdk:{{version}}{{suffix}}
USER root USER root
#COPY thehive.repo /etc/yum.repos.d/thehive.repo
#COPY supervisord.conf /etc/supervisord.conf
#COPY start.sh /start.sh
RUN echo "[thehive-project]" > /etc/yum.repos.d/thehive.repo && \ RUN echo "[thehive-project]" > /etc/yum.repos.d/thehive.repo && \
echo "enabled=1" >> /etc/yum.repos.d/thehive.repo && \ echo "enabled=1" >> /etc/yum.repos.d/thehive.repo && \
echo "priority=1" >> /etc/yum.repos.d/thehive.repo && \ echo "priority=1" >> /etc/yum.repos.d/thehive.repo && \
...@@ -12,7 +9,7 @@ RUN echo "[thehive-project]" > /etc/yum.repos.d/thehive.repo && \ ...@@ -12,7 +9,7 @@ RUN echo "[thehive-project]" > /etc/yum.repos.d/thehive.repo && \
echo "gpgcheck=1" >> /etc/yum.repos.d/thehive.repo && \ echo "gpgcheck=1" >> /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 && \
yum install -y thehive4 supervisor daemonize vim net-tools telnet htop && \ yum install -y thehive4 supervisor daemonize vim net-tools telnet htop rsync && \
mkdir -p /opt/thp_data/files/thehive && \ mkdir -p /opt/thp_data/files/thehive && \
chown -R thehive:thehive /opt/thp_data/files/thehive && \ chown -R thehive:thehive /opt/thp_data/files/thehive && \
mkdir -p /home/thehive && \ mkdir -p /home/thehive && \
...@@ -21,5 +18,3 @@ RUN echo "[thehive-project]" > /etc/yum.repos.d/thehive.repo && \ ...@@ -21,5 +18,3 @@ RUN echo "[thehive-project]" > /etc/yum.repos.d/thehive.repo && \
EXPOSE 9000 EXPOSE 9000
COPY thehivesupervisord.conf /etc/supervisord.conf COPY thehivesupervisord.conf /etc/supervisord.conf
ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"] ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
#USER thehive
# ENTRYPOINT ["/start.sh"]
#!/bin/bash
export CASSANDRA_HOME=/usr/share/cassandra
export CASSANDRA_CONF=$CASSANDRA_HOME/conf
export CASSANDRA_INCLUDE=$CASSANDRA_HOME/cassandra.in.sh
log_file=/var/log/cassandra/cassandra.log
pid_file=/var/run/cassandra/cassandra.pid
lock_file=/var/lock/subsys/cassandra
CASSANDRA_PROG=/usr/sbin/cassandra
$CASSANDRA_PROG -p $pid_file > $log_file 2>&1
[supervisord]
loglevel=debug
nodaemon=true
[program:cassandra]
user=cassandra
directory=/usr/share/cassandra
stdout_logfile=/var/log/cassandra/cassandra.log
redirect_stderr=true
environment=CASSANDRA_HOME="/usr/share/cassandra",CASSANDRA_CONF="/usr/share/cassandra/conf",CASSANDRA_INCLUDE="$CASSANDRA_HOME/cassandra.in.sh"
command=/usr/sbin/cassandra -p /var/run/cassandra/cassandra.pid
[thehive-project]
enabled=1
priority=1
name=TheHive-Project RPM repository
baseurl=http://rpm.thehive-project.org/stable/noarch
gpgcheck=1
--- ---
- name: Configure TheHive - include: start.yml
remote_user: thehive
template:
src: application.conf.j2
dest: /etc/thehive/application.conf
tags: tags:
- start - start
- include: stop.yml
- name: Start TheHive
remote_user: root
command: "supervisorctl start thehive"
tags: tags:
- start - stop
- stop-thehive
- name: Wait for TheHive - include: update-config.yml
remote_user: root
wait_for:
host: "{{groups['thehive'][0]}}"
port: 9000
state: started
delay: 5
tags: tags:
- start - update-config
- update-thehive-config
- name: Set Autostart for supervisord's services - include: restart.yml
shell: "sed -i 's/autostart=false/autostart=true/g' /etc/supervisord.conf"
tags:
- start
- name: Stop TheHive
remote_user: root
command: "supervisorctl stop thehive"
tags: tags:
- stop - restart
- restart-thehive
---
- name: Restart TheHive
remote_user: root
command: "supervisorctl restart thehive"
- name: Wait for TheHive
remote_user: root
wait_for:
host: "{{groups['thehive'][0]}}"
port: 9000
state: started
delay: 5
---
- name: Configure TheHive
remote_user: thehive
template:
src: application.conf.j2
dest: /etc/thehive/application.conf
- name: Start TheHive
remote_user: root
command: "supervisorctl start thehive"
- name: Wait for TheHive
remote_user: root
wait_for:
host: "{{groups['thehive'][0]}}"
port: 9000
state: started
delay: 5
- name: Set Autostart for supervisord's services
replace:
path: /etc/supervisord.conf
regexp: '^autostart=false$'
replace: 'autostart=true'
- name: Stop TheHive
remote_user: root
command: "supervisorctl stop thehive"
---
- name: Stop TheHive
remote_user: root
command: "supervisorctl stop thehive"
---
- name: Configure TheHive
remote_user: thehive
template:
src: application.conf.j2
dest: /etc/thehive/application.conf
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
- name: Stop soctools cluster - name: Stop soctools cluster
import_playbook: stopsoctools.yml import_playbook: stopsoctools.yml
when: "'stop' in ansible_run_tags" when: "'stop' in ansible_run_tags or 'stop-thehive' in ansible_run_tags or 'stop-keycloak' in ansible_run_tags"
- name: Update soctools cluster configs - name: Update soctools cluster configs
import_playbook: update-config-soctools.yml import_playbook: update-config-soctools.yml
when: "'update-config' in ansible_run_tags" when: "'update-config' in ansible_run_tags or 'update-keycloak-config' in ansible_run_tags or 'update-thehive-config' in ansible_run_tags"
- name: restart soctools cluster servics - name: restart soctools cluster servics
import_playbook: restart-soctools.yml import_playbook: restart-soctools.yml
when: "'restart' in ansible_run_tags" when: "'restart' in ansible_run_tags or 'restart-thehive' in ansible_run_tags or 'restart-keycloak' in ansible_run_tags"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment