Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log crontab_user_home #63

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading