-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from modcloth-labs/updates
Adding barman ssh config to make sure it doesn't get prompted for a host key
- Loading branch information
Showing
4 changed files
with
71 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,71 @@ | ||
--- | ||
- name: "create barman user" | ||
user: | ||
name='{{barman_user}}' | ||
groups='{{barman_groups}}' | ||
name={{ barman_user }} | ||
groups={{ barman_groups }} | ||
state=present | ||
register: barman_create_barman_user | ||
|
||
- name: "create ssh directory" | ||
file: | ||
path='{{barman_create_barman_user.home}}/.ssh' | ||
path={{ barman_create_barman_user.home }}/.ssh | ||
state=directory | ||
owner='{{barman_user}}' | ||
group='{{barman_user}}' | ||
owner={{ barman_user }} | ||
group={{ barman_user }} | ||
|
||
- name: add ssh config | ||
template: | ||
dest={{ barman_create_barman_user.home }}/.ssh/config | ||
src=ssh_config.j2 | ||
owner={{ barman_user }} | ||
group={{ barman_user }} | ||
mode=0600 | ||
|
||
- name: "add ssh key" | ||
copy: | ||
src='{{barman_ssh_key_file}}' | ||
dest='{{barman_create_barman_user.home}}/.ssh/id_rsa' | ||
src={{ barman_ssh_key_file }} | ||
dest={{ barman_create_barman_user.home }}/.ssh/id_rsa | ||
|
||
- name: "add authorized ssh key" | ||
authorized_key: | ||
key='{{barman_archive_pub_key}}' | ||
user="{{barman_user}}" | ||
key="{{ barman_archive_pub_key }}" | ||
user={{ barman_user }} | ||
state=present | ||
|
||
- name: "write barman.conf" | ||
template: src=barman.conf.j2 dest=/etc/barman.conf owner='{{barman_user}}' | ||
template: src=barman.conf.j2 dest=/etc/barman.conf owner={{ barman_user }} | ||
|
||
- name: "create home directory" | ||
file: | ||
path='{{barman_home}}' | ||
path={{ barman_home }} | ||
state=directory | ||
owner='{{barman_user}}' | ||
group='{{barman_user}}' | ||
recurse=yes | ||
owner={{ barman_user }} | ||
group={{ barman_user }} | ||
|
||
- name: "install barman" | ||
pip: name=barman state=present | ||
|
||
- name: "add maintenance job" | ||
cron: | ||
name="barman maintenance job" | ||
minute={{barman_maintenance_schedule.split()[0]}} | ||
hour={{barman_maintenance_schedule.split()[1]}} | ||
day={{barman_maintenance_schedule.split()[2]}} | ||
month={{barman_maintenance_schedule.split()[3]}} | ||
weekday={{barman_maintenance_schedule.split()[4]}} | ||
job="date >> {{barman_maintenance_log_file}} && barman cron >> {{barman_maintenance_log_file}} 2>&1" | ||
user="{{barman_user}}" | ||
minute={{ barman_maintenance_schedule.split()[0] }} | ||
hour={{ barman_maintenance_schedule.split()[1] }} | ||
day={{ barman_maintenance_schedule.split()[2] }} | ||
month={{ barman_maintenance_schedule.split()[3] }} | ||
weekday={{ barman_maintenance_schedule.split()[4] }} | ||
job="date >> {{ barman_maintenance_log_file }} && barman cron >> {{ barman_maintenance_log_file }} 2>&1" | ||
user="{{ barman_user }}" | ||
state=present | ||
|
||
- name: "add backup job" | ||
cron: | ||
name="barman backup job" | ||
minute={{barman_backup_schedule.split()[0]}} | ||
hour={{barman_backup_schedule.split()[1]}} | ||
day={{barman_backup_schedule.split()[2]}} | ||
month={{barman_backup_schedule.split()[3]}} | ||
weekday={{barman_backup_schedule.split()[4]}} | ||
job="date >> {{barman_backup_log_file}} && barman backup all >> {{barman_backup_log_file}} 2>&1" | ||
user="{{barman_user}}" | ||
minute={{ barman_backup_schedule.split()[0] }} | ||
hour={{ barman_backup_schedule.split()[1] }} | ||
day={{ barman_backup_schedule.split()[2] }} | ||
month={{ barman_backup_schedule.split()[3] }} | ||
weekday={{ barman_backup_schedule.split()[4] }} | ||
job="date >> {{ barman_backup_log_file }} && barman backup all >> {{ barman_backup_log_file }} 2>&1" | ||
user="{{ barman_user }}" | ||
state=present |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# {{ ansible_managed }} | ||
# vim:ft=jinja | ||
|
||
{% for host in barman_ssh_known_hosts_default %} | ||
Host {{ host }} | ||
StrictHostKeyChecking no | ||
UserKnownHostsFile /dev/null | ||
{% endfor %} | ||
|
||
{% for host in barman_ssh_known_hosts_additional %} | ||
Host {{ host }} | ||
StrictHostKeyChecking no | ||
UserKnownHostsFile /dev/null | ||
{% endfor %} |