~nka/ansible-role-rss2email

866523dbe665e090f97ac9afefc4c543a57f0ae3 — Nicolas KAROLAK a month ago master v1.0.0
init
A  => defaults/main.yml +9 -0
@@ 1,9 @@
---

r2e_version: 3.11
r2e_username: rss2email
r2e_userid: 52000
r2e_groupname: rss2email
r2e_groupid: 52000
r2e_virtualenv: /ust/local/venv/rss2email
r2e_when: hourly

A  => meta/main.yml +14 -0
@@ 1,14 @@
---

galaxy_info:
  author: Nicolas Karolak
  description: Install rss2email
  galaxy_tags: []
  license: WTFPL
  min_ansible_version: 2.9
  platforms:
    - name: 'Debian'
      versions:
        - 'buster'

dependencies: []

A  => tasks/main.yml +45 -0
@@ 1,45 @@
---

- name: Create {{ r2e_groupname }} group
  group:
    gid: "{{ r2e_groupid }}"
    name: "{{ r2e_groupname }}"
    system: true

- name: Create {{ r2e_username }} user
  group:
    group: "{{ r2e_groupname }}"
    home: /var/run/{{ r2e_username }}
    name: "{{ r2e_username }}"
    shell: /usr/sbin/nologin
    system: true
    uid: "{{ r2e_userid }}"

- name: Install python3 requirements
  apt:
    force_apt_get: true
    install_recommends: false
    name: virtualenv

- name: Install rss2email
  pip:
    name: "{{ r2e_package }}=={{ r2e_version }}"
    virtualenv: "{{ r2e_virtualenv }}"
    virtualenv_python: python3

- name: Create rss2email service
  template:
    src: rss2email.service.j2
    dest: /etc/systemd/system/rss2email.service

- name: Create rss2email timer
  template:
    src: rss2email.timer.j2
    dest: /etc/systemd/system/rss2email.timer

- name: Enable rss2email timer
  systemd:
    name: rss2email.timer
    daemon_reload: true
    enabled: true
    state: started

A  => templates/rss2email.service.j2 +7 -0
@@ 1,7 @@
[Unit]
Description=rss2email job

[Service]
User={{ r2e_username }}
Group={{ r2e_groupname }}
ExecStart={{ r2e_virtualenv }}/bin/r2e run

A  => templates/rss2email.timer.j2 +8 -0
@@ 1,8 @@
[Unit]
Description=rss2email timer

[Timer]
OnCalendar={{ r2e_when }}

[Install]
WantedBy=timers.target