refactor(remnawave): синхронизировать панель из desired.yml и шаблонов команд
ansible-deploy / plan (push) Successful in 1s
ansible-lint / lint (push) Successful in 2s
ansible-deploy / deploy (core-mon, ) (push) Successful in 37s
ansible-deploy / deploy (core-net, ) (push) Failing after 52s
ansible-deploy / deploy (core-secrets, ) (push) Successful in 24s
ansible-deploy / deploy (ger-nod-02, ) (push) Successful in 1m20s
ansible-deploy / deploy (opnsense, ) (push) Successful in 13s
ansible-deploy / deploy (rus-central, ) (push) Successful in 1m6s
ansible-deploy / plan (push) Successful in 1s
ansible-lint / lint (push) Successful in 2s
ansible-deploy / deploy (core-mon, ) (push) Successful in 37s
ansible-deploy / deploy (core-net, ) (push) Failing after 52s
ansible-deploy / deploy (core-secrets, ) (push) Successful in 24s
ansible-deploy / deploy (ger-nod-02, ) (push) Successful in 1m20s
ansible-deploy / deploy (opnsense, ) (push) Successful in 13s
ansible-deploy / deploy (rus-central, ) (push) Successful in 1m6s
Повторный прогон без смены compose не тянет образы, ноды и сквады добавляются данными, а не новым плейбуком на каждый VPS. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
89f928c64a
commit
99ee815213
22 files changed
+1151
-672
No files matched your search
@@ -12,14 +12,39 @@ before=${3:-}
|
||||
after=${4:-}
|
||||
override_tags=${5:-}
|
||||
|
||||
is_remnanode() {
|
||||
awk -v m="$1" '
|
||||
$0 ~ "^ remnanodes:" {s=1; next}
|
||||
s && $0 ~ "^ [^ ]" {s=0}
|
||||
s && $0 ~ "^ " m ":$" {f=1}
|
||||
END {exit !f}
|
||||
' ansible/inventories/prod/hosts.yml
|
||||
}
|
||||
|
||||
playbook="ansible/playbooks/${machine}.yml"
|
||||
if [ "$machine" = "site" ] || [ "$machine" = "host" ] || [ ! -f "$playbook" ]; then
|
||||
playbook_out="playbooks/${machine}.yml"
|
||||
limit=""
|
||||
if [ "$machine" = "site" ] || [ "$machine" = "host" ]; then
|
||||
echo "Неизвестная машина: $machine" >&2
|
||||
exit 2
|
||||
fi
|
||||
if [ ! -f "$playbook" ]; then
|
||||
if is_remnanode "$machine"; then
|
||||
playbook="ansible/playbooks/remnanodes.yml"
|
||||
playbook_out="playbooks/remnanodes.yml"
|
||||
limit="$machine"
|
||||
else
|
||||
echo "Неизвестная машина: $machine" >&2
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$override_tags" ]; then
|
||||
printf '%s\n' "playbooks/${machine}.yml" "--tags" "$override_tags"
|
||||
if [ -n "$limit" ]; then
|
||||
printf '%s\n' "$playbook_out" "--limit" "$limit" "--tags" "$override_tags"
|
||||
else
|
||||
printf '%s\n' "$playbook_out" "--tags" "$override_tags"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -63,9 +88,19 @@ if [ "$full" -eq 0 ] && [ -n "$changed" ]; then
|
||||
for file in $changed; do
|
||||
[ -n "$file" ] || continue
|
||||
case "$file" in
|
||||
ansible/ansible.cfg | ansible/roles/host/* | ansible/playbooks/host.yml | ansible/playbooks/site.yml | ansible/playbooks/"$machine".yml | ansible/inventories/prod/hosts.yml | ansible/inventories/prod/group_vars/* | ansible/inventories/prod/host_vars/"$machine".yml)
|
||||
ansible/ansible.cfg | ansible/roles/host/* | ansible/playbooks/host.yml | ansible/playbooks/site.yml | ansible/playbooks/"$machine".yml | ansible/inventories/prod/group_vars/* | ansible/inventories/prod/host_vars/"$machine".yml)
|
||||
full_from_files=1
|
||||
;;
|
||||
ansible/inventories/prod/hosts.yml)
|
||||
if git diff -U0 "$before" "$after" -- "$file" | grep -E "^[+-].*${machine}:" >/dev/null; then
|
||||
full_from_files=1
|
||||
fi
|
||||
;;
|
||||
ansible/playbooks/remnanodes.yml)
|
||||
if is_remnanode "$machine"; then
|
||||
full_from_files=1
|
||||
fi
|
||||
;;
|
||||
ansible/roles/netbird_client/* | ansible/roles/netbird_exit_node/*)
|
||||
if grep -qE "role: (netbird_client|netbird_exit_node)" "$playbook"; then
|
||||
add_tag netbird
|
||||
@@ -86,12 +121,19 @@ if [ "$full" -eq 0 ] && [ -n "$changed" ]; then
|
||||
add_tag vector
|
||||
fi
|
||||
;;
|
||||
ansible/roles/core-net/remnawave/files/*|\
|
||||
ansible/roles/core-net/remnawave/tasks/sync.yml|\
|
||||
ansible/roles/core-net/remnawave/tasks/publish.yml)
|
||||
if [ "$machine" = "core-net" ]; then
|
||||
add_tag remnawave_sync
|
||||
fi
|
||||
;;
|
||||
ansible/roles/"$machine"/.ci-trigger)
|
||||
;;
|
||||
ansible/roles/"$machine"/*/*)
|
||||
product=${file#ansible/roles/"$machine"/}
|
||||
product=${product%%/*}
|
||||
if grep -q "role: ${machine}/${product}" "$playbook" && grep -q "tags: \[${product}\]" "$playbook"; then
|
||||
if grep -qE "role: ${machine}/${product}|name: ${machine}/${product}" "$playbook" && grep -q "tags: \\[${product}" "$playbook"; then
|
||||
add_tag "$product"
|
||||
elif [ ! -e "$file" ] && [ ! -d "ansible/roles/${machine}/${product}" ]; then
|
||||
:
|
||||
@@ -115,5 +157,9 @@ fi
|
||||
if [ "$full" -eq 1 ] || [ "$full_from_files" -eq 1 ]; then
|
||||
printf '%s\n' "playbooks/site.yml" "--limit" "$machine"
|
||||
elif [ -n "$tags" ]; then
|
||||
printf '%s\n' "playbooks/${machine}.yml" "--tags" "$tags"
|
||||
if [ -n "$limit" ]; then
|
||||
printf '%s\n' "$playbook_out" "--limit" "$limit" "--tags" "$tags"
|
||||
else
|
||||
printf '%s\n' "$playbook_out" "--tags" "$tags"
|
||||
fi
|
||||
fi
|
||||
Reference in new issue
Block a user