91 lines
1.9 KiB
YAML
91 lines
1.9 KiB
YAML
---
|
|
#
|
|
# This role sets up rsyncd on a server
|
|
#
|
|
|
|
- name: install necessary packages
|
|
package:
|
|
state: present
|
|
name:
|
|
- rsync
|
|
- xinetd
|
|
- libsemanage-python
|
|
tags:
|
|
- packages
|
|
- rsyncd
|
|
when: ansible_distribution_major_version|int < 8 and ansible_distribution == 'RedHat'
|
|
|
|
- name: install necessary packages
|
|
package:
|
|
state: present
|
|
name:
|
|
- rsync
|
|
- xinetd
|
|
- libsemanage-python
|
|
tags:
|
|
- packages
|
|
- rsyncd
|
|
when: ansible_distribution_major_version|int >= 8 and ansible_distribution == 'RedHat'
|
|
|
|
- name: install necessary packages
|
|
package:
|
|
state: present
|
|
name:
|
|
- rsync
|
|
- xinetd
|
|
- libsemanage-python
|
|
tags:
|
|
- packages
|
|
- rsyncd
|
|
when: ansible_distribution_major_version|int >= 29 and ansible_distribution == 'Fedora'
|
|
|
|
- name: rsyncd.conf file
|
|
copy: src={{ item }} dest=/etc/rsyncd.conf mode=0644
|
|
with_first_found:
|
|
- "{{ rsyncd_conf }}"
|
|
- rsyncd.conf.{{ inventory_hostname }}
|
|
- rsyncd.conf.{{ host_group }}
|
|
- rsyncd.conf.{{ rsync_group }}
|
|
- rsyncd.conf.default
|
|
when: "'download' not in group_names"
|
|
notify:
|
|
- restart xinetd
|
|
tags:
|
|
- config
|
|
- rsyncd
|
|
|
|
- name: rsyncd.conf file
|
|
template: src=rsyncd.conf.download.j2 dest=/etc/rsyncd.conf mode=0644
|
|
notify:
|
|
- restart xinetd
|
|
when: "'download' in group_names"
|
|
tags:
|
|
- config
|
|
- rsyncd
|
|
|
|
- name: xinetd rsync file
|
|
copy: src={{ item }} dest=/etc/xinetd.d/rsync mode=0644
|
|
with_first_found:
|
|
- "{{ rsync }}"
|
|
- rsync.{{ inventory_hostname }}
|
|
- rsync.{{ host_group }}
|
|
- rsync.{{ rsync_group }}
|
|
- rsync.default
|
|
notify:
|
|
- restart xinetd
|
|
tags:
|
|
- config
|
|
- rsyncd
|
|
|
|
- name: make sure xinetd is started
|
|
service: name=xinetd state=started
|
|
tags:
|
|
- services
|
|
- rsyncd
|
|
|
|
- name: set sebooleans so rsync can read dirs
|
|
seboolean: name=rsync_export_all_ro
|
|
state=true
|
|
persistent=true
|
|
tags:
|
|
- rsyncd
|