--- - name: Install packages yum: name: - rsync - libsemanage-python when: ansible_os_family == 'RedHat' tags: rsync - name: Install packages apt: name=rsync when: ansible_os_family == 'Debian' tags: rsync - name: Handle rsyncd port iptables_raw: name: rsync_port state: "{{ (rsync_src_ip | length > 0) | ternary('present','absent') }}" rules: "-A INPUT -m state --state NEW -p tcp --dport {{ rsync_port }} -s {{ rsync_src_ip | join(',') }} -j ACCEPT" when: iptables_manage | default(True) tags: [firewall,rsync] - name: Create rsyncd.d directory file: path=/etc/rsyncd.conf.d state=directory tags: rsync - name: Deploy rsyncd conf template: src=rsyncd.conf.j2 dest=/etc/rsyncd.conf tags: rsync - name: Allow rsync full access in SELinux seboolean: name=rsync_full_access state=True persistent=True when: ansible_selinux.status == 'enabled' tags: rsync - name: Start and enable rsync daemon systemd: name=rsyncd.socket state=started enabled=True tags: rsync