官术网_书友最值得收藏!

Setting up automated encrypted backups in AWS S3

Backups are always something that most of us feel should be done, but they seem quite a chore. Over the years, people have done extensive work to ensure we can have simple enough ways to back up and restore our data. 

In today's day and age, a great backup solution/software should be able to do the following:

The following code snippet is to set up duply for encrypted automated backups from the server to AWS S3:

- name: installing duply
apt:
name: "{{ item }}"
update_cache: yes
state: present

with_items
:
- python-boto
- duply

- name: check if we already have backup directory
stat:
path: "/root/.duply/{{ new_backup_name }}"
register: duply_dir_stats

- name: create backup directories
shell: duply {{ new_backup_name }} create
when: duply_dir_stats.stat.exists == False

- name: update the duply configuration
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"

with_items:
- { src: conf.j2, dest: /root/.duply/{{ new_backup_name }}/conf }
- { src: exclude.j2, dest: /root/.duply/{{ new_backup_name }}/exclude }

- name: create cron job for automated backups
template:
src: duply-backup.j2
dest: /etc/cron.hourly/duply-backup
主站蜘蛛池模板: 锦屏县| 腾冲县| 越西县| 儋州市| 靖西县| 神农架林区| 西安市| 开远市| 凤庆县| 阳江市| 菏泽市| 多伦县| 镇坪县| 潮州市| 伽师县| 永靖县| 原平市| 西安市| 徐汇区| 鸡泽县| 清新县| 甘德县| 石狮市| 福泉市| 黑山县| 深圳市| 深州市| 新化县| 抚宁县| 茌平县| 大方县| 祁阳县| 南岸区| 台东县| 海安县| 金堂县| 巴中市| 图木舒克市| 达拉特旗| 长宁区| 天津市|