Kapisi/roles/IRC/tasks/services.yml

66 lines
1.2 KiB
YAML

---
- name: Ensure directory permissions
become: yes
file:
state: directory
path: "{{ item }}"
owner: ircd
group: ircd
mode: 0700
loop:
- "/etc/anope"
- "/opt/anope"
- "/opt/anope/data"
- "/var/log/anope"
- name: Copy config and fill in attributes
register: templatefiles
become: yes
template:
src: "anope/{{ item }}.j2"
dest: "/etc/anope/{{ item }}"
owner: ircd
group: ircd
mode: 0600
loop:
- botserv.conf
- chanserv.conf
- global.conf
- hostserv.conf
- memoserv.conf
- modules.conf
- nickserv.conf
- operserv.conf
- services.conf
- name: Copy service file
become: yes
register: servicesfile
copy:
src: services/ircservices.service
dest: /usr/lib/systemd/system/ircservices.service
owner: root
group: root
mode: 0644
- name: Reload services
when: servicesfile.changed
become: yes
systemd:
daemon_reload: true
- name: Ensure service running
become: yes
service:
name: ircservices
state: started
enabled: yes
- name: Reload on config change
become: yes
when: templatefiles.changed or servicesfile.changed
service:
name: ircservices
state: reloaded