diff options
Diffstat (limited to 'roles/wiki-publish')
-rw-r--r-- | roles/wiki-publish/defaults/main.yml | 13 | ||||
-rw-r--r-- | roles/wiki-publish/tasks/emacs.yml | 38 | ||||
-rw-r--r-- | roles/wiki-publish/tasks/main.yml | 53 |
3 files changed, 76 insertions, 28 deletions
diff --git a/roles/wiki-publish/defaults/main.yml b/roles/wiki-publish/defaults/main.yml index 863003f..4de7445 100644 --- a/roles/wiki-publish/defaults/main.yml +++ b/roles/wiki-publish/defaults/main.yml @@ -1,8 +1,9 @@ -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 -emacs_package: emacs-snapshot-nox +emacsconf_el_dir: ~{{ emacsconf_user }}/emacsconf-el +emacsconf_edit_wiki_dir: ~{{ emacsconf_user }}/emacsconf-wiki +emacsconf_private_dir: ~{{ emacsconf_user }}/emacsconf-2022-private +emacs_config_dir: ~{{ emacsconf_user }}/.emacs.d +emacs_version: 28.2 +emacs_build_parent: /usr/src/emacs +emacs_build_dir: "{{ emacs_build_parent }}/emacs-{{ emacs_version }}" diff --git a/roles/wiki-publish/tasks/emacs.yml b/roles/wiki-publish/tasks/emacs.yml new file mode 100644 index 0000000..8d75979 --- /dev/null +++ b/roles/wiki-publish/tasks/emacs.yml @@ -0,0 +1,38 @@ +- name: Install dependencies + apt: + name: + - build-essential + - libncurses5-dev + - git + - gnutls-bin + - pkg-config + - libjansson-dev + - libgnutls28-dev + - automake + - texinfo + state: present +- name: Create directory + file: + path: "{{ emacs_build_parent }}" + state: directory +- name: Download Emacs + unarchive: + src: https://ftp.gnu.org/gnu/emacs/emacs-{{emacs_version}}.tar.gz + remote_src: yes + dest: "{{ emacs_build_parent }}" + creates: "{{ emacs_build_dir }}" +- name: Configure + command: ./configure --with-x-toolkit=no + args: + chdir: "{{ emacs_build_dir }}" + creates: '{{ emacs_build_dir }}/Makefile' +- name: Build + command: make -j{{ cpus }} + args: + chdir: "{{ emacs_build_dir }}" + creates: '{{ emacs_build_dir }}/src/emacs' +- name: Install + command: make install + args: + chdir: "{{ emacs_build_dir }}" + creates: '/usr/local/bin/emacs' diff --git a/roles/wiki-publish/tasks/main.yml b/roles/wiki-publish/tasks/main.yml index 960aa01..28566a5 100644 --- a/roles/wiki-publish/tasks/main.yml +++ b/roles/wiki-publish/tasks/main.yml @@ -1,45 +1,44 @@ --- - name: Set up SSH directory ansible.builtin.file: - path: "/home/{{ emacsconf_publish_user }}/.ssh" + path: "/home/{{ emacsconf_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/{{ emacsconf_publish_user }}/.ssh/id_rsa_anon_git_emacsconf" + dest: "/home/{{ emacsconf_user }}/.ssh/id_rsa_anon_git_emacsconf" mode: '0600' - 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 - # 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_package }}" - state: present +- name: Install the SSH key for orga + template: + src: id_rsa + dest: "/home/{{ emacsconf_user }}/.ssh/id_rsa" + mode: '0600' +- name: Change ownership of SSH directory + file: + path: "/home/{{ emacsconf_user }}/.ssh" + recurse: true + owner: "{{ emacsconf_user }}" + +- name: Set up Emacs + include: emacs.yml +- name: Ensure configuration directory exists + file: + path: "{{ emacs_config_dir }}" + state: directory - 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\")" + create: yes - name: Set up or update repositories become: false tags: publish @@ -71,6 +70,16 @@ - private.failed - not 'Local modifications exist in repository' in private.msg - not 'Failed to checkout branch' in private.msg +- name: Change ownership + file: + path: "{{ item }}" + owner: "{{ emacsconf_user }}" + recurse: true + with_items: + - "{{ emacsconf_config_dir }}" + - "{{ emacsconf_el_dir }}" + - "{{ emacsconf_private_dir }}" + - "{{ emacsconf_edit_wiki_dir }}" - name: Publish tags: publish block: |