Commit ab258608 authored by Jocelyn Delalande's avatar Jocelyn Delalande

rsync-backup-client: add an option to unconfigure the role

parent 7237919a
......@@ -18,4 +18,7 @@ rsync_backup_client_ldap: no
# Set it to yes to enable local MySQL dump and backup of all bases
# Be sure to also set rsync_backup_client_mysql_root_pass_file
rsync_backup_client_mysql: no
\ No newline at end of file
rsync_backup_client_mysql: no
# Set to yes to deconfigure rsync backup client instead of configuring it
rsync_backup_client_disable: no
\ No newline at end of file
- name: Rsync backup config dir is absent
file: path=/etc/rsync-backup state=absent
- name: Ensure cron backup script is absent
file: path=/etc/cron.daily/rsync-backup state=absent
\ No newline at end of file
- name: Install rsync
apt: pkg=rsync state=installed
- name: Setup rsync backup client
include: setup.yml
when: not rsync_backup_client_disable
- name: Check that ssh private key exists
file:
path: "{{ rsync_backup_client_ssh_key }}"
owner: root
group: root
state: file
- name: Find rsync server remote key
command: ssh-keyscan "{{ rsync_backup_client_ssh_host }}"
register: rsync_server_host_key
- name: Adds server host key if not already present
lineinfile:
create: yes
dest: "/etc/ssh/ssh_known_hosts"
line: "{{ rsync_server_host_key.stdout }}"
state: present
- name: Create rsync-backup config dir
file: path=/etc/rsync-backup state=directory mode=0644
- name: Puts ignore list
template: src=exclude-list.j2 dest=/etc/rsync-backup/exclude-list
- name: Puts cron backup script
template:
src: rsync-backup.j2
dest: /etc/cron.daily/rsync-backup
mode: 0744
\ No newline at end of file
- name: Disable rsync backup client
include: disable.yml
when: rsync_backup_client_disable
- name: Install rsync
apt: pkg=rsync state=installed
- name: Check that ssh private key exists
file:
path: "{{ rsync_backup_client_ssh_key }}"
owner: root
group: root
state: file
- name: Find rsync server remote key
command: ssh-keyscan "{{ rsync_backup_client_ssh_host }}"
register: rsync_server_host_key
- name: Adds server host key if not already present
lineinfile:
create: yes
dest: "/etc/ssh/ssh_known_hosts"
line: "{{ rsync_server_host_key.stdout }}"
state: present
- name: Create rsync-backup config dir
file: path=/etc/rsync-backup state=directory mode=0644
- name: Puts ignore list
template: src=exclude-list.j2 dest=/etc/rsync-backup/exclude-list
- name: Puts cron backup script
template:
src: rsync-backup.j2
dest: /etc/cron.daily/rsync-backup
mode: 0744
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment