Fix backup role #78

Open
gingermusketeer wants to merge 1 commit from fix-backup-role into main

check_mode is allowed in --check mode but not in run mode for some reason.

TASK [backup : Deploy systemd timer] *********************************************************************************************************************************
[ERROR]: Task failed: Module failed: Unsupported parameters for (ansible.legacy.copy) module: check_mode. Supported parameters include: _original_basename, attributes, backup, checksum, content, dest, directory_mode, follow, force, group, local_follow, mode, owner, remote_src, selevel, serole, setype, seuser, src, unsafe_writes, validate (attr).
Origin: /Users/maxbrosnahan/Projects/datakollektivet/systemer/common/roles/backup/tasks/main.yaml:62:3

60     mode: "0644"
61
62 - name: Deploy systemd timer
     ^ column 3
`check_mode` is allowed in --check mode but not in run mode for some reason. ``` TASK [backup : Deploy systemd timer] ********************************************************************************************************************************* [ERROR]: Task failed: Module failed: Unsupported parameters for (ansible.legacy.copy) module: check_mode. Supported parameters include: _original_basename, attributes, backup, checksum, content, dest, directory_mode, follow, force, group, local_follow, mode, owner, remote_src, selevel, serole, setype, seuser, src, unsafe_writes, validate (attr). Origin: /Users/maxbrosnahan/Projects/datakollektivet/systemer/common/roles/backup/tasks/main.yaml:62:3 60 mode: "0644" 61 62 - name: Deploy systemd timer ^ column 3 ```
This works in --check mode but not in run mode for some reason.
Member

Fikset dette faktisk i går på forgejo-backup branchen. check_mode nå indenteres på samme nivå som restic-backup.timer, ikke på samme nivå som mode.

Fikset dette faktisk i går på forgejo-backup branchen. check_mode nå indenteres på samme nivå som restic-backup.timer, ikke på samme nivå som mode.
@ -64,7 +64,6 @@
src: backup.timer.j2
dest: /etc/systemd/system/restic-backup.timer
mode: "0644"
check_mode: false
Member

Fjern indentation

Fjern indentation
Author
Owner

@Tormod Jeg har testet denne PR lokalt og det ser ut til å funke:

Uten endringer på templates uv run ansible-playbook --check --diff auth/playbooks/site.yaml

PLAY [Setup Restic Backup for the database] ************************************************************************************************

TASK [Gathering Facts] *********************************************************************************************************************
ok: [auth]

TASK [backup : Validate backup role inputs] ************************************************************************************************
ok: [auth] => {
    "changed": false,
    "msg": "All assertions passed"
}

TASK [backup : Install restic] *************************************************************************************************************
ok: [auth]

TASK [backup : Create backup directory] ****************************************************************************************************
ok: [auth]

TASK [backup : Deploy backup secrets] ******************************************************************************************************
ok: [auth]

TASK [backup : Initialize restic repository] ***********************************************************************************************
skipping: [auth]

TASK [backup : Deploy backup script] *******************************************************************************************************
ok: [auth]

TASK [backup : Deploy restore script] ******************************************************************************************************
ok: [auth]

TASK [backup : Deploy systemd service] *****************************************************************************************************
ok: [auth]

TASK [backup : Deploy systemd timer] *******************************************************************************************************
ok: [auth]

TASK [backup : Enable backup timer] ********************************************************************************************************
skipping: [auth]

PLAY RECAP *********************************************************************************************************************************
auth                       : ok=9    changed=0    unreachable=0    failed=0    skipped=2    rescued=0    ignored=0

Med endringer I templates uv run ansible-playbook --check --diff auth/playbooks/site.yaml

PLAY [Setup Restic Backup for the database] ************************************************************************************************

TASK [Gathering Facts] *********************************************************************************************************************
ok: [auth]

TASK [backup : Validate backup role inputs] ************************************************************************************************
ok: [auth] => {
    "changed": false,
    "msg": "All assertions passed"
}

TASK [backup : Install restic] *************************************************************************************************************
ok: [auth]

TASK [backup : Create backup directory] ****************************************************************************************************
ok: [auth]

TASK [backup : Deploy backup secrets] ******************************************************************************************************
ok: [auth]

TASK [backup : Initialize restic repository] ***********************************************************************************************
skipping: [auth]

TASK [backup : Deploy backup script] *******************************************************************************************************
--- before: /opt/backups/backup.sh
+++ after: /Users/maxbrosnahan/.ansible/tmp/ansible-local-500814fogxp6p/tmpuas2j1s3/backup.sh.j2
@@ -20,4 +20,5 @@
   restic check
 fi

-echo "$(date '+%Y-%m-%d %H:%M:%S') - Backup completed"
\ No newline at end of file
+echo "$(date '+%Y-%m-%d %H:%M:%S') - Backup completed"
+test
\ No newline at end of file

changed: [auth]

TASK [backup : Deploy restore script] ******************************************************************************************************
--- before: /opt/backups/restic-restore.sh
+++ after: /Users/maxbrosnahan/.ansible/tmp/ansible-local-500814fogxp6p/tmpjdjmcqbh/restore.sh.j2
@@ -33,3 +33,4 @@
 echo ""
 echo "To manually copy to production (CAREFUL!):"
 echo "  cp -r $RESTORE_DIR/opt/deploy/pgdumps /opt/deploy/pgdumps"
+test
\ No newline at end of file

changed: [auth]

TASK [backup : Deploy systemd service] *****************************************************************************************************
--- before: /etc/systemd/system/restic-backup.service
+++ after: /Users/maxbrosnahan/.ansible/tmp/ansible-local-500814fogxp6p/tmpoqu8wv6m/backup.service.j2
@@ -14,4 +14,5 @@
 ProtectHome=true
 NoNewPrivileges=true
 TimeoutStartSec=3000
-OOMPolicy=stop
\ No newline at end of file
+OOMPolicy=stop
+test
\ No newline at end of file

changed: [auth]

TASK [backup : Deploy systemd timer] *******************************************************************************************************
--- before: /etc/systemd/system/restic-backup.timer
+++ after: /Users/maxbrosnahan/.ansible/tmp/ansible-local-500814fogxp6p/tmp0rbl6r00/backup.timer.j2
@@ -8,3 +8,4 @@

 [Install]
 WantedBy=timers.target
+test
\ No newline at end of file

changed: [auth]

TASK [backup : Enable backup timer] ********************************************************************************************************
skipping: [auth]

PLAY RECAP *********************************************************************************************************************************
auth                       : ok=9    changed=4    unreachable=0    failed=0    skipped=2    rescued=0    ignored=0
@Tormod Jeg har testet denne PR lokalt og det ser ut til å funke: ## Uten endringer på templates `uv run ansible-playbook --check --diff auth/playbooks/site.yaml` ``` PLAY [Setup Restic Backup for the database] ************************************************************************************************ TASK [Gathering Facts] ********************************************************************************************************************* ok: [auth] TASK [backup : Validate backup role inputs] ************************************************************************************************ ok: [auth] => { "changed": false, "msg": "All assertions passed" } TASK [backup : Install restic] ************************************************************************************************************* ok: [auth] TASK [backup : Create backup directory] **************************************************************************************************** ok: [auth] TASK [backup : Deploy backup secrets] ****************************************************************************************************** ok: [auth] TASK [backup : Initialize restic repository] *********************************************************************************************** skipping: [auth] TASK [backup : Deploy backup script] ******************************************************************************************************* ok: [auth] TASK [backup : Deploy restore script] ****************************************************************************************************** ok: [auth] TASK [backup : Deploy systemd service] ***************************************************************************************************** ok: [auth] TASK [backup : Deploy systemd timer] ******************************************************************************************************* ok: [auth] TASK [backup : Enable backup timer] ******************************************************************************************************** skipping: [auth] PLAY RECAP ********************************************************************************************************************************* auth : ok=9 changed=0 unreachable=0 failed=0 skipped=2 rescued=0 ignored=0 ``` ## Med endringer I templates `uv run ansible-playbook --check --diff auth/playbooks/site.yaml` ``` PLAY [Setup Restic Backup for the database] ************************************************************************************************ TASK [Gathering Facts] ********************************************************************************************************************* ok: [auth] TASK [backup : Validate backup role inputs] ************************************************************************************************ ok: [auth] => { "changed": false, "msg": "All assertions passed" } TASK [backup : Install restic] ************************************************************************************************************* ok: [auth] TASK [backup : Create backup directory] **************************************************************************************************** ok: [auth] TASK [backup : Deploy backup secrets] ****************************************************************************************************** ok: [auth] TASK [backup : Initialize restic repository] *********************************************************************************************** skipping: [auth] TASK [backup : Deploy backup script] ******************************************************************************************************* --- before: /opt/backups/backup.sh +++ after: /Users/maxbrosnahan/.ansible/tmp/ansible-local-500814fogxp6p/tmpuas2j1s3/backup.sh.j2 @@ -20,4 +20,5 @@ restic check fi -echo "$(date '+%Y-%m-%d %H:%M:%S') - Backup completed" \ No newline at end of file +echo "$(date '+%Y-%m-%d %H:%M:%S') - Backup completed" +test \ No newline at end of file changed: [auth] TASK [backup : Deploy restore script] ****************************************************************************************************** --- before: /opt/backups/restic-restore.sh +++ after: /Users/maxbrosnahan/.ansible/tmp/ansible-local-500814fogxp6p/tmpjdjmcqbh/restore.sh.j2 @@ -33,3 +33,4 @@ echo "" echo "To manually copy to production (CAREFUL!):" echo " cp -r $RESTORE_DIR/opt/deploy/pgdumps /opt/deploy/pgdumps" +test \ No newline at end of file changed: [auth] TASK [backup : Deploy systemd service] ***************************************************************************************************** --- before: /etc/systemd/system/restic-backup.service +++ after: /Users/maxbrosnahan/.ansible/tmp/ansible-local-500814fogxp6p/tmpoqu8wv6m/backup.service.j2 @@ -14,4 +14,5 @@ ProtectHome=true NoNewPrivileges=true TimeoutStartSec=3000 -OOMPolicy=stop \ No newline at end of file +OOMPolicy=stop +test \ No newline at end of file changed: [auth] TASK [backup : Deploy systemd timer] ******************************************************************************************************* --- before: /etc/systemd/system/restic-backup.timer +++ after: /Users/maxbrosnahan/.ansible/tmp/ansible-local-500814fogxp6p/tmp0rbl6r00/backup.timer.j2 @@ -8,3 +8,4 @@ [Install] WantedBy=timers.target +test \ No newline at end of file changed: [auth] TASK [backup : Enable backup timer] ******************************************************************************************************** skipping: [auth] PLAY RECAP ********************************************************************************************************************************* auth : ok=9 changed=4 unreachable=0 failed=0 skipped=2 rescued=0 ignored=0 ```
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix-backup-role:fix-backup-role
git switch fix-backup-role
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
datakollektivet/systemer!78
No description provided.