diff options
author | Sacha Chua <sacha@sachachua.com> | 2022-10-16 18:07:51 -0400 |
---|---|---|
committer | Sacha Chua <sacha@sachachua.com> | 2022-10-16 18:08:11 -0400 |
commit | 84ccb907a14bd8bd06afec7b5ac836fa7a0883f6 (patch) | |
tree | 2168d05fed72017dd4b8463ec1bb86fc0a93f11a | |
parent | 1b0f1181a1b5995f6aed69efffebfc768d51b734 (diff) | |
download | emacsconf-ansible-84ccb907a14bd8bd06afec7b5ac836fa7a0883f6.tar.xz emacsconf-ansible-84ccb907a14bd8bd06afec7b5ac836fa7a0883f6.zip |
Try to separate wiki-publish and wiki-edit
Diffstat (limited to '')
-rw-r--r-- | README.org | 16 | ||||
-rw-r--r-- | prod-playbook.yml | 10 | ||||
-rw-r--r-- | wiki-edit/defaults/main.yml | 7 | ||||
-rw-r--r-- | wiki-edit/tasks/main.yaml | 64 | ||||
-rw-r--r-- | wiki-edit/templates/emacsconf-edit.el | 32 | ||||
-rw-r--r-- | wiki-publish/defaults/main.yml | 7 | ||||
-rw-r--r-- | wiki-publish/tasks/main.yml | 71 | ||||
-rw-r--r-- | wiki-publish/templates/emacsconf-config.el | 19 | ||||
-rw-r--r-- | wiki/defaults/main.yml | 21 | ||||
-rw-r--r-- | wiki/templates/supervisord.conf | 5 |
10 files changed, 195 insertions, 57 deletions
@@ -8,6 +8,12 @@ Docker: needs docker-vars.yml, see docker-vars.yml.sample * Wiki ** Ikiwiki +*** Prod + +When you update htmlscrubber.pm in wiki/templates: + +ansible-playbook -i inventory.yml prod-playbook.yml --tags wiki-plugins + *** Docker Creating: ansible-playbook -i docker-inventory.yml docker-playbook.yml --tags wiki @@ -19,7 +25,15 @@ http://localhost:28080/ ** Publishing *** Prod To run the playbook and publish the main schedule: -ansible-playbook -i inventory.yml prod-playbook.yml --tags publish + +#+begin_src sh +ansible-playbook -i inventory.yml prod-playbook.yml --tags wiki-publish --extra-vars='{"force_publish": true}' +#+end_src + +#+RESULTS: +:results: +:end: + Update a specific talk's before/nav and the main schedule: (ex: wayland) ansible-playbook playbook.yml -e '{"slug": "wayland"}' -i inventory.yml --tags publish diff --git a/prod-playbook.yml b/prod-playbook.yml index 81b6911..ac2f8bb 100644 --- a/prod-playbook.yml +++ b/prod-playbook.yml @@ -4,12 +4,18 @@ tasks: - include_vars: file: prod-vars.yml -- name: Set up wiki for publishing +- name: Set up wiki hosts: front roles: - wiki - name: Set up wiki for publishing - hosts: publish + hosts: front + tags: wiki-publish + roles: + - wiki-publish +- name: Set up wiki for interactive editing + hosts: front + tags: wiki-edit roles: - wiki-edit - name: Set up pad diff --git a/wiki-edit/defaults/main.yml b/wiki-edit/defaults/main.yml new file mode 100644 index 0000000..ea0fbdb --- /dev/null +++ b/wiki-edit/defaults/main.yml @@ -0,0 +1,7 @@ +emacsconf_edit_packages: + - consult + - embark + - embark-consult + - vertico + - magit + - modus-themes diff --git a/wiki-edit/tasks/main.yaml b/wiki-edit/tasks/main.yaml index f7eb650..f77535f 100644 --- a/wiki-edit/tasks/main.yaml +++ b/wiki-edit/tasks/main.yaml @@ -1,55 +1,11 @@ --- -- name: Set up SSH directory - ansible.builtin.file: - path: /home/ikiwiki/.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 - mode: '0600' - owner: 'ikiwiki' -- name: Set up packages - become: yes - block: - - 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 - tags: publish - 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 - register: elisp - - 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 - tags: publish - block: - - name: Publish the schedule - command: emacs -l ~/.emacs.d/init.el --batch --exec '(emacsconf-generate-main-schedule)' - when: force_publish or ((private.changed or elisp.changed) and slug is not defined) - - 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 +- name: Set up Emacs configuration for interactive editing + template: + src: emacsconf-edit.el + dest: "{{ emacs_config_dir }}/emacsconf-edit.el" +- name: Check if Emacs base configuration already exists + lineinfile: + dest: "{{ emacs_config_dir }}/init.el" + state: present + regexp: "emacsconf-edit" + line: "(load-file \"emacsconf-edit.el\")" diff --git a/wiki-edit/templates/emacsconf-edit.el b/wiki-edit/templates/emacsconf-edit.el new file mode 100644 index 0000000..78e11a8 --- /dev/null +++ b/wiki-edit/templates/emacsconf-edit.el @@ -0,0 +1,32 @@ +(let ((packages '({% for package in emacsconf_edit_packages %}{{ package }}{% endfor %}))) + (mapc (lambda (package) (unless (package-installed-p package) (package-install package))) packages)) +;; Configuration +(vertico-mode) +(show-paren-mode) +(fset 'yes-or-no-p 'y-or-n-p) +(global-set-key (kbd "C-x g") 'magit-status) +(global-set-key (kbd "C-x b") 'consult-buffer) +(global-set-key (kbd "M-g t") 'emacsconf-go-to-talk) +(global-set-key (kbd "C-.") 'embark-act) +(global-set-key (kbd "C-c .") 'embark-act) +(global-set-key (kbd "C-;") 'embark-act) +(modus-themes-load-vivendi) +(org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp . t) (shell . t))) +(setq backup-directory-alist '(("." . "~/.emacs.d/backups"))) +(find-file "{{ emacsconf_private_dir }}/conf.org") +(split-window-horizontally) +(magit-status "{{ emacsconf_edit_wiki_dir }}") +(global-auto-revert-mode 1) +(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map) +(projectile-mode +1) +(setq projectile-completion-system 'default) +(setq projectile-enable-caching t) +(setq projectile-indexing-method 'alien) +(add-to-list 'projectile-globally-ignored-files "node_modules") +(add-to-list 'projectile-globally-ignored-files ".cache") +(add-to-list 'projectile-globally-ignored-files "_cache") + +(setq completion-styles '(orderless)) +(setq completion-category-defaults nil) +(setq completion-category-overrides '((file (styles orderless)))) +(require 'ox-md) diff --git a/wiki-publish/defaults/main.yml b/wiki-publish/defaults/main.yml new file mode 100644 index 0000000..c6ca568 --- /dev/null +++ b/wiki-publish/defaults/main.yml @@ -0,0 +1,7 @@ +emacsconf_year: 2022 +emacsconf_org_file: "{{ emacsconf_private_dir }}/conf.org" +emacsconf_publishing_phase: schedule +emacsconf_el_dir: ~/emacsconf-el +emacsconf_edit_wiki_dir: ~/emacsconf-wiki +emacsconf_private_dir: ~/emacsconf-2022-private +emacs_config_dir: ~/.emacs.d diff --git a/wiki-publish/tasks/main.yml b/wiki-publish/tasks/main.yml new file mode 100644 index 0000000..897cecc --- /dev/null +++ b/wiki-publish/tasks/main.yml @@ -0,0 +1,71 @@ +--- +- name: Set up SSH directory + ansible.builtin.file: + path: /home/ikiwiki/.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 + mode: '0600' + owner: 'ikiwiki' +- name: Set up packages + become: yes + block: + # This repository is currently not working + # - 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 Emacs configuration for non-interactive publishing + become: true + become_user: "{{ emacsconf_publish_user }}" + template: + src: emacsconf-config.el + dest: "{{ emacs_config_dir }}/emacsconf-config.el" +- name: Check if Emacs base configuration already exists + become: true + become_user: "{{ emacsconf_publish_user }}" + lineinfile: + dest: "{{ emacs_config_dir }}/init.el" + state: present + regexp: "emacsconf-config" + line: "(load-file \"emacsconf-config.el\")" +- name: Set up or update repositories + become: false + tags: publish + block: + - name: Check out wiki repository + ansible.builtin.git: + repo: git://git.emacsconf.org/emacsconf-wiki + dest: "{{ emacsconf_edit_wiki_dir }}" + - name: Check out emacsconf-el + ansible.builtin.git: + repo: git@git.emacsconf.org:pub/emacsconf-el + dest: "{{ emacsconf_el_dir }}" + register: elisp + - name: Check out emacsconf-2022-private + ansible.builtin.git: + repo: git@git.emacsconf.org:emacsconf-2022-private + dest: "{{ emacsconf_private_dir }}" + register: private +- name: Publish + tags: publish + block: + - name: Publish the schedule + command: emacs -l "{{ emacsconf_config_dir }}/emacsconf-config.el" --batch --exec '(emacsconf-generate-main-schedule)' + when: (force_publish|d(false)) or ((private.changed or elisp.changed) and slug is not defined) + - name: Update a specific talk's nav page + tags: publish-talk + command: emacs -l "{{ emacsconf_config_dir }}/emacsconf-config.el" --batch --exec '(emacsconf-with-talk-heading "{{ slug }}" (emacsconf-update-talk))' + when: slug is defined + - name: Commit the wiki and push + shell: cd {{ emacsconf_edit_wiki_dir }}; git commit -m 'Update from ansible' -a; git push diff --git a/wiki-publish/templates/emacsconf-config.el b/wiki-publish/templates/emacsconf-config.el new file mode 100644 index 0000000..53ffe64 --- /dev/null +++ b/wiki-publish/templates/emacsconf-config.el @@ -0,0 +1,19 @@ +(add-to-list 'load-path "{{ emacsconf_el_dir }}") +(require 'emacsconf) +(require 'emacsconf-publish) +(require 'emacsconf-schedule) +(org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp . t) (shell . t))) +(setq emacsconf-year "{{ emacsconf_year }}") +(setq emacsconf-org-file "{{ emacsconf_org_file }}") +(setq emacsconf-directory "{{ emacsconf_edit_wiki_dir }}") +{% if emacsconf_streaming_nick is defined %} +(setq emacsconf-streaming-nick "{{ emacsconf_streaming_nick }}") +{% endif %} +{% if emacsconf_org_tag is defined %} +(setq emacsconf-org-tag "{{ emacsconf_org_tag }}") +{% endif %} +{% if emacsconf_ansible_directory is defined %} +(setq emacsconf-ansible-directory "{{ emacsconf_ansible_directory }}") +{% endif %} +(setq emacsconf-pad-api-key "{{ etherpad_api_key }}") +(setq emacsconf-publishing-phase '{{ emacsconf_publishing_phase }}) diff --git a/wiki/defaults/main.yml b/wiki/defaults/main.yml new file mode 100644 index 0000000..421427c --- /dev/null +++ b/wiki/defaults/main.yml @@ -0,0 +1,21 @@ +--- +ikiwiki_git_branch: master +ikiwiki_path: /home/ikiwiki +ikiwiki_src_dir: "{{ ikiwiki_path }}/emacsconf" +ikiwiki_plugin_path: /home/ikiwiki/.ikiwiki/IkiWiki/Plugin +ikiwiki_admin: bandali@gnu.org +ikiwiki_dest: /var/www/emacsconf.org +ikiwiki_url: https://emacsconf.org +ikiwiki_plugins: + - goodstuff + - theme + - license + - sidebar + - attachment + - remove +ikiwiki_underlay: /usr/share/ikiwiki/basewiki +ikiwiki_cookie_jar: "{{ ikiwiki_path }}/.ikiwiki/cookies" +ikiwiki_git_wrapper: "{{ ikiwiki_path }}/hooks/emacsconf" +ikiwiki_git_test_receive_wrapper: "{{ ikiwiki_path }}/hooks/emacsconf-pre" +ikiwiki_git_base_url: //git.emacsconf.org/emacsconf-wiki + diff --git a/wiki/templates/supervisord.conf b/wiki/templates/supervisord.conf new file mode 100644 index 0000000..4df613a --- /dev/null +++ b/wiki/templates/supervisord.conf @@ -0,0 +1,5 @@ +[program:lighttpd] +command=/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf + +[program:sshd] +command=/usr/sbin/sshd -D
\ No newline at end of file |