mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-04-30 21:41:53 +08:00
This will unify all the handlers to use first uppercase letter for ansible-lint to stop complaining. I went through all `notify:` occurrences and fixed them by running ``` set TEXT "text_to_replace"; set REPLACEMENT "replacement_text"; git grep -rlz "$TEXT" . | xargs -0 sed -i "s/$TEXT/$REPLACEMENT/g" ``` Then I went through all the changes and removed the ones that wasn't expected to be changed. Fixes https://pagure.io/fedora-infrastructure/issue/12391 Signed-off-by: Michal Konecny <mkonecny@redhat.com>
110 lines
2.9 KiB
YAML
110 lines
2.9 KiB
YAML
---
|
|
#
|
|
# This role sets up rsyncd on a server
|
|
#
|
|
|
|
- name: Install necessary packages
|
|
ansible.builtin.package:
|
|
state: present
|
|
name:
|
|
- rsync
|
|
- xinetd
|
|
- libsemanage-python
|
|
tags:
|
|
- packages
|
|
- rsyncd
|
|
when: ansible_distribution == 'RedHat' and ansible_distribution_major_version|int < 8
|
|
|
|
- name: Install necessary packages
|
|
ansible.builtin.package:
|
|
state: present
|
|
name:
|
|
- rsync
|
|
- xinetd
|
|
- python3-libsemanage
|
|
tags:
|
|
- packages
|
|
- rsyncd
|
|
when: ansible_distribution == 'RedHat' and ansible_distribution_major_version|int == 8
|
|
|
|
- name: Install necessary packages for fedora or rhel9
|
|
ansible.builtin.package:
|
|
state: present
|
|
name:
|
|
- rsync-daemon
|
|
- python3-libsemanage
|
|
tags:
|
|
- packages
|
|
- rsyncd
|
|
when: ansible_distribution == 'Fedora' or (ansible_distribution == 'RedHat' and ansible_distribution_major_version|int > 8)
|
|
|
|
- name: Rsyncd.conf file for non download servers
|
|
ansible.builtin.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 daemon
|
|
ignore_errors: true
|
|
tags:
|
|
- config
|
|
- rsyncd
|
|
|
|
- name: Rsyncd.conf file for download servers
|
|
ansible.builtin.template: src=rsyncd.conf.download.j2 dest=/etc/rsyncd.conf mode=0644
|
|
notify:
|
|
- Restart daemon
|
|
when: "'download' in group_names"
|
|
tags:
|
|
- config
|
|
- rsyncd
|
|
|
|
- name: Xinetd rsync file for rhel8
|
|
ansible.builtin.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
|
|
when: ansible_distribution_major_version|int < 9 and ansible_distribution == 'RedHat'
|
|
tags:
|
|
- config
|
|
- rsyncd
|
|
|
|
- name: Systemd rsync file for fedora and rhel9
|
|
ansible.builtin.copy: src=rsyncd.service dest=/usr/lib/systemd/system/rsyncd.service mode=0644
|
|
when: ansible_distribution == 'Fedora' or (ansible_distribution == 'RedHat' and ansible_distribution_major_version|int > 8)
|
|
notify:
|
|
- Restart daemon
|
|
tags:
|
|
- config
|
|
- rsyncd
|
|
|
|
- name: Make sure xinetd is started on rhel8
|
|
service: name=xinetd state=started enabled=true
|
|
when: ansible_distribution_major_version|int < 9 and ansible_distribution == 'RedHat'
|
|
tags:
|
|
- services
|
|
- rsyncd
|
|
|
|
- name: Make sure rsync daemon is started on Fedora and rhel9
|
|
service: name=rsyncd enabled=true state=started
|
|
when: ansible_distribution == 'Fedora' or (ansible_distribution == 'RedHat' and ansible_distribution_major_version|int > 8)
|
|
tags:
|
|
- services
|
|
- rsyncd
|
|
|
|
- name: Set sebooleans so rsync can read dirs
|
|
seboolean: name=rsync_export_all_ro
|
|
state=true
|
|
persistent=true
|
|
tags:
|
|
- rsyncd
|