Skip to content

Commit

Permalink
log crontab_user_home
Browse files Browse the repository at this point in the history
  • Loading branch information
euanmillar committed Feb 18, 2024
1 parent 17fd3b9 commit 5b34cf5
Showing 1 changed file with 5 additions and 21 deletions.
26 changes: 5 additions & 21 deletions infrastructure/server-setup/backups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
#
# Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
---
- hosts: localhost
tasks:
- name: Generate SSH keypair for application -> backup server connection
command: ssh-keygen -t rsa -b 4096 -f /tmp/backup_ssh_key -N ""
tags:
- backups

- hosts: docker-manager-first
become: yes
vars:
Expand All @@ -33,6 +26,11 @@
tags:
- backups

- name: Print crontab_user_home information from the previous task
ansible.builtin.debug:
var: crontab_user_home
verbosity: 2

- name: Check if crontab user already has an ssh key
stat:
path: '{{ crontab_user_home }}/.ssh/id_rsa.pub'
Expand All @@ -49,20 +47,6 @@
tags:
- backups

- name: Create an SSH key for crontab user if they do not have one
copy:
src: /tmp/backup_ssh_key
dest: '{{ crontab_user_home }}/.ssh/id_rsa'
mode: 0600
when: not file_check.stat.exists
tags:
- backups

- name: Create public key file from private key
shell: ssh-keygen -y -f '{{ crontab_user_home }}/.ssh/id_rsa' > '{{ crontab_user_home }}/.ssh/id_rsa.pub'
tags:
- backups

- include_tasks:
file: tasks/backups/crontab.yml
apply:
Expand Down

0 comments on commit 5b34cf5

Please sign in to comment.