Added self-service script (for webserver)

This commit is contained in:
2022-02-17 14:19:42 +01:00
parent dd3fa5f344
commit d92076dacd
4 changed files with 62 additions and 0 deletions

25
self_service.sh Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/env bash
copy_template() {
cp -f ../../templates/$1 ./$2
}
read -p "Klantnaam: " customerName
mkdir -p ./customers/$customerName && cd $_
read -p "Ip: " ipAddr
echo -e "[nginx]\n$ipAddr" > ./inventory
copy_template ./Vagrantfile.template ./Vagrantfile
sed -i "s/#{customerName}/$customerName/" ./Vagrantfile
sed -i "s/#{ipAddr}/$ipAddr/" ./Vagrantfile
copy_template ./ansible.cfg.template ./ansible.cfg
mkdir -p ./.ssh/
ssh-keygen -t rsa -b 2048 -f ./.ssh/id_rsa
vagrant up
ansible all -m ping
ansible-playbook --ask-become-pass ./../../playbooks/install_nginx.yml
firefox $ipAddr