Commit 03a95f52 authored by joonas lume's avatar joonas lume
Browse files

Add postinst.sh script for elastic for updating configuration

parent a923bbff
......@@ -10,6 +10,7 @@ pipeline {
string(name: 'ElasticSearchVersion', defaultValue: '7.9.0', description: 'ElasticSearch version', trim: true)
}
environment {
RSYNC = 'rsync -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --exclude ".git"'
SSH = 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
SCP = 'scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
TLD = 'riaint.ee'
......@@ -108,15 +109,22 @@ pipeline {
}
}
stage('Start Elasticsearch') {
stage('Update conf and start Elasticsearch') {
when {
expression { params.Recreate == true }
}
steps {
script {
ssh_start_es = '''
sudo systemctl start elasticsearch
'''
set -x
set -e
cd /tmp/
sudo bash ./postinst.sh
sudo systemctl start elasticsearch
'''
sh "$RSYNC -av elasticsearch/deb/confd riajenk@$ELK_HOST:/tmp/"
sh "$RSYNC -av elasticsearch/deb/postinst.sh riajenk@$ELK_HOST:/tmp/"
sh "$SSH riajenk@${NODE} '$ssh_start_es'"
}
}
......
#!/bin/bash
mkdir -p /etc/confd
mkdir -p /etc/confd/conf.d
mkdir -p /etc/confd/templates
mv /tmp/confd/conf.d/* /etc/confd/conf.d/
mv /tmp/confd/templates/* /etc/confd/templates/
source /etc/vaultcred && confd \
-onetime \
-prefix $workspace \
-backend vault \
-node $vaulthost \
-auth-type token \
-auth-token $vaulttoken
if [ $? -ne 0 ]
then
echo "Failed to apply configuration, use vault_test.sh to verify connection
to vault is working. If that is working, check confd templates and
configuration. To run it manually use
source /etc/vaultcred && confd -onetime -prefix $workspace
-backend vault -node $vaulthost -auth-type token
-auth-token $vaulttoken
to finish installation properly use apt-get -f install"
exit 1
fi
......@@ -7,8 +7,6 @@ chown kibana:kibana /var/log/kibana
mkdir -p /var/run/kibana
chown kibana:kibana /var/run/kibana
mkdir -p /opt/rig
mkdir -p /etc/confd
mkdir -p /etc/confd/conf.d
mkdir -p /etc/confd/templates
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment