#####################################
### someone's ansible provisioner ###
#####################################
# Part of: https://git.somenet.org/root/pub/somesible.git
# 2017-2026 by someone <someone@somenet.org>
#
---
- name: install pyspf-milter
  apt:
    pkg:
    - pyspf-milter
    state: present
    policy_rc_d: 101
  tags: "online"
  ignore_errors: "{{ignore_online_errors | bool}}"


- name: copy pyspf-milter.conf
  copy:
    src: "{{item}}"
    dest: "/etc/pyspf-milter/pyspf-milter.conf"
    mode: 0644
    owner: "root"
    group: "root"
  with_first_found:
    - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/pyspf-milter.conf"
    - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/pyspf-milter.conf"
    - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/pyspf-milter.conf"
    - "default/pyspf-milter.conf"
  notify: restart pyspf-milter.service


- name: copy pyspf-milter.service to /etc/systemd/system/
  copy:
    src: "{{item}}"
    dest: "/etc/systemd/system/pyspf-milter.service"
    mode: 0644
    owner: "root"
    group: "root"
  with_first_found:
    - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/pyspf-milter.service"
    - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/pyspf-milter.service"
    - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/pyspf-milter.service"
    - "default/pyspf-milter.service"
  notify: restart pyspf-milter.service


- name: enable and start pyspf-milter.service
  include_role: name="base/systemd/enable-and-start"
  vars:
    service_name: pyspf-milter.service
