chore: add current provisioning state before migration
This commit is contained in:
parent
a9703b4748
commit
50745b0f22
660 changed files with 88126 additions and 0 deletions
40
taskservs/resolv/default/env-resolv.j2
Normal file
40
taskservs/resolv/default/env-resolv.j2
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{%- if taskserv.name == "resolv" %}
|
||||
HOSTNAME="{{server.hostname}}"
|
||||
{% if server.ip_addresses.pub %}
|
||||
PUB_IP="{{server.ip_addresses.pub}}"
|
||||
{% else %}
|
||||
PUB_IP=""
|
||||
{% endif %}
|
||||
{% if server.ip_addresses.priv %}
|
||||
PRIV_IP="{{server.ip_addresses.priv}}"
|
||||
{% else %}
|
||||
PRIV_IP=""
|
||||
{% endif %}
|
||||
NAMESERVERS="{%- for item in taskserv.nameservers -%}
|
||||
{%- if item.ns_ip is starting_with("$servers") -%}
|
||||
{% set arr_ns = item.ns_ip | split(pat=".") %}
|
||||
{% set pos = arr_ns[1] %}
|
||||
{% set ip = arr_ns[2] %}
|
||||
{%- if defs.servers[pos] and ip == "$network_private_ip" and defs.servers[pos].network_private_ip -%}
|
||||
{{defs.servers[pos].network_private_ip}}
|
||||
{%- elif defs.servers[pos] and ip == "$network_public_ip" and defs.servers[pos].ip_addresses.pub -%}
|
||||
{{defs.servers[pos].ip_addresses.pub}}
|
||||
{%- endif -%}
|
||||
{%- else %}
|
||||
{{item.ns_ip}}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
"
|
||||
{% if server.main_domain == "$defaults" or server.main_domain == "" %}
|
||||
DOMAIN_NAME={{server.main_domain}}
|
||||
{%- else %}
|
||||
DOMAIN_NAME={{server.main_domain}}
|
||||
{%- endif %}
|
||||
{% if taskserv.domains_search == "$defaults" %}
|
||||
DOMAINS_SEARCH={{server.domains_search}}
|
||||
{%- elif taskserv.domains_search == "$server" %}
|
||||
DOMAINS_SEARCH={{server.domains_search}}
|
||||
{%- else %}
|
||||
DOMAINS_SEARCH={{taskserv.domains_search}}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
50
taskservs/resolv/default/install-resolv.sh
Executable file
50
taskservs/resolv/default/install-resolv.sh
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
#!/bin/bash
|
||||
# Info: Script to install Resolv packages
|
||||
# Author: JesusPerezLorenzo
|
||||
# Release: 1.0
|
||||
# Date: 30-10-2023
|
||||
USAGE="install-resolv.sh "
|
||||
|
||||
[ "$1" == "-h" ] && echo "$USAGE" && exit 1
|
||||
|
||||
_config_resolver() {
|
||||
[ -z "$NAMESERVERS" ] && return
|
||||
local resolv_cfg_path
|
||||
local resolv_cfg_file
|
||||
# if [ ! -r "/etc/resolvconf/resolv.conf.d" ] ; then
|
||||
# sudo apt install resolvconf -y
|
||||
# sudo timeout -k 10 20 systemctl enable --now resolvconf
|
||||
# sudo timeout -k 10 20 systemctl restart resolvconf
|
||||
# sudo systemctl enable resolvconf.service
|
||||
# fi
|
||||
if [ -d "/etc/resolvconf/resolv.conf.d" ] ; then
|
||||
resolv_cfg_path=/etc/resolvconf/resolv.conf.d
|
||||
resolv_cfg_file="head"
|
||||
else
|
||||
resolv_cfg_path=/etc
|
||||
resolv_cfg_file="resolv.conf"
|
||||
chattr -i "$resolv_cfg_path/$resolv_cfg_file"
|
||||
fi
|
||||
[ ! -r "$resolv_cfg_path/_$resolv_cfg_file" ] && sudo mv "$resolv_cfg_path/$resolv_cfg_file" "$resolv_cfg_path/_$resolv_cfg_file"
|
||||
grep -v "^nameserver" "$resolv_cfg_path/_$resolv_cfg_file" | sudo tee "$resolv_cfg_path/$resolv_cfg_file" &>/dev/null
|
||||
echo "
|
||||
#options rotate
|
||||
options timeout:1
|
||||
" | sudo tee -a "$resolv_cfg_path/$resolv_cfg_file" &>/dev/null
|
||||
for ns in $NAMESERVERS
|
||||
do
|
||||
echo "nameserver $ns" | sudo tee -a "$resolv_cfg_path/$resolv_cfg_file" &>/dev/null
|
||||
done
|
||||
#grep "^nameserver" "$resolv_cfg_path/_$resolv_cfg_file" | sudo tee -a "$resolv_cfg_path/$resolv_cfg_file" &>/dev/null
|
||||
[ -n "$DOMAINS_SEARCH" ] && echo "search $DOMAINS_SEARCH" | sudo tee -a "$resolv_cfg_path/$resolv_cfg_file" &>/dev/null
|
||||
if [ -d "/etc/resolvconf/resolv.conf.d" ] ; then
|
||||
sudo timeout -k 10 20 systemctl restart resolvconf
|
||||
else
|
||||
chattr +i "$resolv_cfg_path/$resolv_cfg_file"
|
||||
fi
|
||||
}
|
||||
|
||||
[ -r "./env-resolv" ] && . ./env-resolv
|
||||
# Update and add packages to installation
|
||||
[ -z "$1" ] || [ "$1" == "resolver" ] && _config_resolver
|
||||
exit 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue