Files
updates/postgres_backup.yaml
2026-04-23 12:17:45 +00:00

33 lines
1.0 KiB
YAML

---
- hosts: pghosts
tasks:
- name: change working directory
ansible.builtin.shell:
cmd: ls -l
chdir: /var/lib/postgresql
# - name: Get beszel agent install script
# become: yes
# get_url:
# url: <url>
# dest: <path>
# - name: Change file ownership, group and permissions
# ansible.builtin.file:
# path: <path>
# # owner: root
# # group: root
# mode: '0755'
- name: Executing base backup
ansible.builtin.shell:
cmd: su - postgres -c /usr/local/bin/pg_basebackup.sh
- name: Backing up individual databases
ansible.builtin.shell:
cmd: su - postgres -c /usr/local/bin/pg_backup.sh
#- hosts: windowshosts
# tasks:
# - name: Install linux beszel agent
# command: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser; & iwr -useb https://get.beszel.dev -OutFile "$env:TEMP\install-agent.ps1"; & "$env:TEMP\install-agent.ps1" -Key "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEhA2xm3yiEqzi5dn8UerbbhZTkU538O1g1KF2d7LefT" -Port 45876