summaryrefslogtreecommitdiffstats
path: root/roles/wiki/tasks
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2022-10-17 17:44:06 -0400
committerSacha Chua <sacha@sachachua.com>2022-10-17 17:44:06 -0400
commit7671b51616a25fa6cff9c26fe65d5f703ff94e21 (patch)
treeb85c0e39c1ca65cbf2d9fb4d0e534acd6861083b /roles/wiki/tasks
parent656e440054f43fc09050ba13e29d4eaaf355fcf5 (diff)
downloademacsconf-ansible-7671b51616a25fa6cff9c26fe65d5f703ff94e21.tar.xz
emacsconf-ansible-7671b51616a25fa6cff9c26fe65d5f703ff94e21.zip
Get wiki role to push updates to the right place in docker
Ikiwiki has this three-repo setup with post-update hooks
Diffstat (limited to 'roles/wiki/tasks')
-rw-r--r--roles/wiki/tasks/docker.yml66
-rw-r--r--roles/wiki/tasks/main.yml19
2 files changed, 68 insertions, 17 deletions
diff --git a/roles/wiki/tasks/docker.yml b/roles/wiki/tasks/docker.yml
index 1a759a4..be6591c 100644
--- a/roles/wiki/tasks/docker.yml
+++ b/roles/wiki/tasks/docker.yml
@@ -2,10 +2,13 @@
apt:
pkg:
- lighttpd
- - supervisord
+ - supervisor
+ - sudo
- name: Create the anon user
user:
name: anon
+ state: present
+ when: docker
- name: Set up Ikiwiki setup
template:
src: emacsconf.setup
@@ -14,27 +17,52 @@
group: www-data
- name: Set up the ikiwiki directories
file:
- dest: /var/www/html
+ dest: "{{ ikiwiki_dest }}"
state: directory
- owner: www-data
+ owner: ikiwiki
group: www-data
+ recurse: true
- name: Clone the bare git repo
git:
bare: true
repo: "{{ ikiwiki_git_source_mount }}"
dest: "{{ ikiwiki_bare_git_dir }}"
version: "{{ ikiwiki_git_branch }}"
+- name: Set up post-update hook
+ tags: wip
+ template:
+ src: post-update
+ dest: "{{ ikiwiki_bare_git_dir }}/hooks/post-update"
+ mode: 0755
+- name: Remove sample
+ tags: wip
+ file:
+ path: "{{ ikiwiki_bare_git_dir }}/hooks/post-update.sample"
+ state: absent
+- name: Set up ikiwiki post-update hook
+ tags: wip
+ template:
+ src: post-update.h00-ikiwiki-wrapper
+ dest: "{{ ikiwiki_bare_git_dir }}/hooks/post-update.h00-ikiwiki-wrapper"
+ mode: 0755
- name: Change owner
+ tags: wip
file:
dest: "{{ ikiwiki_bare_git_dir }}"
recurse: true
- owner: www-data
+ owner: ikiwiki
group: www-data
- name: Clone the working git repo
git:
repo: "{{ ikiwiki_bare_git_dir }}"
dest: "{{ ikiwiki_src_dir }}"
version: "{{ ikiwiki_git_branch }}"
+- name: Chown all the files to ikiwiki
+ file:
+ dest: "{{ ikiwiki_src_dir }}"
+ owner: ikiwiki
+ group: ikiwiki
+ recurse: true
- name: Copy supervisor config
template:
src: supervisord.conf
@@ -43,7 +71,31 @@
service:
name: lighttpd
state: started
-- name: Start supervisord
+- name: Start ssh
+ tags: ssh
service:
- name: supervisor
- state: restarted
+ name: ssh
+ state: started
+- name: Set up SSH directory
+ tags: ssh
+ file:
+ path: /home/ikiwiki/.ssh
+ owner: ikiwiki
+ group: ikiwiki
+ state: directory
+ mode: 0700
+- name: Set up SSH authentication
+ tags: ssh
+ block:
+ - name: Copy key
+ template:
+ src: "{{ docker_ssh_key }}"
+ dest: "/home/ikiwiki/.ssh/authorized_keys2"
+ mode: 0600
+ - name: Change ownership
+ file:
+ path: "/home/ikiwiki/.ssh"
+ owner: ikiwiki
+ group: ikiwiki
+ recurse: true
+ when: docker_ssh_key is defined
diff --git a/roles/wiki/tasks/main.yml b/roles/wiki/tasks/main.yml
index 35c297d..cd7cbdc 100644
--- a/roles/wiki/tasks/main.yml
+++ b/roles/wiki/tasks/main.yml
@@ -22,29 +22,26 @@
name: ikiwiki
group: ikiwiki
state: present
-- debug:
- var: docker
-- name: Set up or update repositories
- ansible.builtin.git:
- repo: git://git.emacsconf.org/emacsconf-wiki
- dest: "{{ ikiwiki_src_dir }}"
- when: not docker|d(false)
- name: Template the config
ansible.builtin.template:
src: emacsconf.setup
dest: "{{ ikiwiki_path }}/emacsconf.setup"
owner: ikiwiki
+- name: Create the plugin directory
+ file:
+ path: "{{ ikiwiki_plugin_path }}/IkiWiki/Plugin"
+ state: directory
- name: Copy Ikiwiki plugins
tags: wiki-plugins
template:
src: "{{ item }}"
- dest: "{{ ikiwiki_plugin_path }}/{{ item }}"
+ dest: "{{ ikiwiki_plugin_path }}/IkiWiki/Plugin/{{ item }}"
loop:
- copyright.pm
- htmlscrubber.pm
- license.pm
- include: docker.yml
- when: docker is true
+ when: docker
- name: Chown all the files to ikiwiki
tags: wiki-plugins
file:
@@ -54,7 +51,9 @@
recurse: true
- name: Regenerate all the files
tags: wiki-regenerate, wiki-plugins
- shell: ikiwiki --setup "{{ ikiwiki_path }}/emacsconf.setup" --rebuild --wrappers
+ become: true
+ become_user: ikiwiki
+ shell: cd ~ikiwiki; ikiwiki --setup "{{ ikiwiki_path }}/emacsconf.setup" --rebuild --wrappers
register: output
- debug:
var: output