From 7ae8de883bb84bee30d6d45df0bcc8fe9ce82d0c Mon Sep 17 00:00:00 2001 From: Wendell Jones Date: Thu, 23 Apr 2026 08:07:39 -0400 Subject: [PATCH] Add playbook to backup up postgresql Co-authored-by: Copilot --- beszel_install_old.yaml | 33 --------------------------------- postgres_backup.yaml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 33 deletions(-) delete mode 100644 beszel_install_old.yaml create mode 100644 postgres_backup.yaml diff --git a/beszel_install_old.yaml b/beszel_install_old.yaml deleted file mode 100644 index 7ec36b7..0000000 --- a/beszel_install_old.yaml +++ /dev/null @@ -1,33 +0,0 @@ ---- -- hosts: debianhosts - tasks: - - name: change working directory - ansible.builtin.shell: - cmd: ls -l - chdir: /tmp - - - name: Get beszel agent install script - become: yes - get_url: - url: https://get.beszel.dev - dest: /tmp/install-agent.sh - - - name: Change file ownership, group and permissions - ansible.builtin.file: - path: /tmp/install-agent.sh - # owner: root - # group: root - mode: '0755' - - - name: Execute beszel agent install script - ansible.builtin.shell: - cmd: /tmp/install-agent.sh -p 45876 -k "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEhA2xm3yiEqzi5dn8UerbbhZTkU538O1g1KF2d7LefT" #stopping here as this command requires input. - - - name: Add beszel agent key - ansible.builtin.shell: - cmd: echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEhA2xm3yiEqzi5dn8UerbbhZTkU538O1g1KF2d7LefT" >> /root/.ssh/authorized_keys - -- 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 \ No newline at end of file diff --git a/postgres_backup.yaml b/postgres_backup.yaml new file mode 100644 index 0000000..59cca00 --- /dev/null +++ b/postgres_backup.yaml @@ -0,0 +1,33 @@ +--- +- 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: +# dest: + +# - name: Change file ownership, group and permissions +# ansible.builtin.file: +# path: +# # owner: root +# # group: root +# mode: '0755' + + - name: Execute beszel agent install script + ansible.builtin.shell: + cmd: su - postgres -c /usr/local/bin/pg_basebackup.sh + + - name: Add beszel agent key + 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 \ No newline at end of file