Compare commits

...

5 Commits

Author SHA1 Message Date
Christer Warén
93831f85f5 Fix missing sudo in INSTRUCTIONS.md 2025-09-01 15:34:24 +03:00
Christer Warén
13d07913ef Add workstation installation guide to INSTRUCTIONS.md 2025-09-01 15:33:12 +03:00
Christer Warén
718874a63d Beautification of Protect script 2025-09-01 15:21:41 +03:00
Christer Warén
859b96eb88 Beautification of Init script 2025-09-01 15:21:19 +03:00
Christer Warén
e149ba3db0 Inventories Update 2025-09-01 15:20:42 +03:00
5 changed files with 68 additions and 19 deletions

View File

@@ -2,6 +2,18 @@
## PVJJK 1.VOS Niinisalo
### Ylläpitäjän ohjeet
**Työaseman asennus**
1. Asenna Windows Subsystem for Linux vaihtoehtoisista järjestelmäominaisuuksista.
2. Avaa Powershell ja asenna Debian käyttöjärjestelmä ̣– `wsl --install -d Debian`
3. Aseta käyttäjätunnukseksi `asentaja` ja salasanaksi sama kuin työaseman Windows käyttäjän salasana.
4. Vaihda isännän nimi
1. Avaa WSL konfiguraatiotiedosto `sudo nano /etc/wsl.conf`
2. Lisää Network kohtaan tai luo Network kohta `[network]`
3. Lisää isännän nimi `hostname = argo.aito.tjas`
4. Lisää Hosts tiedoston generointi `generateHosts = true`
4. Asenna curl-paketti käyttämällä APT-paketinhallintaa `sudo apt update && apt install curl`
5. Lataa ja suorita Init.sh skripti `bash <(curl https://raw.githubusercontent.com/cwchristerw/tjas-infra/refs/heads/master/init.sh)`
**Palvelimen asennus**
1. Asenna Debian-käyttöjärjestelmä
2. Asenna curl-paketti käyttämällä APT-paketinhallintaa `apt update && apt install curl`

33
init.sh
View File

@@ -4,25 +4,36 @@ if [ ! "$BASH_VERSION" ] ; then
exit 1
fi
underline=`tput smul`
nounderline=`tput rmul`
bold=$(tput bold)
normal=$(tput sgr0)
ti-header(){
echo $(tput bold)$1$(tput sgr0)
echo ${bold}$1${normal}
}
echo "${bold}"
echo "
==============================
PVJJK 1.VOS TJAS - Infra
Init Script
------------------------------
.-') _ ('-. .-')
( OO) ) ( OO ).-. ( OO ).
/ '._ ,--. / . --. /(_)---\_)
|'--...__) .-')| ,| | \-. \ / _ |
'--. .--'( OO |(_|.-'-' | |\ :\` \`.
| | | \`-'| | \| |_.' | '..\`''.)
| | ,--. | | | .-. |.-._) \\
| | | '-' / | | | |\ /
\`--' \`-----' \`--' \`--' \`-----'
"
echo "
PVJJK 1.VOS NIINISALO
TIETOJÄRJESTELMÄASENTAJIEN INTRA
INIT SCRIPT
"
echo -n "${normal}"
stop () {
echo "
==============================
"
exit 1
}

View File

@@ -0,0 +1,6 @@
$ANSIBLE_VAULT;1.2;AES256;pvjjk-1vos-niinisalo
37353031396164353032396635313539613734613432323435383137303835383439663439363337
6230323066313361383061633932616230363465326239640a333739323064653263336337633639
64343833623362323734363239653866383037313331613738653133636364623237326637313232
3462636261386230380a313634313965343733616137663532623965393835306562633635633831
3166

View File

@@ -1,6 +1,7 @@
---
pvjjk_1vos_niinisalo:
hosts:
argo.aito.tjas:
olympus.juva.tjas:
vars:
ansible_python_interpreter: /usr/bin/python3

View File

@@ -5,21 +5,35 @@ nounderline=`tput rmul`
bold=$(tput bold)
normal=$(tput sgr0)
echo "${bold}PVJJK 1.VOS Niinisalo / TJAS Infra / Protect${normal}"
echo "${bold}"
echo "
.-') _ ('-. .-')
( OO) ) ( OO ).-. ( OO ).
/ '._ ,--. / . --. /(_)---\_)
|'--...__) .-')| ,| | \-. \ / _ |
'--. .--'( OO |(_|.-'-' | |\ :\` \`.
| | | \`-'| | \| |_.' | '..\`''.)
| | ,--. | | | .-. |.-._) \\
| | | '-' / | | | |\ /
\`--' \`-----' \`--' \`--' \`-----'
"
echo "
PVJJK 1.VOS NIINISALO
TIETOJÄRJESTELMÄASENTAJIEN INTRA
PROTECT SCRIPT
"
echo -n "${normal}"
action=$1
encrypt() {
echo "${underline}Encrypting...${nounderline}"
execute "ansible-vault encrypt --vault-id $1@vault/$1" $1
}
decrypt() {
echo "${underline}Decrypting...${nounderline}"
execute "ansible-vault decrypt --vault-id $1@vault/$1" $1
}
list() {
echo "${underline}Listing...${nounderline}"
i=0
for file in inventories/$1/group_vars/* inventories/$1/host_vars/*;
do
@@ -41,18 +55,23 @@ for file in inventories/$2/group_vars/* inventories/$2/host_vars/*;
case $action in
encrypt)
echo "${underline}Encrypting...${nounderline}"
encrypt pvjjk-1vos-niinisalo
;;
decrypt)
echo "${underline}Decrypting...${nounderline}"
decrypt pvjjk-1vos-niinisalo
;;
list)
echo "${underline}Listing...${nounderline}"
list pvjjk-1vos-niinisalo
;;
help)
echo "encrypt, decrypt, list"
;;
*)
echo "..."
echo "${underline}HELP${nounderline}"
echo "encrypt - Encrypt Files"
echo "decrypt - Decrypt Files"
echo "list - List Files"
;;
esac
echo -e "\n\n\n"