homelab-automation/Ansible/roles/rss2email.yml
Benjamin Hays f70a826a91
All checks were successful
Ansible Lint / build (push) Successful in 1m14s
Ansible Deploy / deploy (Ansible/playbooks/debian.yml) (push) Successful in 1m38s
Ansible Deploy / deploy (Ansible/playbooks/proxmox.yml) (push) Successful in 1m8s
add rss2email role
2024-11-09 15:13:57 -05:00

53 lines
1.4 KiB
YAML

---
- name: RSS2Email
hosts: devops.benhays.cloud
remote_user: bhays
become: true
become_user: root
vars_files:
- ../homelab-vault/secrets.yml
vars:
smtp_server: "smtp.mailbox.org"
smtp_port: 465 # for SSL/TLS
# smtp_port: 587 # for STARTTLS
smtp_username: "ben@benhays.org"
smtp_password: "{{ SMTP_PASSWORD }}"
to_email: "ben@benhays.org"
from_email: "ben@benhays.org"
pre_tasks:
- name: Update apt cache if needed.
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
tasks:
- name: Update/install RSS2Email
ansible.builtin.apt:
name:
- rss2email
state: latest
- name: Create XDG_CONFIG folder
ansible.builtin.file:
path: /home/bhays/.config/
state: directory
owner: bhays
group: bhays
mode: "0770"
- name: Upload Config Template
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: bhays
group: bhays
mode: "0600"
with_items:
- { src: '../templates/rss2email.cfg.j2', dest: '/home/bhays/.config/rss2email.cfg' }
- name: Run r2e for the first time to cache articles
ansible.builtin.command: r2e run --no-send
changed_when: true
- name: Add Cronjob
ansible.builtin.cron:
name: "RSS2Email"
job: "r2e run"
special_time: hourly
user: bhays