mirror of
https://github.com/cwchristerw/tjas-infra
synced 2025-09-04 02:23:22 +00:00
Compare commits
22 Commits
dec30dd66b
...
master
Author | SHA1 | Date | |
---|---|---|---|
![]() |
cf65e1ac85 | ||
![]() |
177bafaa93 | ||
![]() |
89c5cc2437 | ||
![]() |
586ea6bd0e | ||
![]() |
13d07913ef | ||
![]() |
718874a63d | ||
![]() |
859b96eb88 | ||
![]() |
e149ba3db0 | ||
![]() |
2224e2c596 | ||
![]() |
2b6921e9f3 | ||
![]() |
b895ac02b9 | ||
![]() |
edbf3f6191 | ||
![]() |
79e45822c1 | ||
![]() |
a4e7218050 | ||
![]() |
f1a5f0caa5 | ||
![]() |
7f8b4a1e13 | ||
![]() |
e1a1e4889a | ||
![]() |
d5b99d3146 | ||
![]() |
be900d5785 | ||
![]() |
84884d9015 | ||
![]() |
5589d94f11 | ||
![]() |
491ad0aba8 |
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"files.trimTrailingWhitespace": true,
|
"files.trimTrailingWhitespace": true,
|
||||||
"files.insertFinalNewline": true,
|
"files.insertFinalNewline": true,
|
||||||
"files.trimFinalNewlines": true,
|
|
||||||
"editor.renderFinalNewline": false
|
"editor.renderFinalNewline": false
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,27 @@
|
|||||||
## PVJJK 1.VOS Niinisalo
|
## PVJJK 1.VOS Niinisalo
|
||||||
### Ylläpitäjän ohjeet
|
### Ylläpitäjän ohjeet
|
||||||
|
|
||||||
|
**Työaseman asennus**
|
||||||
|
1. Asenna Windows Subsystem for Linux vaihtoehtoisista järjestelmäominaisuuksista.
|
||||||
|
2. Käynnistä työasema uudelleen
|
||||||
|
3. Asenna Debian käyttöjärjestelmä
|
||||||
|
1. Avaa Powershell järjestelmänvalvojana
|
||||||
|
2. Suorita asennuskomento – `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. Lisää Network kohtaan tai luo Network kohta – `echo "[network]" > /etc/wsl.conf`
|
||||||
|
2. Lisää isännän nimi – `echo "hostname = argo.aito.tjas" > /etc/wsl.conf`
|
||||||
|
3. Lisää Hosts tiedoston generointi – `echo "generateHosts = true" > /etc/wsl.conf`
|
||||||
|
5. Sulje ikkuna
|
||||||
|
4. Aseta Debian oletusarvoiseksi käyttöjärjestelmäksi ja käynnistä se uudelleen
|
||||||
|
1. Avaa Powershell järjestelmänvalvojana
|
||||||
|
2. Vaihda oletusarvoinen käyttöjärjestelmä – `wsl --set-default Debian`
|
||||||
|
3. Käynnistä uudelleen käyttöjärjestelmä – `wsl -t Debian`
|
||||||
|
4. Sulje ikkuna
|
||||||
|
6. Avaa Debian käynnistävalikosta tai suorita Powershellissä komento järjestelmänvalvojana `wsl -d Debian`
|
||||||
|
7. Asenna curl-paketti käyttämällä APT-paketinhallintaa – `sudo apt update && sudo apt install curl`
|
||||||
|
8. Lataa ja suorita Init.sh skripti – `bash <(curl https://raw.githubusercontent.com/cwchristerw/tjas-infra/refs/heads/master/init.sh)`
|
||||||
|
|
||||||
**Palvelimen asennus**
|
**Palvelimen asennus**
|
||||||
1. Asenna Debian-käyttöjärjestelmä
|
1. Asenna Debian-käyttöjärjestelmä
|
||||||
2. Asenna curl-paketti käyttämällä APT-paketinhallintaa – `apt update && apt install curl`
|
2. Asenna curl-paketti käyttämällä APT-paketinhallintaa – `apt update && apt install curl`
|
||||||
|
12
files/dnsdist/config.conf
Normal file
12
files/dnsdist/config.conf
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
setLocal('0.0.0.0:53')
|
||||||
|
addLocal('[::]:53')
|
||||||
|
setACL({'0.0.0.0/0', '::/0'})
|
||||||
|
setECSOverride(true)
|
||||||
|
setECSSourcePrefixV4(32)
|
||||||
|
setECSSourcePrefixV6(128)
|
||||||
|
newServer({address='127.0.0.1:531', useClientSubnet=true, pool='authorative'})
|
||||||
|
newServer({ address='127.0.0.1:532', useClientSubnet=true, pool='recursor' })
|
||||||
|
addAction('tjas', PoolAction('authorative'))
|
||||||
|
addAction(AllRule(), PoolAction('recursor'))
|
||||||
|
setSecurityPollSuffix("")
|
||||||
|
setServFailWhenNoServer(true)
|
@@ -21,4 +21,5 @@ Jääkäri Warén
|
|||||||
https://christerwaren.fi
|
https://christerwaren.fi
|
||||||
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
|
|
||||||
|
@@ -25,4 +25,5 @@ ylikirjoittaa automatisoidusti.
|
|||||||
https://github.com/cwchristerw/tjas-intra
|
https://github.com/cwchristerw/tjas-intra
|
||||||
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
local-address=0.0.0.0,::
|
local-address=0.0.0.0,::
|
||||||
local-port=53
|
local-port=531
|
||||||
default-soa-content=s1.intra.tjas no-reply.intra.tjas 0 10800 3600 604800 3600
|
default-soa-content=olympus.juva.tjas no-reply.intra.tjas 0 10800 3600 604800 3600
|
||||||
launch=gmysql
|
launch=gmysql
|
||||||
gmysql-host=127.0.0.1
|
gmysql-host=127.0.0.1
|
||||||
gmysql-port=3306
|
gmysql-port=3306
|
9
files/powerdns-recursor/config.conf
Normal file
9
files/powerdns-recursor/config.conf
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
incoming:
|
||||||
|
listen:
|
||||||
|
- 127.0.0.1:532
|
||||||
|
recursor:
|
||||||
|
forward_zones:
|
||||||
|
- zone: tjas
|
||||||
|
recurse: false
|
||||||
|
forwarders:
|
||||||
|
- 127.0.0.1:531
|
@@ -6,11 +6,17 @@
|
|||||||
# use this section when you may connect via different interfaces.
|
# use this section when you may connect via different interfaces.
|
||||||
|
|
||||||
Peers: [
|
Peers: [
|
||||||
#TRUSTED PEERS - Waren Group
|
{% if config.yggdrasil.peers is defined %}
|
||||||
#aurora.devices.waren.io
|
#TRUSTED PEERS
|
||||||
#201:361f:bbfb:7210:c5b8:3f74:a285:adb9
|
{% for peer in config.yggdrasil.peers %}
|
||||||
"tls://[2a01:4f9:2a:60c::2]:18836",
|
{% if peer.name is defined and peer.address is defined and peer.address is defined %}
|
||||||
"tls://95.216.5.243:18836",
|
|
||||||
|
#{{ peer.name }}
|
||||||
|
"{{ peer.address }}"{% if not loop.last %},{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# List of connection strings for static peers in URI format, arranged
|
# List of connection strings for static peers in URI format, arranged
|
||||||
|
61
init.sh
61
init.sh
@@ -4,63 +4,74 @@ if [ ! "$BASH_VERSION" ] ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
underline=`tput smul`
|
||||||
|
nounderline=`tput rmul`
|
||||||
|
bold=$(tput bold)
|
||||||
|
normal=$(tput sgr0)
|
||||||
|
|
||||||
ti-header(){
|
ti-header(){
|
||||||
echo $(tput bold)$1$(tput sgr0)
|
echo ${bold}$1${normal}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "${bold}"
|
||||||
echo "
|
echo "
|
||||||
==============================
|
.-') _ ('-. .-')
|
||||||
|
( OO) ) ( OO ).-. ( OO ).
|
||||||
PVJJK 1.VOS TJAS - Infra
|
/ '._ ,--. / . --. /(_)---\_)
|
||||||
Init Script
|
|'--...__) .-')| ,| | \-. \ / _ |
|
||||||
|
'--. .--'( OO |(_|.-'-' | |\ :\` \`.
|
||||||
------------------------------
|
| | | \`-'| | \| |_.' | '..\`''.)
|
||||||
|
| | ,--. | | | .-. |.-._) \\
|
||||||
|
| | | '-' / | | | |\ /
|
||||||
|
\`--' \`-----' \`--' \`--' \`-----'
|
||||||
"
|
"
|
||||||
|
echo "
|
||||||
|
PVJJK 1.VOS NIINISALO
|
||||||
|
TIETOJÄRJESTELMÄASENTAJIEN INTRA
|
||||||
|
INIT SCRIPT
|
||||||
|
"
|
||||||
|
echo -n "${normal}"
|
||||||
|
|
||||||
stop () {
|
stop () {
|
||||||
|
|
||||||
echo "
|
|
||||||
==============================
|
|
||||||
"
|
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ti-header "Haetaan pakettien tiedot..."
|
ti-header "Haetaan pakettien tiedot..."
|
||||||
apt update
|
sudo apt update
|
||||||
echo -e "\n\n"
|
echo -e "\n\n"
|
||||||
|
|
||||||
ti-header "Asennetaan PVJJK 1.VOS TJAS Infran riippuvuudet APT-paketinhallinnalla..."
|
ti-header "Asennetaan PVJJK 1.VOS TJAS Infran riippuvuudet APT-paketinhallinnalla..."
|
||||||
apt-get install -y python3-pip python3-venv jq git curl lsb-release
|
sudo apt-get install -y python3-pip python3-venv jq git curl lsb-release
|
||||||
echo -e "\n\n"
|
echo -e "\n\n"
|
||||||
|
|
||||||
mkdir -p /root/.ssh/keys/pvjjk-1vos-niinisalo &> /dev/null
|
mkdir -p $HOME/.ssh/keys/pvjjk-1vos-niinisalo &> /dev/null
|
||||||
if [[ ! -f /root/.ssh/keys/pvjjk-1vos-niinisalo/infra ]]
|
if [[ ! -f $HOME/.ssh/keys/pvjjk-1vos-niinisalo/infra ]]
|
||||||
then
|
then
|
||||||
ti-header "Generoidaan SSH-avain Infra-repon käyttöön..."
|
ti-header "Generoidaan SSH-avain Infra-repon käyttöön..."
|
||||||
ssh-keygen -f /root/.ssh/keys/pvjjk-1vos-niinisalo/infra -t ed25519 -N '' -C $(hostname --fqdn)
|
ssh-keygen -f $HOME/.ssh/keys/pvjjk-1vos-niinisalo/infra -t ed25519 -N '' -C $(hostname --fqdn)
|
||||||
echo -e "\n\n"
|
echo -e "\n\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ti-header "Luodaan Ansiblelle virtuaalinen ympäristö..."
|
ti-header "Luodaan Ansiblelle virtuaalinen ympäristö..."
|
||||||
python3 -m venv /root/.venv/ansible
|
python3 -m venv $HOME/.venv/ansible
|
||||||
echo -e "\n\n"
|
echo -e "\n\n"
|
||||||
|
|
||||||
ti-header "Asennetaan Ansiblen riippuvuudet..."
|
ti-header "Asennetaan Ansiblen riippuvuudet..."
|
||||||
/root/.venv/ansible/bin/pip3 install cryptography dnspython hvac jmespath netaddr pexpect
|
$HOME/.venv/ansible/bin/pip3 install cryptography dnspython hvac jmespath netaddr pexpect
|
||||||
echo -e "\n\n"
|
echo -e "\n\n"
|
||||||
|
|
||||||
ti-header "Asennetaan Ansible..."
|
ti-header "Asennetaan Ansible..."
|
||||||
/root/.venv/ansible/bin/pip3 install ansible
|
$HOME/.venv/ansible/bin/pip3 install ansible
|
||||||
echo -e "\n\n"
|
echo -e "\n\n"
|
||||||
|
|
||||||
ti-header "Asennetaan Ansible kokoelmat..."
|
ti-header "Asennetaan Ansible kokoelmat..."
|
||||||
/root/.venv/ansible/bin/ansible-galaxy collection install ansible.posix containers.podman --upgrade
|
$HOME/.venv/ansible/bin/ansible-galaxy collection install ansible.posix containers.podman --upgrade
|
||||||
echo -e "\n\n"
|
echo -e "\n\n"
|
||||||
|
|
||||||
ti-header "Lisää SSH-avain Infra-repon käyttöön..."
|
ti-header "Lisää SSH-avain Infra-repon käyttöön..."
|
||||||
cat /root/.ssh/keys/pvjjk-1vos-niinisalo/infra.pub
|
cat $HOME/.ssh/keys/pvjjk-1vos-niinisalo/infra.pub
|
||||||
|
|
||||||
echo -n "Onko avain lisätty Github-repoon? [K/E]"
|
echo -n "Onko avain lisätty Github-repoon? [K/E]"
|
||||||
while [[ -z $SSHKEY_QUESTION || ! -z $SSHKEY_QUESTION && $SSHKEY_QUESTION != "K" ]]
|
while [[ -z $SSHKEY_QUESTION || ! -z $SSHKEY_QUESTION && $SSHKEY_QUESTION != "K" ]]
|
||||||
@@ -69,8 +80,8 @@ do
|
|||||||
done
|
done
|
||||||
echo -e "\n\n"
|
echo -e "\n\n"
|
||||||
|
|
||||||
mkdir -p /root/.ansible/vault &> /dev/null
|
mkdir -p $HOME/.ansible/vault &> /dev/null
|
||||||
if [[ ! -f /root/.ansible/vault/pvjjk-1vos-niinisalo ]]
|
if [[ ! -f $HOME/.ansible/vault/pvjjk-1vos-niinisalo ]]
|
||||||
then
|
then
|
||||||
ti-header "Syötä Ansible Vaultin salasana..."
|
ti-header "Syötä Ansible Vaultin salasana..."
|
||||||
echo -n "Salasana: "
|
echo -n "Salasana: "
|
||||||
@@ -80,14 +91,14 @@ then
|
|||||||
|
|
||||||
if [[ ! -z $VAULT_PASSWORD ]]
|
if [[ ! -z $VAULT_PASSWORD ]]
|
||||||
then
|
then
|
||||||
echo "$VAULT_PASSWORD" > /root/.ansible/vault/pvjjk-1vos-niinisalo
|
echo "$VAULT_PASSWORD" > $HOME/.ansible/vault/pvjjk-1vos-niinisalo
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo -e "\n\n"
|
echo -e "\n\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ti-header "Suoritetaan Infran asennus..."
|
ti-header "Suoritetaan Infran asennus..."
|
||||||
/root/.venv/ansible/bin/ansible-pull -U ssh://git@github.com/cwchristerw/tjas-infra -d /root/.ansible/pull/pvjjk-1vos-niinisalo/infra --accept-host-key --private-key /root/.ssh/keys/pvjjk-1vos-niinisalo/infra --vault-password-file /root/.ansible/vault/pvjjk-1vos-niinisalo tasks.yml -t installer
|
$HOME/.venv/ansible/bin/ansible-pull -U ssh://git@github.com/cwchristerw/tjas-infra -d $HOME/.ansible/pull/pvjjk-1vos-niinisalo/infra --accept-host-key --private-key $HOME/.ssh/keys/pvjjk-1vos-niinisalo/infra --vault-password-file $HOME/.ansible/vault/pvjjk-1vos-niinisalo tasks.yml -t installer
|
||||||
echo -e "\n\n"
|
echo -e "\n\n"
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
|
@@ -0,0 +1,6 @@
|
|||||||
|
$ANSIBLE_VAULT;1.2;AES256;pvjjk-1vos-niinisalo
|
||||||
|
30383633646132396336336135366264386137643166376336666261316465346632353333616361
|
||||||
|
3134623361333633653666313035633536396662613234320a386239373636623061383331663438
|
||||||
|
64366431613763376239613036633365346266643163396331653237313662346231623731373530
|
||||||
|
6630653939373762380a363939383862623336666361303032653431356139383766663331656335
|
||||||
|
3438
|
@@ -0,0 +1,6 @@
|
|||||||
|
$ANSIBLE_VAULT;1.2;AES256;pvjjk-1vos-niinisalo
|
||||||
|
37353031396164353032396635313539613734613432323435383137303835383439663439363337
|
||||||
|
6230323066313361383061633932616230363465326239640a333739323064653263336337633639
|
||||||
|
64343833623362323734363239653866383037313331613738653133636364623237326637313232
|
||||||
|
3462636261386230380a313634313965343733616137663532623965393835306562633635633831
|
||||||
|
3166
|
@@ -1,42 +1,51 @@
|
|||||||
$ANSIBLE_VAULT;1.2;AES256;pvjjk-1vos-niinisalo
|
$ANSIBLE_VAULT;1.2;AES256;pvjjk-1vos-niinisalo
|
||||||
33353437353561323566336635356239333339343163306335613265633931323164633966633432
|
30386163316331336461633036653363613064366361653938616138353736366463643664393933
|
||||||
3334663031336637356131353161303136333063396561330a346633303561623137323964306630
|
6533383232616130626431353164663738346630616465300a393062663634356566656562646137
|
||||||
66663134396266386665386566643033613364613038626562343134376235383466363966653864
|
36623535313932316262663064366535616565386436653761336463323163646439656563303262
|
||||||
6539646166353836340a633539663236386337636433333334346633646536653335336532303132
|
6531373030393264310a623933386234306532643664363335386231626664643531656433323731
|
||||||
36373030613335623465386233376338623263326461373638336538626538356462663138333736
|
30373237626531336431343965313239616339356162383262313363363262613463303236643734
|
||||||
62326639653739373438636466633461386238363630623262626361383636396665373765313231
|
62303636646232383235316137393634626235386662616339343231626661376331396138343361
|
||||||
62376236626161386265313932643361306538343535663161366538653037633661323134386661
|
31663630306431653532666463326536636365663163663162643136366363333638333930373234
|
||||||
61663433343837653732313435646263353835366561383734383162363861653261636534393661
|
36306166366533636562363063336436333465393231316363343864373335646437373561353538
|
||||||
31363934616239333364373961393238343161616565326135663831353837633033613432323835
|
31613162643664633435363831326230373635313165633566323135303263323034636265393163
|
||||||
37376134663937613234373664343264303636323363613466346161303266373239646362393334
|
62373234613334393261356464643262616132343963383165303534346335373634396161383532
|
||||||
31313932623234636436643132643439313434363231646230663432356436316264373339373564
|
31623330373935613866336135323038343030353865373863633562303134613662353762376134
|
||||||
62636437663563363562303663383831333035643765313332393338316163626537656638363739
|
61653035313965316134666534366435663333386235636266376164663731646365626135613166
|
||||||
62303633663164633566343362656462353737303935313837613738316564656639383537613737
|
39333934653563623966366466613436313635313537363337386133356433356336303938333366
|
||||||
63633863663864326339386537633330383235373866643563396139313638643831396264336138
|
66653735636462383666396332656333666234333435333062356338383034656637323438316134
|
||||||
37343238386234623962643130306666316361653537306466653133333437616533643535366638
|
62386136663962336232623663666438333931376561303964636563306664313134373338303339
|
||||||
63386236653535396133313430306231613938303462386134613230303432346537396133623134
|
32313635643136396365383834343438633463366262366330653034333332653038356331346566
|
||||||
64646261353561656664333132646364303732656234303237316635376239646635333435323766
|
30336164393136383434646636376239656162643734643735306436303961326565346566333461
|
||||||
61643136623339373463393032363462353963623535616230623366613163323538333461363937
|
33383861356537656262646131386134303165636632343134383264353466316633663732396334
|
||||||
64373132313837623435323830633038386664333262353734333637303761663933393732323463
|
33373664633239396234366534636365346631643063373836666233626565626234363433313866
|
||||||
65613464643766373034333261373233353132356466343066306538656537303434306633643530
|
31663464346264393731623364373035616134376430333764383836353132386339636537326637
|
||||||
63323930643562663032633062343335333266393931663661643731346563386161623263323935
|
36366662333336373633653330353939396239623037653862393932373932353834373339373934
|
||||||
34386461333566623535656335623338316563386232356462623566613363333539316536613234
|
61663338666164663235653337336238626462653336313532643131383638336535376232303465
|
||||||
31366533333962643735393733326134313932326565346166333064616633363964326637653761
|
64363530393065383639663731383036613338343436313937663162643434323835353363653738
|
||||||
33396435313663633237366166613936383335326231393738663166326664633161623532326636
|
62613139343934656135313832323532623263653038353166313531643036303538613436323664
|
||||||
32343130383438633732613863366562386131326538643838663364363434656533623566663334
|
33356434623633643462326564383263323833376165366536633264656366353137316265653534
|
||||||
63396563626430343437346636663530363933356365633637326634656530326431653335366631
|
36656561353634626330636363636133356265306336623737643961663061343630383330386538
|
||||||
33333136306136396639326566303336646635653435356430663631646666633164646535303830
|
63636434303066646261636338323563373663323835386563393539616663636139356536393462
|
||||||
64313565323134366566343939626638646230336131373166383935313062373630646665343633
|
37363766356138616232333162666562333261626661646538613862306264336636396562313665
|
||||||
31623938363763653364643763353462356537616638306338643165353164306139303134663361
|
35373266366134623263663363376630343263623335666663396438663238636534393130623134
|
||||||
32376331313531326664303563336338393836383665323762336564366438623066643962623833
|
36653465383763646563386361636530393366323538336532393661306362346333353661303334
|
||||||
66363466613539626431373335636533313536303231666435333132383030643836633361343930
|
32633966303964383861653365626332316135373731393935313262383164346233353765396561
|
||||||
62393337373831393061656434393635656537633432636562333237633963643964336331666130
|
33323864306336353732623937386235646366663764653965633764643864366331666262386639
|
||||||
62316530316235393765306666353739663434356664343363633036366166363836356530343437
|
66326335326562646630346435663533313335373034663565333839323961383366643263356133
|
||||||
30336632373765353231636261393839323531613139346338313437626565646331336638373262
|
64303030366263356231343530343566623935306431653866613165393633643835653330666436
|
||||||
63643663616236646532663562663536646364303231356236326136646665393739326535636363
|
38663535373666333763386436646337656133303262396237663931323864336630646466306462
|
||||||
65626136356138373530623137396637623438383338623466323835326137356264666532313566
|
65656536336533343065316637613034626333343837616363376263636635363866383638393234
|
||||||
36383035663763636536303830383532313638363135363539643961343038613762346638633262
|
39373030663230383865396131363638376537363362666439636235626461303930396464313532
|
||||||
65343833363761373431663634333663373132333635363332383861366134643439383038336563
|
63306136613265636438333764646465306565333435666233656534656538646465636263363433
|
||||||
61626263336264373933313662383362373562656639356138616639663033306464643531356339
|
37356131353530363665336564386264616235613564363065356234336537363561313666653637
|
||||||
31343764383234336464383561333635623238363331383164366162336332343165323933313966
|
35336638623730633735643465316164323739316636353762653965633831626561313532626139
|
||||||
3831
|
62303933376637376334666362306133383035376561333361326338663762363230303533363632
|
||||||
|
62383539626263363636636164366139306666333165636130323765643532363338656261396135
|
||||||
|
36336664656335383561643637383066653531303236323765356666343765616134343036313538
|
||||||
|
34623935616531323536383565313238333564613635343332303238626534613337353430303864
|
||||||
|
30383131346163636335363563656465316263316439646530663665386636393261386536306265
|
||||||
|
34656230643662653665383730396335646562306161663233353835666131633730663237336434
|
||||||
|
62643631653738633638366133396364623837343138613765616362633262333333646639396637
|
||||||
|
36386533386439623866346335376164336439366133643266663938643333383836346538636536
|
||||||
|
35376335306435616236323163616163656366366630656535393233643966313166346530383365
|
||||||
|
3630646439643335393964313862363134396566636661643666
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
pvjjk_1vos_niinisalo:
|
pvjjk_1vos_niinisalo:
|
||||||
hosts:
|
hosts:
|
||||||
|
argo.aito.tjas:
|
||||||
olympus.juva.tjas:
|
olympus.juva.tjas:
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /usr/bin/python3
|
ansible_python_interpreter: /usr/bin/python3
|
||||||
|
50
protect.sh
50
protect.sh
@@ -5,23 +5,37 @@ nounderline=`tput rmul`
|
|||||||
bold=$(tput bold)
|
bold=$(tput bold)
|
||||||
normal=$(tput sgr0)
|
normal=$(tput sgr0)
|
||||||
|
|
||||||
echo "${bold}PVJJK 1.VOS 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
|
action=$1
|
||||||
|
|
||||||
encrypt() {
|
encrypt() {
|
||||||
echo "${underline}Encrypting...${nounderline}"
|
execute "ansible-vault encrypt --vault-id $1@vault/$1" $1
|
||||||
execute "ansible-vault encrypt --vault-id pvjjk-1vos-niinisalo@vault/pvjjk-1vos-niinisalo"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
decrypt() {
|
decrypt() {
|
||||||
echo "${underline}Decrypting...${nounderline}"
|
execute "ansible-vault decrypt --vault-id $1@vault/$1" $1
|
||||||
execute "ansible-vault decrypt --vault-id pvjjk-1vos-niinisalo@vault/pvjjk-1vos-niinisalo"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
list() {
|
list() {
|
||||||
echo "${underline}Listing...${nounderline}"
|
|
||||||
i=0
|
i=0
|
||||||
for file in inventories/*/group_vars/* inventories/*/host_vars/*;
|
for file in inventories/$1/group_vars/* inventories/$1/host_vars/*;
|
||||||
do
|
do
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
echo $i")"$file
|
echo $i")"$file
|
||||||
@@ -29,7 +43,8 @@ list() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
execute() {
|
execute() {
|
||||||
for file in inventories/*/group_vars/* inventories/*/host_vars/*;
|
i=0
|
||||||
|
for file in inventories/$2/group_vars/* inventories/$2/host_vars/*;
|
||||||
do
|
do
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
echo $i")"$file
|
echo $i")"$file
|
||||||
@@ -40,18 +55,23 @@ for file in inventories/*/group_vars/* inventories/*/host_vars/*;
|
|||||||
|
|
||||||
case $action in
|
case $action in
|
||||||
encrypt)
|
encrypt)
|
||||||
encrypt
|
echo "${underline}Encrypting...${nounderline}"
|
||||||
|
encrypt pvjjk-1vos-niinisalo
|
||||||
;;
|
;;
|
||||||
decrypt)
|
decrypt)
|
||||||
decrypt
|
echo "${underline}Decrypting...${nounderline}"
|
||||||
|
decrypt pvjjk-1vos-niinisalo
|
||||||
;;
|
;;
|
||||||
list)
|
list)
|
||||||
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
|
esac
|
||||||
|
|
||||||
|
echo -e "\n\n\n"
|
||||||
|
@@ -10,6 +10,8 @@
|
|||||||
import_tasks: tasks/installer.yml
|
import_tasks: tasks/installer.yml
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: "{{ ansible_facts.user_dir }}/.venv/ansible/bin/python3"
|
ansible_python_interpreter: "{{ ansible_facts.user_dir }}/.venv/ansible/bin/python3"
|
||||||
|
when:
|
||||||
|
- inventory_hostname == "olympus.juva.tjas"
|
||||||
tags:
|
tags:
|
||||||
- installer
|
- installer
|
||||||
- never
|
- never
|
||||||
@@ -18,6 +20,8 @@
|
|||||||
import_tasks: tasks/maintenance.yml
|
import_tasks: tasks/maintenance.yml
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: "{{ ansible_facts.user_dir }}/.venv/ansible/bin/python3"
|
ansible_python_interpreter: "{{ ansible_facts.user_dir }}/.venv/ansible/bin/python3"
|
||||||
|
when:
|
||||||
|
- inventory_hostname == "olympus.juva.tjas"
|
||||||
tags:
|
tags:
|
||||||
- maintenance
|
- maintenance
|
||||||
- never
|
- never
|
||||||
@@ -26,6 +30,8 @@
|
|||||||
import_tasks: tasks/deployer.yml
|
import_tasks: tasks/deployer.yml
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: "{{ ansible_facts.user_dir }}/.venv/ansible/bin/python3"
|
ansible_python_interpreter: "{{ ansible_facts.user_dir }}/.venv/ansible/bin/python3"
|
||||||
|
when:
|
||||||
|
- inventory_hostname == "olympus.juva.tjas"
|
||||||
tags:
|
tags:
|
||||||
- deployer
|
- deployer
|
||||||
- never
|
- never
|
||||||
|
@@ -58,7 +58,6 @@
|
|||||||
containers.podman.podman_image:
|
containers.podman.podman_image:
|
||||||
name: docker.io/library/golang
|
name: docker.io/library/golang
|
||||||
tag: alpine
|
tag: alpine
|
||||||
# force: true
|
|
||||||
register: deployerTaskY2
|
register: deployerTaskY2
|
||||||
|
|
||||||
- name: "Deployer - Yggdrasil - Clone Repository"
|
- name: "Deployer - Yggdrasil - Clone Repository"
|
||||||
@@ -108,7 +107,6 @@
|
|||||||
containers.podman.podman_image:
|
containers.podman.podman_image:
|
||||||
name: docker.io/library/mariadb
|
name: docker.io/library/mariadb
|
||||||
tag: latest
|
tag: latest
|
||||||
# force: true
|
|
||||||
register: deployerTaskM1
|
register: deployerTaskM1
|
||||||
|
|
||||||
- name: "Deployer - MariaDB - Run Container"
|
- name: "Deployer - MariaDB - Run Container"
|
||||||
@@ -216,7 +214,7 @@
|
|||||||
|
|
||||||
- name: "Deployer - Kea - Configure - Database : Init"
|
- name: "Deployer - Kea - Configure - Database : Init"
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: "kea-admin db-init mysql -h 127.0.0.1 -n {{ config.mariadb.users['kea'].database }} -u {{ config.mariadb.users['kea'].username }} -p {{ config.mariadb.users['kea'].password }}"
|
cmd: "/usr/sbin/kea-admin db-init mysql -h 127.0.0.1 -n {{ config.mariadb.users['kea'].database }} -u {{ config.mariadb.users['kea'].username }} -p {{ config.mariadb.users['kea'].password }}"
|
||||||
register: deployerTaskK2
|
register: deployerTaskK2
|
||||||
changed_when:
|
changed_when:
|
||||||
- deployerTaskK2.stdout.find('Initializing database') != -1
|
- deployerTaskK2.stdout.find('Initializing database') != -1
|
||||||
@@ -229,7 +227,7 @@
|
|||||||
|
|
||||||
- name: "Deployer - Kea - Configure - Database : Upgrade"
|
- name: "Deployer - Kea - Configure - Database : Upgrade"
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: "kea-admin db-upgrade mysql -h 127.0.0.1 -n {{ config.mariadb.users['kea'].database }} -u {{ config.mariadb.users['kea'].username }} -p {{ config.mariadb.users['kea'].password }}"
|
cmd: "/usr/sbin/kea-admin db-upgrade mysql -h 127.0.0.1 -n {{ config.mariadb.users['kea'].database }} -u {{ config.mariadb.users['kea'].username }} -p {{ config.mariadb.users['kea'].password }}"
|
||||||
tags:
|
tags:
|
||||||
- kea
|
- kea
|
||||||
- dhcp
|
- dhcp
|
||||||
@@ -252,62 +250,185 @@
|
|||||||
- kea
|
- kea
|
||||||
- dhcp
|
- dhcp
|
||||||
|
|
||||||
- name: "Deployer - PowerDNS - Configure - Create Folder"
|
|
||||||
|
- name: "Deployer - dnsdist - Configure - Create Folder"
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "/root/data/powerdns/"
|
path: "/root/data/dnsdist/"
|
||||||
state: directory
|
state: directory
|
||||||
tags:
|
tags:
|
||||||
- powerdns
|
- dnsdist
|
||||||
- dns
|
- dns
|
||||||
|
|
||||||
- name: "Deployer - PowerDNS - Configure - Create Subfolders"
|
- name: "Deployer - dnsdist - Configure - Create Subfolders"
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
dest: '/root/data/powerdns/{{ item.path }}'
|
dest: '/root/data/dnsdist/{{ item.path }}'
|
||||||
state: directory
|
state: directory
|
||||||
with_filetree: './files/powerdns/'
|
with_filetree: './files/dnsdist/'
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.path }}"
|
label: "{{ item.path }}"
|
||||||
when:
|
when:
|
||||||
- item.state == 'directory'
|
- item.state == 'directory'
|
||||||
tags:
|
tags:
|
||||||
- powerdns
|
- dnsdist
|
||||||
- dns
|
- dns
|
||||||
|
|
||||||
- name: "Deployer - PowerDNS - Configure - Generating & Transferring Files"
|
- name: "Deployer - dnsdist - Configure - Generating & Transferring Files"
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: '{{ item.src }}'
|
src: '{{ item.src }}'
|
||||||
dest: '/root/data/powerdns/{{ item.path }}'
|
dest: '/root/data/dnsdist/{{ item.path }}'
|
||||||
register: deployerTaskP1
|
register: deployerTaskD1
|
||||||
with_filetree: './files/powerdns/'
|
with_filetree: './files/dnsdist/'
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.path }}"
|
label: "{{ item.path }}"
|
||||||
when:
|
when:
|
||||||
- item.state == 'file'
|
- item.state == 'file'
|
||||||
tags:
|
tags:
|
||||||
- powerdns
|
- dnsdist
|
||||||
- dns
|
- dns
|
||||||
|
|
||||||
- name: "Deployer - PowerDNS - Pull Image"
|
- name: "Deployer - dnsdist - Pull Image"
|
||||||
containers.podman.podman_image:
|
containers.podman.podman_image:
|
||||||
name: docker.io/powerdns/pdns-auth-49
|
name: docker.io/powerdns/dnsdist-20
|
||||||
tag: latest
|
tag: latest
|
||||||
# force: true
|
register: deployerTaskD2
|
||||||
register: deployerTaskP2
|
|
||||||
|
|
||||||
- name: "Deployer - PowerDNS - Run Container"
|
- name: "Deployer - dnsdist - Run Container"
|
||||||
containers.podman.podman_container:
|
containers.podman.podman_container:
|
||||||
name: powerdns
|
name: dnsdist
|
||||||
image: docker.io/powerdns/pdns-auth-49:latest
|
image: docker.io/powerdns/dnsdist-20:latest
|
||||||
state: started
|
state: started
|
||||||
recreate: on
|
recreate: on
|
||||||
network: host
|
network: host
|
||||||
restart_policy: always
|
restart_policy: always
|
||||||
volumes:
|
volumes:
|
||||||
- "/root/data/powerdns/config.conf:/etc/powerdns/pdns.conf:ro"
|
- "/root/data/dnsdist/config.conf:/etc/dnsdist/dnsdist.conf:ro"
|
||||||
|
tty: yes
|
||||||
|
interactive: yes
|
||||||
|
capabilities:
|
||||||
|
- NET_BIND_SERVICE
|
||||||
when:
|
when:
|
||||||
- (deployerTaskP1 is defined and deployerTaskP1.changed) or deployerTaskP1 is undefined or (deployerTaskP2 is defined and deployerTaskP2.changed) or deployerTaskP2 is undefined
|
- (deployerTaskD1 is defined and deployerTaskD1.changed) or deployerTaskD1 is undefined or (deployerTaskD2 is defined and deployerTaskD2.changed) or deployerTaskD2 is undefined
|
||||||
tags:
|
tags:
|
||||||
- powerdns
|
- dnsdist
|
||||||
|
- dns
|
||||||
|
|
||||||
|
- name: "Deployer - PowerDNS Authorative - Configure - Create Folder"
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "/root/data/powerdns-authorative/"
|
||||||
|
state: directory
|
||||||
|
tags:
|
||||||
|
- powerdns-authorative
|
||||||
|
- dns
|
||||||
|
|
||||||
|
- name: "Deployer - PowerDNS Authorative - Configure - Create Subfolders"
|
||||||
|
ansible.builtin.file:
|
||||||
|
dest: '/root/data/powerdns-authorative/{{ item.path }}'
|
||||||
|
state: directory
|
||||||
|
with_filetree: './files/powerdns-authorative/'
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.path }}"
|
||||||
|
when:
|
||||||
|
- item.state == 'directory'
|
||||||
|
tags:
|
||||||
|
- powerdns-authorative
|
||||||
|
- dns
|
||||||
|
|
||||||
|
- name: "Deployer - PowerDNS Authorative - Configure - Generating & Transferring Files"
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: '{{ item.src }}'
|
||||||
|
dest: '/root/data/powerdns-authorative/{{ item.path }}'
|
||||||
|
register: deployerTaskPA1
|
||||||
|
with_filetree: './files/powerdns-authorative/'
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.path }}"
|
||||||
|
when:
|
||||||
|
- item.state == 'file'
|
||||||
|
tags:
|
||||||
|
- powerdns-authorative
|
||||||
|
- dns
|
||||||
|
|
||||||
|
- name: "Deployer - PowerDNS Authorative - Pull Image"
|
||||||
|
containers.podman.podman_image:
|
||||||
|
name: docker.io/powerdns/pdns-auth-50
|
||||||
|
tag: latest
|
||||||
|
register: deployerTaskPA2
|
||||||
|
|
||||||
|
- name: "Deployer - PowerDNS Authorative - Run Container"
|
||||||
|
containers.podman.podman_container:
|
||||||
|
name: powerdns-authorative
|
||||||
|
image: docker.io/powerdns/pdns-auth-50:latest
|
||||||
|
state: started
|
||||||
|
recreate: on
|
||||||
|
network: host
|
||||||
|
restart_policy: always
|
||||||
|
volumes:
|
||||||
|
- "/root/data/powerdns-authorative/config.conf:/etc/powerdns/pdns.conf:ro"
|
||||||
|
capabilities:
|
||||||
|
- NET_BIND_SERVICE
|
||||||
|
when:
|
||||||
|
- (deployerTaskPA1 is defined and deployerTaskPA1.changed) or deployerTaskPA1 is undefined or (deployerTaskPA2 is defined and deployerTaskPA2.changed) or deployerTaskPA2 is undefined
|
||||||
|
tags:
|
||||||
|
- powerdns-authorative
|
||||||
|
- dns
|
||||||
|
|
||||||
|
|
||||||
|
- name: "Deployer - PowerDNS Recursor - Configure - Create Folder"
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "/root/data/powerdns-recursor/"
|
||||||
|
state: directory
|
||||||
|
tags:
|
||||||
|
- powerdns-recursor
|
||||||
|
- dns
|
||||||
|
|
||||||
|
- name: "Deployer - PowerDNS Recursor - Configure - Create Subfolders"
|
||||||
|
ansible.builtin.file:
|
||||||
|
dest: '/root/data/powerdns-recursor/{{ item.path }}'
|
||||||
|
state: directory
|
||||||
|
with_filetree: './files/powerdns-recursor/'
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.path }}"
|
||||||
|
when:
|
||||||
|
- item.state == 'directory'
|
||||||
|
tags:
|
||||||
|
- powerdns-recursor
|
||||||
|
- dns
|
||||||
|
|
||||||
|
- name: "Deployer - PowerDNS Recursor - Configure - Generating & Transferring Files"
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: '{{ item.src }}'
|
||||||
|
dest: '/root/data/powerdns-recursor/{{ item.path }}'
|
||||||
|
register: deployerTaskPR1
|
||||||
|
with_filetree: './files/powerdns-recursor/'
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.path }}"
|
||||||
|
when:
|
||||||
|
- item.state == 'file'
|
||||||
|
tags:
|
||||||
|
- powerdns-recursor
|
||||||
|
- dns
|
||||||
|
|
||||||
|
- name: "Deployer - PowerDNS Recursor - Pull Image"
|
||||||
|
containers.podman.podman_image:
|
||||||
|
name: docker.io/powerdns/pdns-recursor-52
|
||||||
|
tag: latest
|
||||||
|
register: deployerTaskPR2
|
||||||
|
|
||||||
|
- name: "Deployer - PowerDNS Recursor - Run Container"
|
||||||
|
containers.podman.podman_container:
|
||||||
|
name: powerdns-recursor
|
||||||
|
image: docker.io/powerdns/pdns-recursor-52:latest
|
||||||
|
state: started
|
||||||
|
recreate: on
|
||||||
|
network: host
|
||||||
|
restart_policy: always
|
||||||
|
volumes:
|
||||||
|
- "/root/data/powerdns-recursor/config.conf:/etc/powerdns/recursor.conf:ro"
|
||||||
|
capabilities:
|
||||||
|
- NET_BIND_SERVICE
|
||||||
|
when:
|
||||||
|
- (deployerTaskPR1 is defined and deployerTaskPR1.changed) or deployerTaskPR1 is undefined or (deployerTaskPR2 is defined and deployerTaskPR2.changed) or deployerTaskPR2 is undefined
|
||||||
|
tags:
|
||||||
|
- powerdns-recursor
|
||||||
- dns
|
- dns
|
||||||
|
|
||||||
- name: "Deployer - Nginx - Configure - Create Folder"
|
- name: "Deployer - Nginx - Configure - Create Folder"
|
||||||
@@ -349,7 +470,6 @@
|
|||||||
containers.podman.podman_image:
|
containers.podman.podman_image:
|
||||||
name: docker.io/library/nginx
|
name: docker.io/library/nginx
|
||||||
tag: latest
|
tag: latest
|
||||||
# force: true
|
|
||||||
register: deployerTaskN2
|
register: deployerTaskN2
|
||||||
|
|
||||||
- name: "Deployer - Nginx - Run Container"
|
- name: "Deployer - Nginx - Run Container"
|
||||||
|
Reference in New Issue
Block a user