diff --git a/.gitea/workflows/ansible-deploy.yml b/.gitea/workflows/ansible-deploy.yml index 1cccd81..6dc2807 100644 --- a/.gitea/workflows/ansible-deploy.yml +++ b/.gitea/workflows/ansible-deploy.yml @@ -24,6 +24,11 @@ jobs: with: submodules: recursive + - name: Install Pip + run: | + apt update -y + apt install python3-pip -y + - name: "Cache python packages" uses: actions/cache@v3 with: @@ -32,8 +37,6 @@ jobs: - name: Install Ansible run: | - apt update -y - apt install python3-pip -y python3 -m pip install ansible==${{ env.ANSIBLE_VERSION }} - name: Install Ansible Galaxy requirements diff --git a/Ansible/homelab-vault b/Ansible/homelab-vault index fd37b52..c32f82f 160000 --- a/Ansible/homelab-vault +++ b/Ansible/homelab-vault @@ -1 +1 @@ -Subproject commit fd37b52a9e6025dbad72e63820cb03d3008da17d +Subproject commit c32f82f99d6b33febc8cdf8bfb3c0381fbd37ecb diff --git a/Ansible/roles/rss2email.yml b/Ansible/roles/rss2email.yml new file mode 100644 index 0000000..3117240 --- /dev/null +++ b/Ansible/roles/rss2email.yml @@ -0,0 +1,52 @@ +--- +- 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 diff --git a/Ansible/templates/rss2email.cfg.j2 b/Ansible/templates/rss2email.cfg.j2 new file mode 100644 index 0000000..42a9475 --- /dev/null +++ b/Ansible/templates/rss2email.cfg.j2 @@ -0,0 +1,97 @@ +[DEFAULT] +from = {{ from_email }} +user-agent = rss2email/__VERSION__ (__URL__) +use-8bit = False +force-from = False +use-publisher-email = False +name-format = {feed-title}: {author} +to = {{ to_email }} +proxy = +feed-timeout = 60 +same-server-fetch-interval = 0 +active = True +digest = False +date-header = False +date-header-order = modified, issued, created, expired +bonus-header = +trust-guid = True +trust-link = False +reply-changes = False +encodings = US-ASCII, ISO-8859-1, UTF-8, BIG5, ISO-2022-JP +post-process = rss2email.post_process.prettify process +digest-post-process = +html-mail = False +multipart-html = False +use-css = False +css = h1 { + font: 18pt Georgia, "Times New Roman"; + } + body { + font: 12pt Arial; + } + a:link { + font: 12pt Arial; + font-weight: bold; + color: #0000cc; + } + blockquote { + font-family: monospace; + } + .header { + background: #e0ecff; + border-bottom: solid 4px #c3d9ff; + padding: 5px; + margin-top: 0px; + color: red; + } + .header a { + font-size: 20px; + text-decoration: none; + } + .footer { + background: #c3d9ff; + border-top: solid 4px #c3d9ff; + padding: 5px; + margin-bottom: 0px; + } + #entry { + border: solid 4px #c3d9ff; + } + #body { + margin-left: 5px; + margin-right: 5px; + } + +unicode-snob = False +links-after-each-paragraph = False +inline-links = True +wrap-links = True +body-width = 0 +email-protocol = smtp +sendmail = /usr/sbin/sendmail +sendmail_config = +smtp-auth = True +smtp-username = {{ smtp_username }} +smtp-password = {{ smtp_password }} +smtp-server = {{ smtp_server }} +smtp-port = {{ smtp_port }} +smtp-ssl = True +imap-auth = False +imap-username = username +imap-password = password +imap-server = imap.example.net +imap-port = 143 +imap-ssl = False +imap-mailbox = INBOX +maildir-path = ~/Maildir +maildir-mailbox = INBOX +verbose = info + +[feed.eff] +url = https://www.eff.org/rss/updates.xml + +[feed.lwn-features] +url = https://benhays.org/lwn-features.xml + +[feed.lwn-all] +url = https://benhays.org/lwn-all.xml \ No newline at end of file