From 07e05de0806a7d7baf39b3d0b29dd4a2fe1e2a3c Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Mon, 22 Dec 2025 09:18:32 -0700 Subject: [PATCH] Execute gitweb tasks before configuring Apache. Otherwise the apache2_module will fail, unable to validate an incomplete configuration. --- README.org | 8 ++-- roles_t/abbey-core/tasks/main.yml | 68 +++++++++++++++--------------- roles_t/abbey-front/tasks/main.yml | 68 +++++++++++++++--------------- 3 files changed, 72 insertions(+), 72 deletions(-) diff --git a/README.org b/README.org index f2cb1e8..e3eda9f 100644 --- a/README.org +++ b/README.org @@ -451,6 +451,8 @@ rest of the Let's Encrypt configuration is discussed in the following #+CAPTION: [[file:roles_t/abbey-front/tasks/main.yml][=roles_t/abbey-front/tasks/main.yml=]] #+BEGIN_SRC conf :tangle roles_t/abbey-front/tasks/main.yml :noweb no-export +<> + - name: Configure Apache. become: yes vars: @@ -464,8 +466,6 @@ rest of the Let's Encrypt configuration is discussed in the following IncludeOptional /etc/letsencrypt/options-ssl-apache.conf dest: /etc/apache2/sites-available/birchwood-abbey.net-vhost.conf notify: Restart Apache2. - -<> #+END_SRC #+CAPTION: [[file:roles_t/abbey-front/handlers/main.yml][=roles_t/abbey-front/handlers/main.yml=]] @@ -964,6 +964,8 @@ site on Front. Their configurations include the same [[apache-abbey][~apache-ab #+CAPTION: [[file:roles_t/abbey-core/tasks/main.yml][=roles_t/abbey-core/tasks/main.yml=]] #+BEGIN_SRC conf :tangle roles_t/abbey-core/tasks/main.yml :noweb no-export +<> + - name: Configure live website. become: yes vars: @@ -989,8 +991,6 @@ site on Front. Their configurations include the same [[apache-abbey][~apache-ab dest: /etc/apache2/sites-available/test-vhost.conf mode: u=rw,g=r,o=r notify: Restart Apache2. - -<> #+END_SRC #+CAPTION: [[file:roles_t/abbey-core/handlers/main.yml][=roles_t/abbey-core/handlers/main.yml=]] diff --git a/roles_t/abbey-core/tasks/main.yml b/roles_t/abbey-core/tasks/main.yml index c8191aa..7ffca9e 100644 --- a/roles_t/abbey-core/tasks/main.yml +++ b/roles_t/abbey-core/tasks/main.yml @@ -49,6 +49,40 @@ group: staff mode: u=rwx,g=srwx,o=rx +- name: Enable Apache2 rewrite module for Gitweb. + become: yes + apache2_module: name=rewrite + notify: Restart Apache2. + +- name: Enable Apache2 cgid module. + become: yes + apache2_module: name=cgid + notify: Restart Apache2. + +- name: Install libcgi-pm-perl for Gitweb. + become: yes + apt: pkg=libcgi-pm-perl + +- name: Link Gitweb into /cgi-bin/. + become: yes + file: + state: link + path: /usr/lib/cgi-bin/{{ item }} + src: /usr/share/gitweb/{{ item }} + loop: [ gitweb.cgi, index.cgi ] + +- name: Override Gitweb assets location. + become: yes + copy: + content: | + $projectroot = $ENV{'GITWEB_PROJECTROOT'} || "/var/www/git"; + @stylesheets = ("/gitweb-static/gitweb.css"); + $logo = "/gitweb-static/git-logo.png"; + $favicon = "/favicon.ico"; + $javascript = "/gitweb-static/gitweb.js"; + dest: /etc/gitweb.conf + mode: u=rw,g=r,o=r + - name: Configure live website. become: yes vars: @@ -117,40 +151,6 @@ mode: u=rw,g=r,o=r notify: Restart Apache2. -- name: Enable Apache2 rewrite module for Gitweb. - become: yes - apache2_module: name=rewrite - notify: Restart Apache2. - -- name: Enable Apache2 cgid module. - become: yes - apache2_module: name=cgid - notify: Restart Apache2. - -- name: Install libcgi-pm-perl for Gitweb. - become: yes - apt: pkg=libcgi-pm-perl - -- name: Link Gitweb into /cgi-bin/. - become: yes - file: - state: link - path: /usr/lib/cgi-bin/{{ item }} - src: /usr/share/gitweb/{{ item }} - loop: [ gitweb.cgi, index.cgi ] - -- name: Override Gitweb assets location. - become: yes - copy: - content: | - $projectroot = $ENV{'GITWEB_PROJECTROOT'} || "/var/www/git"; - @stylesheets = ("/gitweb-static/gitweb.css"); - $logo = "/gitweb-static/git-logo.png"; - $favicon = "/favicon.ico"; - $javascript = "/gitweb-static/gitweb.js"; - dest: /etc/gitweb.conf - mode: u=rw,g=r,o=r - - name: Configure house website. become: yes copy: diff --git a/roles_t/abbey-front/tasks/main.yml b/roles_t/abbey-front/tasks/main.yml index 168b195..ca31e82 100644 --- a/roles_t/abbey-front/tasks/main.yml +++ b/roles_t/abbey-front/tasks/main.yml @@ -48,6 +48,40 @@ group: staff mode: u=rwx,g=srwx,o=rx +- name: Enable Apache2 rewrite module for Gitweb. + become: yes + apache2_module: name=rewrite + notify: Restart Apache2. + +- name: Enable Apache2 cgid module. + become: yes + apache2_module: name=cgid + notify: Restart Apache2. + +- name: Install libcgi-pm-perl for Gitweb. + become: yes + apt: pkg=libcgi-pm-perl + +- name: Link Gitweb into /cgi-bin/. + become: yes + file: + state: link + path: /usr/lib/cgi-bin/{{ item }} + src: /usr/share/gitweb/{{ item }} + loop: [ gitweb.cgi, index.cgi ] + +- name: Override Gitweb assets location. + become: yes + copy: + content: | + $projectroot = $ENV{'GITWEB_PROJECTROOT'} || "/var/www/git"; + @stylesheets = ("/gitweb-static/gitweb.css"); + $logo = "/gitweb-static/git-logo.png"; + $favicon = "/favicon.ico"; + $javascript = "/gitweb-static/gitweb.js"; + dest: /etc/gitweb.conf + mode: u=rw,g=r,o=r + - name: Configure Apache. become: yes vars: @@ -83,40 +117,6 @@ dest: /etc/apache2/sites-available/birchwood-abbey.net-vhost.conf notify: Restart Apache2. -- name: Enable Apache2 rewrite module for Gitweb. - become: yes - apache2_module: name=rewrite - notify: Restart Apache2. - -- name: Enable Apache2 cgid module. - become: yes - apache2_module: name=cgid - notify: Restart Apache2. - -- name: Install libcgi-pm-perl for Gitweb. - become: yes - apt: pkg=libcgi-pm-perl - -- name: Link Gitweb into /cgi-bin/. - become: yes - file: - state: link - path: /usr/lib/cgi-bin/{{ item }} - src: /usr/share/gitweb/{{ item }} - loop: [ gitweb.cgi, index.cgi ] - -- name: Override Gitweb assets location. - become: yes - copy: - content: | - $projectroot = $ENV{'GITWEB_PROJECTROOT'} || "/var/www/git"; - @stylesheets = ("/gitweb-static/gitweb.css"); - $logo = "/gitweb-static/git-logo.png"; - $favicon = "/favicon.ico"; - $javascript = "/gitweb-static/gitweb.js"; - dest: /etc/gitweb.conf - mode: u=rw,g=r,o=r - - name: Configure Apache log archival. become: yes lineinfile: -- 2.47.3