--- /dev/null
+# Copyright (c) 2023 Jakub Czajka <jakub@ekhem.eu.org>
+# License: GPL-3.0 or later.
+
+- hosts: servers
+ vars:
+ dest: "{{ ansible_local.env.vars.prod_dir }}/cv"
+ repo: "{{ ansible_local.env.vars.git_home_dir }}/cv.git"
+ tasks:
+ - name: Install texlive
+ package:
+ name:
+ - texlive
+ state: latest
+ become: true
+ - name: Create destination directory
+ file:
+ path: "{{ dest }}"
+ state: directory
+ mode: 0775
+ owner: git
+ group: git
+ become: true
+ - name: Checkout cv's files to the destination directory
+ command: /usr/bin/git --work-tree={{ dest }} --git-dir={{ repo }} \
+ checkout main --force
+ become: true
+ - name: Compile CV
+ command: /usr/bin/pdflatex --output-directory={{ dest }} {{ dest }}/cv.tex
+ become: true
--- /dev/null
+#!/bin/sh
+# Copyright (c) 2023 Jakub Czajka <jakub@ekhem.eu.org>
+# License: GPL-3.0 or later.
+
+while read old_revision new_revision branch
+do
+ if [ "${branch}" != "refs/heads/main" ]
+ then
+ echo "${branch} is not the main branch so not deploying."
+ exit 0
+ fi
+ sudo /usr/bin/ansible-playbook --connection=local deploy.yaml
+done