infra/roles/backup/tasks/main.yml
jack 92d2c845d8
Some checks failed
CI/CD / syntax-check (push) Successful in 1m14s
CI/CD / deploy (push) Failing after 10m51s
feat: add n8n, outline routes, remove syncthing, fix backup awscli
- Add n8n to tools server (n8n.csrx.ru)
- Add cross-server Traefik routes: wiki.csrx.ru + n8n.csrx.ru → tools
- Remove Syncthing (replaced by Outline wiki)
- Fix awscli install: download static binary (apt/pip broken on Ubuntu 24.04)
- Add n8n secrets to vault (encryption key + JWT secret)
- Improve CI/CD workflow: syntax-check both playbooks, deploy both servers
- Update site.yml: unified single-command deploy for all servers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-22 06:19:39 +07:00

42 lines
1.1 KiB
YAML

---
- name: Install awscli (download static binary — works on Ubuntu 24.04)
ansible.builtin.shell: |
set -e
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
URL="https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"
else
URL="https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip"
fi
cd /tmp
curl -fsSL "$URL" -o awscliv2.zip
unzip -q -o awscliv2.zip
./aws/install --update -i /usr/local/aws-cli -b /usr/local/bin
rm -rf awscliv2.zip aws/
args:
creates: /usr/local/bin/aws
- name: Create backup directory
ansible.builtin.file:
path: "{{ backup_dir }}"
state: directory
owner: "{{ backup_user }}"
group: "{{ backup_user }}"
mode: "0750"
- name: Deploy backup script
ansible.builtin.template:
src: backup.sh.j2
dest: /usr/local/bin/backup-services
owner: root
group: root
mode: "0750"
- name: Schedule daily backup at 03:00
ansible.builtin.cron:
name: "Daily services backup"
minute: "0"
hour: "3"
job: "/usr/local/bin/backup-services >> /var/log/backup-services.log 2>&1"
user: root
state: present