Kapisi/roles/IRC/tasks/daemon.yml

103 lines
1.9 KiB
YAML
Raw Permalink Normal View History

---
- name: Ensure directory permissions
become: yes
file:
state: directory
path: "{{ item }}"
owner: ircd
group: ircd
mode: 0750
loop:
- "/var/log/inspircd"
- "/etc/inspircd"
- name: Generate dhparam
become: yes
command:
cmd: openssl dhparam -out /etc/inspircd/dhparams.pem 2048
creates: /etc/inspircd/dhparams.pem
- name: Permissions on dhparam
become: yes
file:
state: file
path: /etc/inspircd/dhparams.pem
owner: ircd
group: ircd
mode: 0640
2023-05-02 17:32:11 -05:00
- name: Add ircd user to ssl
become: yes
user:
name: ircd
groups: ssl
append: yes
- name: Copy service file
become: yes
register: servicesfile
copy:
src: services/irc.service
dest: /usr/lib/systemd/system/irc.service
owner: root
group: root
mode: 0644
- name: Reload services
when: servicesfile.changed
become: yes
systemd:
daemon_reload: true
- name: Copy config and fill in attributes
register: templatefiles
become: yes
template:
src: "inspircd/{{ item }}.j2"
dest: "/etc/inspircd/{{ item }}"
owner: ircd
group: ircd
mode: 0600
loop:
- inspircd.conf
- modules.conf
- links.conf
- opers.conf
- rules.txt
- motd.txt
- name: Tracking directory
become: yes
file:
dest: "/etc/inspircd/data/"
owner: ircd
group: ircd
mode: 0750
state: directory
- name: Ensure tracking files
become: yes
file:
dest: "/etc/inspircd/{{ item }}"
owner: ircd
group: ircd
mode: 0600
loop:
- 'data/xline.db'
- 'data/permchannels.conf'
- name: Ensure service running
become: yes
service:
name: irc
state: started
enabled: yes
- name: Reload on config change
become: yes
when: templatefiles.changed or servicesfile.changed
service:
name: irc
state: reloaded