# We need a recent version of node - name: FAIL (STOP INSTALLING) IF nodejs_version is not set to 10.x fail: msg: "Archorg install cannot proceeed, as it currently requires Node.js 10.x, and your nodejs_version is set to {{ nodejs_version }}. Please check the value of nodejs_version in /opt/iiab/iiab/vars/default_vars.yml and possibly also /etc/iiab/local_vars.yml" when: distweb_install and (nodejs_version != "10.x") - name: Clone distributed web mirror supported by Internet Archive git: repo: https://github.com/internetarchive/dweb-mirror dest: "{{ distweb_dir }}" force: yes depth: 1 when: internet_available - name: Install packages needed by Distributed Web package: name: - libsecret-1-dev - cmake state: present - name: Run 'npm install --allow-root --unsafe-perm=true' to create /opt/iiab/distweb/node_modules (CAN TAKE ~5 MINUTES) command: npm install --allow-root --unsafe-perm=true args: chdir: "{{ distweb_dir }}" # CONFIG FILES - name: "Install from templates: distweb.service (systemd), distweb.conf (Apache)" template: src: "{{ item.src }}" dest: "{{ item.dest }}" mode: 0644 owner: root group: root with_items: - { src: 'distweb.service.j2', dest: '/etc/systemd/system/distweb.service' } - { src: 'distweb.conf', dest: '/etc/apache2/sites-available/distweb.conf' } - name: Create symlink distweb.conf from sites-enabled to sites-available, for short URLs http://box/sugar & http://box/distweb (if distweb_enabled) file: src: /etc/apache2/sites-available/distweb.conf path: /etc/apache2/sites-enabled/distweb.conf state: link when: distweb_enabled and is_debuntu - name: Remove symlink /etc/apache2/sites-enabled/distweb.conf (if not distweb_enabled) file: path: /etc/apache2/sites-enabled/distweb.conf state: absent when: not distweb_enabled and is_debuntu # RESTART/STOP SYSTEMD SERVICE # with "systemctl daemon-reload" in case mongodb.service changed, etc - name: Enable & Restart 'distweb' systemd service (if distweb_enabled) systemd: name: distweb daemon_reload: yes enabled: yes state: restarted when: distweb_enabled - name: Disable & Stop 'distweb' systemd service (if not distweb_enabled) systemd: name: distweb daemon_reload: yes enabled: no state: stopped when: not distweb_enabled - name: Restart Apache service ({{ apache_service }}) to enable/disable http://box/distweb (not just http://box:{{ distweb_port }}) systemd: name: "{{ apache_service }}" # httpd or apache2 state: restarted when: distweb_enabled - name: Add 'distweb' variable values to {{ iiab_ini_file }} ini_file: path: "{{ iiab_ini_file }}" section: distweb option: "{{ item.option }}" value: "{{ item.value }}" with_items: - option: name value: Archive Org Distributed Web - option: description value: '"Dweb-mirror is intended to make the Internet Archive experience and UI available offline."' - option: distweb_enabled value: "{{ distweb_enabled }}"