From 508aba7647be4037d3d4d50948dc5dae6b3dbc2d Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Sat, 8 Oct 2022 12:47:52 -0400 Subject: Starting point --- LICENSE | 22 ++++++++++++++++++++++ README.org | 21 +++++++++++++++++++++ inventory.yaml | 8 ++++++++ playbook.yaml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 99 insertions(+) create mode 100644 LICENSE create mode 100644 inventory.yaml create mode 100644 playbook.yaml diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..edf37ed --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2022 Sacha Chua + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/README.org b/README.org index cb70b49..b49bd3f 100644 --- a/README.org +++ b/README.org @@ -1,2 +1,23 @@ This repository contains infrastructure-as-code ansible configurations for various pieces of the EmacsConf infrastructure. + +To run the playbook: +ansible-playbook -i inventory.yaml playbook.yaml + +Update a specific talk's before/nav and the main schedule: (ex: wayland) +ansible-playbook playbook.yaml -e '{"slug": "wayland"}' -i inventory.yaml + +/etc/ansible/hosts: + +#+begin_example +[emacsconf-web] +front0.emacsconf.org +#+end_example + +~/.ssh/config + +#+begin_example +Host front0.emacsconf.org + Hostname front0.emacsconf.org + User orga +#+end_example diff --git a/inventory.yaml b/inventory.yaml new file mode 100644 index 0000000..964b8d5 --- /dev/null +++ b/inventory.yaml @@ -0,0 +1,8 @@ +prod: + hosts: + front: + ansible_host: front0.emacsconf.org + remote_user: orga + publish: + ansible_host: front0.emacsconf.org + remote_user: orga diff --git a/playbook.yaml b/playbook.yaml new file mode 100644 index 0000000..665af55 --- /dev/null +++ b/playbook.yaml @@ -0,0 +1,48 @@ +- name: Set up publishing environment + hosts: publish + tasks: + - name: Set up packages + become: yes + block: + - name: Set up ikiwiki + ansible.builtin.apt: + name: ikiwiki + state: present + - name: Add snapshot repository + ansible.builtin.apt_repository: + repo: deb http://emacs.ganneff.de/ buster main + - name: Remove old package + ansible.builtin.apt: + name: emacs + state: absent + - name: Install Emacs snapshot + ansible.builtin.apt: + name: emacs-snapshot-nox + state: present + - name: Set up or update repositories + block: + - name: Check out wiki repository + ansible.builtin.git: + repo: git://git.emacsconf.org/emacsconf-wiki + dest: ~/emacsconf-wiki + - name: Check out emacsconf-el + ansible.builtin.git: + repo: git@git.emacsconf.org:pub/emacsconf-el + dest: ~/emacsconf-el + - name: Check out emacsconf-2022-private + ansible.builtin.git: + repo: git@git.emacsconf.org:emacsconf-2022-private + dest: ~/emacsconf-2022-private + register: private +- name: Publish + hosts: publish + tasks: + - name: Publish the schedule + command: emacs -l ~/.emacs.d/init.el --batch --exec '(emacsconf-generate-main-schedule)' + when: private.changed + - name: Update a specific talk's nav page + tags: publish-talk + command: emacs -l ~/.emacs.d/init.el --batch --exec '(emacsconf-with-talk-heading "{{ slug }}" (emacsconf-update-talk))' + when: slug is defined + - name: Commit the wiki and push + shell: cd ~/emacsconf-wiki; git commit -m 'Update from ansible' -a; git push -- cgit v1.2.3