diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-06-22 12:39:23 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-06-22 12:39:23 -0700 |
commit | 580b01a5693f6bd3d0dd42f11a94e96826b84c1a (patch) | |
tree | 1cd213cb9ec027191bc612c2ad62d81962c2a321 | |
parent | 94de55d1d801c9bec93224d2b21b0b9db043baae (diff) | |
download | consfigurator-580b01a5693f6bd3d0dd42f11a94e96826b84c1a.tar.gz |
add some basic Apache web server properties
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r-- | consfigurator.asd | 1 | ||||
-rw-r--r-- | src/package.lisp | 11 | ||||
-rw-r--r-- | src/property/apache.lisp | 52 |
3 files changed, 64 insertions, 0 deletions
diff --git a/consfigurator.asd b/consfigurator.asd index a089c49..830c65b 100644 --- a/consfigurator.asd +++ b/consfigurator.asd @@ -58,6 +58,7 @@ (:file "src/property/sbuild") (:file "src/property/postfix") (:file "src/property/cron") + (:file "src/property/apache") (:file "src/connection/shell-wrap") (:file "src/connection/fork") (:file "src/connection/rehome") diff --git a/src/package.lisp b/src/package.lisp index 88ac6a2..080a7af 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -688,6 +688,17 @@ (:export #:system-job #:nice-system-job)) +(defpackage :consfigurator.property.apache + (:use #:cl #:consfigurator) + (:local-nicknames (#:service #:consfigurator.property.service) + (#:apt #:consfigurator.property.apt) + (#:os #:consfigurator.property.os) + (#:file #:consfigurator.property.file)) + (:export #:installed + #:reloaded + #:mod-enabled + #:conf-enabled)) + (defpackage :consfigurator.connection.local (:use #:cl #:consfigurator #:alexandria) (:export #:local-connection)) diff --git a/src/property/apache.lisp b/src/property/apache.lisp new file mode 100644 index 0000000..f718631 --- /dev/null +++ b/src/property/apache.lisp @@ -0,0 +1,52 @@ +;;; Consfigurator -- Lisp declarative configuration management system + +;;; Copyright (C) 2021 Sean Whitton <spwhitton@spwhitton.name> + +;;; This file is free software; you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3, or (at your option) +;;; any later version. + +;;; This file is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. + +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +(in-package :consfigurator.property.apache) +(named-readtables:in-readtable :consfigurator) + +(defproplist installed :posix () + (:desc "Apache installed") + (os:etypecase + (debianlike (apt:installed "apache2")))) + +(defproplist reloaded :posix () + (:desc "Apache reloaded") + (service:reloaded "apache2")) + +(defprop %mod-enabled :posix (name) + (:hostattrs (os:required 'os:debianlike)) + (:check (zerop (mrun :for-exit "a2query" "-q" "-m" name))) + (:apply (mrun "a2enmod" "--quiet" name)) + (:unapply (mrun "a2dismod" "--quiet" name))) + +(defproplist mod-enabled :posix (name) + (:desc #?"Apache module ${name} enabled") + (installed) + (on-change (%mod-enabled name) + (reloaded))) + +(defprop %conf-enabled :posix (name) + (:hostattrs (os:required 'os:debianlike)) + (:check (zerop (mrun :for-exit "a2query" "-q" "-c" name))) + (:apply (mrun "a2enconf" "--quiet" name)) + (:unapply (mrun "a2disconf" "--quiet" name))) + +(defproplist conf-enabled :posix (name) + (:desc #?"Apache configuration ${name} enabled") + (installed) + (on-change (%conf-enabled name) + (reloaded))) |