feat(ci): использовать готовый локальный образ homelab-ansible:latest, поддержать смену домена в .env
This commit is contained in:
1 parent
cd5ffb9804
commit
09f5afe564
3 files changed
+19
-10
No files matched your search
@@ -0,0 +1,15 @@
|
|||||||
|
FROM ubuntu:24.04
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
git \
|
||||||
|
openssh-client \
|
||||||
|
ansible-core \
|
||||||
|
python3 \
|
||||||
|
sshpass \
|
||||||
|
ca-certificates \
|
||||||
|
curl \
|
||||||
|
&& ansible-galaxy collection install ansible.posix \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
@@ -11,6 +11,8 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
install:
|
install:
|
||||||
runs-on: homelab
|
runs-on: homelab
|
||||||
|
container:
|
||||||
|
image: homelab-ansible:latest
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Запустить плейбук NetBird
|
- name: Запустить плейбук NetBird
|
||||||
@@ -28,14 +30,6 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(id -u)" -eq 0 ]; then
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y git openssh-client ansible-core python3 sshpass
|
|
||||||
else
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y git openssh-client ansible-core python3 sshpass
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -rf "${HOME}/homelab-infra"
|
rm -rf "${HOME}/homelab-infra"
|
||||||
git clone https://gitea.gunihome.ru/karpenok/homelab-infra.git "${HOME}/homelab-infra"
|
git clone https://gitea.gunihome.ru/karpenok/homelab-infra.git "${HOME}/homelab-infra"
|
||||||
sha="${GITHUB_SHA:-${GITEA_SHA:-}}"
|
sha="${GITHUB_SHA:-${GITEA_SHA:-}}"
|
||||||
@@ -50,7 +44,6 @@ jobs:
|
|||||||
trap 'rm -f "${HOME}/.ssh/id_ed25519"' EXIT
|
trap 'rm -f "${HOME}/.ssh/id_ed25519"' EXIT
|
||||||
|
|
||||||
cd "${HOME}/homelab-infra"
|
cd "${HOME}/homelab-infra"
|
||||||
ansible-galaxy collection install -r requirements.yml
|
|
||||||
|
|
||||||
ansible-playbook playbooks/site.yml \
|
ansible-playbook playbooks/site.yml \
|
||||||
-i inventories/prod/hosts.yml \
|
-i inventories/prod/hosts.yml \
|
||||||
|
|||||||
@@ -84,7 +84,8 @@
|
|||||||
mode: "0600"
|
mode: "0600"
|
||||||
no_log: true
|
no_log: true
|
||||||
notify: Перезапустить NetBird
|
notify: Перезапустить NetBird
|
||||||
when: not netbird_env.stat.exists
|
tags:
|
||||||
|
- config
|
||||||
|
|
||||||
- name: Положить манифест панели
|
- name: Положить манифест панели
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
|
|||||||
Reference in new issue
Block a user