Skip to content

Commit

Permalink
add tags
Browse files Browse the repository at this point in the history
  • Loading branch information
rikukissa committed Dec 22, 2023
1 parent 872e8b3 commit 11ae5aa
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions infrastructure/server-setup/backups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,26 @@
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
tasks:
- name: Check if ssh_key already exists
stat:
path: /home/{{ ansible_user }}/.ssh/id_rsa
register: file_check
tags:
- backups

- name: Ensure application server can login to backup server
copy:
src: /tmp/backup_ssh_key
dest: /home/{{ ansible_user }}/.ssh/id_rsa
mode: 0600
when: not file_check.stat.exists
tags:
- backups

- hosts: backups
become: yes
Expand All @@ -34,21 +40,29 @@
user:
name: '{{ external_backup_server_user }}'
state: present
tags:
- backups

- name: Check if authorized_keys already exists
stat:
path: /home/{{ external_backup_server_user }}/.ssh/authorized_keys
register: file_check
tags:
- backups

- name: Ensure backup application servers can login to backup server
copy:
src: /tmp/backup_ssh_key.pub
dest: /home/{{ external_backup_server_user }}/.ssh/authorized_keys
mode: 0600
when: not file_check.stat.exists
tags:
- backups

- name: 'Create backup directory'
file:
path: '{{ external_backup_server_remote_directory }}'
state: directory
owner: '{{ external_backup_server_user }}'
tags:
- backups

0 comments on commit 11ae5aa

Please sign in to comment.