Files
fedora-infra_ansible/roles/torrent/tasks/main.yml
Ryan Lerch 25391e95b7 ansiblelint fixes - fqcn[action-core] - package to ansible.builtin.package
Replaces many references to  package: with ansible.builtin.package

Signed-off-by: Ryan Lerch <rlerch@redhat.com>
2025-01-15 11:28:00 +10:00

90 lines
3.3 KiB
YAML

---
# Configuration for the torrent tracker
- name: Install needed packages
ansible.builtin.package: name={{ item }} state=present
with_items:
- httpd
- opentracker-common
- opentracker-ipv4
- opentracker-ipv6
- mktorrent
- python-simplejson
tags:
- packages
- name: Add torrent group
group: name=torrent state=present system=yes local=true
tags:
- config
- name: Add torrent user
user: name=torrent state=present home=/var/spool/bittorrent createhome=yes system=yes local=true group=torrent
tags:
- config
- name: Create the required directories
ansible.builtin.file: path={{ item.file }} owner={{ item.owner }}
group={{ item.group }} mode={{ item.mode }} state=directory
with_items:
- { file: /srv/web/stats/daily/, owner: opentracker, group: torrent, mode: 2775}
- { file: /srv/web/stats/hourly/, owner: opentracker, group: torrent, mode: 2775}
- { file: /srv/web/stats/raw/, owner: opentracker, group: torrentadmin, mode: 2775}
- { file: /srv/web/stats/raw/evertyhing/, owner: opentracker, group: torrentadmin, mode: 2775}
- { file: /srv/web/stats/raw/torrent/, owner: opentracker, group: torrentadmin, mode: 2775}
tags:
- config
- name: Install the files for the tracker
ansible.builtin.copy: src={{ item.file }} dest={{ item.dest }} mode={{ item.mode }}
with_items:
- { file: torrent_generator.conf, dest: /etc/torrent_generator.conf, mode: 644 }
- { file: spins_generator.conf, dest: /etc/spins_generator.conf, mode: 644 }
- { file: opentracker-ipv4.conf, dest: /etc/opentracker/opentracker-ipv4.conf, mode: 644 }
- { file: opentracker-ipv6.conf, dest: /etc/opentracker/opentracker-ipv6.conf, mode: 644 }
- { file: torrent-httpd.conf, dest: /etc/httpd/conf.d/torrent.conf, mode: 644 }
- { file: spins-httpd.conf, dest: /etc/httpd/conf.d/spins.conf, mode: 644 }
- { file: torrent-web-generate.cron, dest: /etc/cron.d/torrent-web-generate, mode: 644 }
- { file: torrent-hash.cron, dest: /etc/cron.d/torrent-hash.cron, mode: 644 }
- { file: bittorrent.logrotate, dest: /etc/logrotate.d/bittorrent, mode: 644 }
- { file: torrent-data.py, dest: /usr/local/bin/torrent-data.py, mode: 755 }
- { file: torrentjsonstats.py, dest: /usr/local/bin/torrentjsonstats.py, mode: 755 }
- { file: torrent-hashes.py, dest: /usr/local/bin/torrent-hashes.py, mode: 755 }
- { file: pull_opentracker_data.sh, dest: /usr/local/bin/pull_opentracker_data.sh, mode: 755 }
- { file: bittorrent-sysconfig, dest: /etc/sysconfig/bittorrent, mode: 644 }
# Directory
- { file: torrent-generator, dest: /srv/torrent/, mode: 755 }
- { file: spins-generator, dest: /srv/torrent/, mode: 755 }
tags:
- config
- name: Set opentracker-ivp4 to start
service: name=opentracker-ipv4 state=started enabled=yes
tags:
- config
- name: Set opentracker-ivp6 to start
service: name=opentracker-ipv6 state=started enabled=yes
tags:
- config
- name: Check the selinux context of webdir
ansible.builtin.command: matchpathcon /srv/web
register: webdir
check_mode: no
changed_when: "1 != 1"
tags:
- config
- selinux
- httpd
- httpd/website
- name: /srv/web file contexts
ansible.builtin.command: semanage fcontext -a -t httpd_sys_content_t "/srv/web(/.*)?"
when: webdir.stdout.find('httpd_sys_content_t') == -1
tags:
- config
- selinux
- httpd
- httpd/website