ansible/roles/rsyncd/tasks/main.yml

77 lines
1.6 KiB
YAML

---
#
# This role sets up rsyncd on a server
#
- name: install rnecessary packages
yum: state=present name={{item}}
with_items:
- rsync
- xinetd
- libsemanage-python
tags:
- packages
- rsyncd
when: ansible_distribution_major_version|int < 22
- name: install rnecessary packages
dnf: state=present name={{item}}
with_items:
- rsync
- xinetd
- libsemanage-python
tags:
- packages
- rsyncd
when: ansible_distribution_major_version|int > 21
- 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