Premier commit
This commit is contained in:
77
pre/Vagrantfile-s-adm
Normal file
77
pre/Vagrantfile-s-adm
Normal file
@@ -0,0 +1,77 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
||||
# configures the configuration version (we support older styles for
|
||||
# backwards compatibility). Please don't change it unless you know what
|
||||
# you're doing.
|
||||
Vagrant.configure("2") do |config|
|
||||
# The most common configuration options are documented and commented below.
|
||||
# For a complete reference, please see the online documentation at
|
||||
# https://docs.vagrantup.com.
|
||||
|
||||
# Every Vagrant development environment requires a box. You can search for
|
||||
# boxes at https://vagrantcloud.com/search.
|
||||
config.vm.box = "debian/buster64"
|
||||
config.vm.hostname = "s-adm"
|
||||
config.vm.define "s-adm"
|
||||
config.vm.provider :virtualbox do |vb|
|
||||
vb.name = "s-adm"
|
||||
end
|
||||
# Disable automatic box update checking. If you disable this, then
|
||||
# boxes will only be checked for updates when the user runs
|
||||
# `vagrant box outdated`. This is not recommended.
|
||||
# config.vm.box_check_update = false
|
||||
|
||||
# Create a forwarded port mapping which allows access to a specific port
|
||||
# within the machine from a port on the host machine. In the example below,
|
||||
# accessing "localhost:8080" will access port 80 on the guest machine.
|
||||
# NOTE: This will enable public access to the opened port
|
||||
# config.vm.network "forwarded_port", guest: 80, host: 8080
|
||||
|
||||
# Create a forwarded port mapping which allows access to a specific port
|
||||
# within the machine from a port on the host machine and only allow access
|
||||
# via 127.0.0.1 to disable public access
|
||||
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
|
||||
|
||||
# Create a private network, which allows host-only access to the machine
|
||||
# using a specific IP.
|
||||
config.vm.network "public_network", ip: "192.168.1.91"
|
||||
config.vm.network "private_network", ip: "192.168.99.99"
|
||||
|
||||
# Create a public network, which generally matched to bridged network.
|
||||
# Bridged networks make the machine appear as another physical device on
|
||||
# your network.
|
||||
# config.vm.network "public_network"
|
||||
|
||||
# Share an additional folder to the guest VM. The first argument is
|
||||
# the path on the host to the actual folder. The second argument is
|
||||
# the path on the guest to mount the folder. And the optional third
|
||||
# argument is a set of non-required options.
|
||||
# config.vm.synced_folder "../data", "/vagrant_data"
|
||||
|
||||
# Provider-specific configuration so you can fine-tune various
|
||||
# backing providers for Vagrant. These expose provider-specific options.
|
||||
# Example for VirtualBox:
|
||||
#
|
||||
# config.vm.provider "virtualbox" do |vb|
|
||||
# # Display the VirtualBox GUI when booting the machine
|
||||
# vb.gui = true
|
||||
#
|
||||
# # Customize the amount of memory on the VM:
|
||||
# vb.memory = "1024"
|
||||
# end
|
||||
#
|
||||
# View the documentation for the provider you are using for more
|
||||
# information on available options.
|
||||
|
||||
# Enable provisioning with a shell script. Additional provisioners such as
|
||||
# Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
|
||||
# documentation for more information about their specific syntax and use.
|
||||
config.vm.provision "shell", inline: <<-SHELL
|
||||
apt-get update
|
||||
apt-get upgrade
|
||||
apt-get install -y vim wget curl
|
||||
# apt-get install -y apache2
|
||||
SHELL
|
||||
end
|
54
pre/gsbboot
Normal file
54
pre/gsbboot
Normal file
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
version="1.8"
|
||||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
|
||||
__base="$(basename ${__file})"
|
||||
__root="$(cd "$(dirname "${__dir}")" && pwd)"
|
||||
echo "dir : ${__dir}"
|
||||
echo "file : ${__file}"
|
||||
echo "base : ${__base}"
|
||||
echo "root : ${__root}"
|
||||
|
||||
# version 1.8
|
||||
# install git si besoin
|
||||
# install ansible si besoin + backports si wheezy
|
||||
|
||||
readonly base=/root/tools/ansible
|
||||
readonly slist=/etc/apt/sources.list
|
||||
readonly host=depl
|
||||
if [[ -z ${DEPL+x} ]]; then
|
||||
echo "erreur : DEPL indefini"
|
||||
echo " DEPL : adresse serveur deploiement"
|
||||
echo "export DEPL=xyzt ; ./$0"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
hostf="${host}.local"
|
||||
prj=gsb2023
|
||||
APT=apt
|
||||
|
||||
which git >> /dev/null
|
||||
if [[ $? != 0 ]]; then
|
||||
${APT} update
|
||||
echo "installation de git ..."
|
||||
${APT} install -y git-core
|
||||
fi
|
||||
${APT} update
|
||||
#${APT} upgrade -y
|
||||
|
||||
which ansible >> /dev/null
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "installation de ansible ..."
|
||||
${APT} install -y ansible
|
||||
fi
|
||||
|
||||
[ -e "${base}" ] || mkdir -p "${base}"
|
||||
|
||||
grep "${hostf}" /etc/hosts > /dev/null || echo "${DEPL} ${hostf} ${host}" >> /etc/hosts
|
||||
cd "${base}"
|
||||
|
||||
cp ${prj}/pull-config ${base}
|
||||
|
||||
#echo "N'oubliez pasz d'indiquer l'adresse DEPL dans '/root/tools/ansible/pull-config'"
|
||||
echo "Vous pouvez lancer 'bash pull-config' depuis ${base} ..."
|
||||
|
104
pre/inst-depl
Normal file
104
pre/inst-depl
Normal file
@@ -0,0 +1,104 @@
|
||||
#!/bin/bash
|
||||
## aa : 2023-01-18 15:25
|
||||
## ps : 2023-02-01 15:25
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
GITUSR=gitgsb
|
||||
GITPRJ=gsb2023
|
||||
apt-get update
|
||||
apt-get install -y apache2 git
|
||||
STOREREP="/var/www/html/gsbstore"
|
||||
|
||||
GLPIREL=10.0.6
|
||||
str="wget -nc https://github.com/glpi-project/glpi/releases/download/${GLPIREL}/glpi-${GLPIREL}.tgz"
|
||||
|
||||
|
||||
#Fusion Inventory
|
||||
|
||||
#FIREL=10.0.3+1.0
|
||||
#str2="https://github.com/fusioninventory/fusioninventory-for-glpi/releases/download/glpi${FIREL}/fusioninventory-${FIREL}.tar.bz2"
|
||||
|
||||
|
||||
#GLPI Agent
|
||||
|
||||
GLPIAGVER=1.4
|
||||
str31="wget -nc https://github.com/glpi-project/glpi-agent/releases/download/${GLPIAGVER}/GLPI-Agent-${GLPIAGVER}-x64.msi"
|
||||
|
||||
str32="wget -nc https://github.com/glpi-project/glpi-agent/releases/download/${GLPIAGVER}/GLPI-Agent-${GLPIAGVER}-x86.msi"
|
||||
|
||||
|
||||
FOGREL=1.5.9
|
||||
str4="wget -nc https://github.com/FOGProject/fogproject/archive/${FOGREL}.tar.gz -O fogproject-${FOGREL}.tar.gz"
|
||||
|
||||
WPREL=6.1.1
|
||||
#v6.1.1 le 17/01/2023
|
||||
str5="wget -nc https://fr.wordpress.org/latest-fr_FR.tar.gz -O wordpress-6.1.1-fr_FR.tar.gz"
|
||||
|
||||
GOSSVER=v0.3.21
|
||||
str6="curl -L https://github.com/aelsabbahy/goss/releases/download/${GOSSVER}/goss-linux-amd64 -o goss"
|
||||
|
||||
#DOCKERREL=1.29.2
|
||||
#str7="curl -L https://github.com/docker/compose/releases/download/${DOCKERREL}/docker-compose-$(uname -s)-$(uname -m) -o docker-compose"
|
||||
|
||||
#GESTSUPREL=3.2.30
|
||||
#str8="wget -nc 'https://gestsup.fr/index.php?page=download&channel=stable&version=${GESTSUPREL}&type=gestsup' -O gestsup_${GESTSUPREL}.zip"
|
||||
str8="wget -nc 'https://gestsup.fr/index.php?page=download&channel=stable&version=3.2.30&type=gestsup' -O gestsup_3.2.30.zip"
|
||||
|
||||
|
||||
#METRICBEAT ET FILEBEAT
|
||||
ELKREL=8.5.3
|
||||
str81="wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-${ELKREL}-amd64.deb"
|
||||
|
||||
str82="wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-${ELKREL}-windows-x86_64.zip"
|
||||
|
||||
str83="wget https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-${ELKREL}-windows-x86_64.zip"
|
||||
|
||||
str84="wget https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-${ELKREL}-amd64.deb"
|
||||
|
||||
|
||||
[[ -d "${STOREREP}" ]]|| mkdir "${STOREREP}"
|
||||
|
||||
(cat <<EOT > "${STOREREP}/getall"
|
||||
#!/bin/bash
|
||||
|
||||
${str}
|
||||
|
||||
${str2}
|
||||
|
||||
${str31}
|
||||
|
||||
${str32}
|
||||
|
||||
${str4}
|
||||
|
||||
${str5}
|
||||
|
||||
${str6}
|
||||
|
||||
chmod +x ./goss
|
||||
|
||||
curl -L https://get.docker.com -o getdocker.sh
|
||||
|
||||
chmod +x ./getdocker.sh
|
||||
|
||||
#${str7}
|
||||
|
||||
#chmod +x ./docker-compose
|
||||
|
||||
|
||||
wget -nc https://github.com/FiloSottile/mkcert/releases/download/v1.4.4/mkcert-v1.4.4-linux-amd64 -O mkcert
|
||||
|
||||
chmod +x ./mkcert
|
||||
|
||||
${str8}
|
||||
|
||||
${str81}
|
||||
${str82}
|
||||
${str83}
|
||||
${str84}
|
||||
|
||||
EOT
|
||||
)
|
||||
|
||||
cat "${STOREREP}/getall"
|
48
pre/inst-depl.old
Normal file
48
pre/inst-depl.old
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
GITUSR=gitgsb
|
||||
GITPRJ=gsb
|
||||
apt update && apt upgrade
|
||||
apt install -y apache2 git
|
||||
getent passwd "${GITUSR}" >> /dev/null
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "creation utilisateur "${GITUSR}" ..."
|
||||
/sbin/useradd -m -d /home/"${GITUSR}" -s /bin/bash "${GITUSR}"
|
||||
echo "${GITUSR}:${GITUSR}" | /sbin/chpasswd
|
||||
else
|
||||
echo "utilisateur "${GITUSR}" existant..."
|
||||
fi
|
||||
su -c "git init --share --bare /home/${GITUSR}/${GITPRJ}.git" "${GITUSR}"
|
||||
su -c "cd ${GITPRJ}.git/.git/hooks && mv post-update.sample post-update" "${GITUSR}"
|
||||
[[ -h /var/www/html/"${GITPRJ}".git ]]|| ln -s /home/"${GITUSR}"/"${GITPRJ}".git /var/www/html/"${GITPRJ}".git
|
||||
[[ -d /var/www/html/gsbstore ]]|| mkdir /var/www/html/gsbstore
|
||||
|
||||
(cat <<EOT > /var/www/html/gsbstore/getall
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
GLPIREL=9.4.5
|
||||
wget -nc https://github.com/glpi-project/glpi/releases/download/\${GLPIREL}/glpi-\${GLPIREL}.tgz
|
||||
|
||||
FIREL=9.4+2.4
|
||||
wget -nc -O fusioninventory-glpi\${FIREL}.tag.gz https://github.com/fusioninventory/fusioninventory-for-glpi/archive/glpi\${FIREL}.tar.gz
|
||||
#https://github.com/fusioninventory/fusioninventory-for-glpi/archive/glpi9.4+2.4.tar.g
|
||||
|
||||
FIAGREL=2.5.2
|
||||
wget -nc https://github.com/fusioninventory/fusioninventory-agent/releases/download/\${FIAGREL}/fusioninventory-agent_windows-x64_\${FIAGREL}.exe
|
||||
|
||||
wget -nc https://github.com/fusioninventory/fusioninventory-agent/releases/download/\$FIAGREL/fusioninventory-agent_windows-x86_\${FIAGREL}.exe
|
||||
|
||||
FOGREL=1.5.7
|
||||
wget -nc https://github.com/FOGProject/fogproject/archive/\${FOGREL}.tar.gz -O fogproject-\${FOGREL}.tar.gz
|
||||
|
||||
wget -nc https://fr.wordpress.org/wordpress-5.3.2-fr_FR.tar.gz
|
||||
|
||||
EOT
|
||||
)
|
||||
cat /var/www/html/gsbstore/getall
|
||||
|
28
pre/pull-config
Normal file
28
pre/pull-config
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
dir=/root/tools/ansible
|
||||
prj=gsb2023
|
||||
opt=""
|
||||
|
||||
if [ -z ${UREP+x} ]; then
|
||||
UREP=https://gitea.lyc-lecastel.fr/gadmin/gsb2023.git
|
||||
fi
|
||||
|
||||
dir=/root/tools/ansible
|
||||
|
||||
[ -e "${dir}" ] || mkdir -p "${dir}"
|
||||
|
||||
cd "${dir}" || exit 1
|
||||
|
||||
hostname > hosts
|
||||
if [[ $# == 1 ]] ; then
|
||||
opt=$1
|
||||
fi
|
||||
if [[ "${opt}" == '-l' ]] ; then
|
||||
cd "${dir}/${prj}" || exit 2
|
||||
ansible-playbook -i localhost, -c local "$(hostname).yml"
|
||||
else
|
||||
ansible-pull -i "${dir}/hosts" -C main -U "${UREP}"
|
||||
fi
|
||||
|
||||
exit 0
|
Reference in New Issue
Block a user