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

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
主站蜘蛛池模板: 定南县| 乐业县| 高清| 大洼县| 通化县| 涡阳县| 亳州市| 延津县| 通化市| 澜沧| 佛教| 大名县| 浪卡子县| 囊谦县| 雷波县| 宾川县| 昆山市| 镇宁| 安义县| 墨江| 哈尔滨市| 丘北县| 新津县| 普陀区| 开阳县| 宝清县| 长白| 宣汉县| 邮箱| 石台县| 蓬溪县| 白朗县| 湘阴县| 武宣县| 军事| 汉沽区| 正镶白旗| 望奎县| 罗源县| 长沙市| 恩施市|