mongodb: Add database backups
This commit is contained in:
parent
195d9c3b03
commit
e233860b7b
3 changed files with 49 additions and 0 deletions
|
@ -29,6 +29,7 @@
|
|||
name: "{{ item }}"
|
||||
state: installed
|
||||
with_items:
|
||||
- mongodb-database-tools
|
||||
- mongodb-mongosh
|
||||
- mongodb-org-server
|
||||
|
||||
|
@ -127,6 +128,22 @@
|
|||
state: started
|
||||
enabled: true
|
||||
|
||||
- name: Copy backup script
|
||||
ansible.builtin.template:
|
||||
dest: /usr/local/sbin/mongodb-backup
|
||||
src: mongodb-backup.sh.j2
|
||||
mode: "0700"
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
|
||||
- name: Create backup cron job
|
||||
ansible.builtin.cron:
|
||||
name: mongodb-backup
|
||||
job: /usr/local/sbin/mongodb-backup
|
||||
hour: "0"
|
||||
minute: "20"
|
||||
user: root
|
||||
|
||||
- name: Create mongo alias cmd for root
|
||||
ansible.builtin.lineinfile:
|
||||
path: /root/.bashrc
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue