Kapisi/roles/IRC/tasks/daemon.yml

103 lines
1.9 KiB
YAML
Raw 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:
2024-07-23 14:18:32 -05:00
src: services/inspircd.service
dest: /usr/lib/systemd/system/inspircd.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:
2024-07-23 14:18:32 -05:00
name: inspircd
state: started
enabled: yes
- name: Reload on config change
become: yes
when: templatefiles.changed or servicesfile.changed
service:
2024-07-23 14:18:32 -05:00
name: inspircd
state: reloaded