From 7671b51616a25fa6cff9c26fe65d5f703ff94e21 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Mon, 17 Oct 2022 17:44:06 -0400 Subject: Get wiki role to push updates to the right place in docker Ikiwiki has this three-repo setup with post-update hooks --- roles/wiki-publish/defaults/main.yml | 1 + roles/wiki-publish/tasks/main.yml | 22 ++++++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'roles/wiki-publish') diff --git a/roles/wiki-publish/defaults/main.yml b/roles/wiki-publish/defaults/main.yml index c6ca568..863003f 100644 --- a/roles/wiki-publish/defaults/main.yml +++ b/roles/wiki-publish/defaults/main.yml @@ -5,3 +5,4 @@ emacsconf_el_dir: ~/emacsconf-el emacsconf_edit_wiki_dir: ~/emacsconf-wiki emacsconf_private_dir: ~/emacsconf-2022-private emacs_config_dir: ~/.emacs.d +emacs_package: emacs-snapshot-nox diff --git a/roles/wiki-publish/tasks/main.yml b/roles/wiki-publish/tasks/main.yml index 897cecc..960aa01 100644 --- a/roles/wiki-publish/tasks/main.yml +++ b/roles/wiki-publish/tasks/main.yml @@ -1,17 +1,18 @@ --- - name: Set up SSH directory ansible.builtin.file: - path: /home/ikiwiki/.ssh + path: "/home/{{ emacsconf_publish_user }}/.ssh" state: directory mode: '0700' - name: Install SSH key for EmacsConf wiki ansible.builtin.get_url: url: https://emacsconf.org/id_rsa_anon_git_emacsconf - dest: /home/ikiwiki/.ssh/id_rsa_anon_git_emacsconf + dest: "/home/{{ emacsconf_publish_user }}/.ssh/id_rsa_anon_git_emacsconf" mode: '0600' - owner: 'ikiwiki' + owner: "{{ emacsconf_publish_user }}" - name: Set up packages become: yes + when: emacs_package and emacs_package != "emacs" block: # This repository is currently not working # - name: Add snapshot repository @@ -23,7 +24,7 @@ state: absent - name: Install Emacs snapshot ansible.builtin.apt: - name: emacs-snapshot-nox + name: "{{ emacs_package }}" state: present - name: Set up Emacs configuration for non-interactive publishing become: true @@ -47,16 +48,29 @@ ansible.builtin.git: repo: git://git.emacsconf.org/emacsconf-wiki dest: "{{ emacsconf_edit_wiki_dir }}" + register: wiki_clone + failed_when: + - wiki_clone.failed + - not 'Local modifications exist in repository' in wiki_clone.msg + - not 'Failed to checkout branch' in wiki_clone.msg - name: Check out emacsconf-el ansible.builtin.git: repo: git@git.emacsconf.org:pub/emacsconf-el dest: "{{ emacsconf_el_dir }}" register: elisp + failed_when: + - elisp.failed + - not 'Local modifications exist in repository' in elisp.msg + - not 'Failed to checkout branch' in elisp.msg - name: Check out emacsconf-2022-private ansible.builtin.git: repo: git@git.emacsconf.org:emacsconf-2022-private dest: "{{ emacsconf_private_dir }}" register: private + failed_when: + - private.failed + - not 'Local modifications exist in repository' in private.msg + - not 'Failed to checkout branch' in private.msg - name: Publish tags: publish block: -- cgit v1.2.3