---

- name: Render anope config files
  ansible.builtin.template:
    src: etc/anope/{{ item }}.conf.j2
    dest: /etc/anope/{{ item }}.conf
    owner: root
    group: irc
    mode: "0640"
  loop:
    - services
    - nickserv
    - chanserv
  notify: Restart anope

- name: Render /etc/default/anope
  ansible.builtin.template:
    src: etc/default/anope.j2
    dest: /etc/default/anope
    owner: root
    group: root
    mode: "0644"
  notify: Restart anope

- name: Start and enable anope
  ansible.builtin.service:
    name: anope
    state: started
    enabled: true