aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/hosts.rst6
-rw-r--r--src/package.lisp7
-rw-r--r--src/property/network.lisp19
3 files changed, 30 insertions, 2 deletions
diff --git a/doc/hosts.rst b/doc/hosts.rst
index 1f8a56c..a66fb3b 100644
--- a/doc/hosts.rst
+++ b/doc/hosts.rst
@@ -31,6 +31,12 @@ keyword symbols. The semantics of these attributes are documented here:
- ``:HOSTNAME``: the host's hostname -- if the host has a domain name, then
the FQDN, not just the part before the first dot
+- ``:ALIASES``: see ``NETWORK:ALIASES``
+
+- ``:IPV4``: the host's IPv4 addresses
+
+- ``:IPV6``: the host's IPv6 addresses
+
- ``:DATA``: items of prerequisite data required by the host
- ``:OS``: the operating system of the host
diff --git a/src/package.lisp b/src/package.lisp
index dab697a..4e8fed3 100644
--- a/src/package.lisp
+++ b/src/package.lisp
@@ -611,10 +611,13 @@
#:search-configured))
(defpackage :consfigurator.property.network
- (:use #:cl #:consfigurator)
+ (:use #:cl #:alexandria #:consfigurator)
(:local-nicknames (#:os #:consfigurator.property.os)
(#:file #:consfigurator.property.file))
- (:export #:static))
+ (:export #:aliases
+ #:ipv4
+ #:ipv6
+ #:static))
(defpackage :consfigurator.property.libvirt
(:use #:cl #:alexandria #:consfigurator)
diff --git a/src/property/network.lisp b/src/property/network.lisp
index 59d34b0..7a909ff 100644
--- a/src/property/network.lisp
+++ b/src/property/network.lisp
@@ -18,6 +18,25 @@
(in-package :consfigurator.property.network)
(named-readtables:in-readtable :consfigurator)
+(defprop aliases :posix (&rest aliases)
+ "Record other DNS names by which the host is known. For example, a mail
+server might have aliases like imap.example.org and smtp.example.org, even
+though its hostname is neither 'imap' nor 'smtp'."
+ (:desc (format nil "Has alias~1{~#[es~;~;es~]~} ~:*~{~A~^, ~}" aliases))
+ (:hostattrs (apply #'pushnew-hostattrs
+ :aliases (delete (get-hostname) (flatten aliases)
+ :test #'string=))))
+
+(defprop ipv4 :posix (&rest addresses)
+ "Record the host's IPv4 addresses."
+ (:desc (format nil "Has IPv4 ~{~A~^, ~}" addresses))
+ (:hostattrs (apply #'pushnew-hostattrs :ipv4 (flatten addresses))))
+
+(defprop ipv6 :posix (&rest addresses)
+ "Record the host's IPv6 addresses."
+ (:desc (format nil "Has IPv6 ~{~A~^, ~}" addresses))
+ (:hostattrs (apply #'pushnew-hostattrs :ipv6 (flatten addresses))))
+
(defprop static :posix (interface address &optional gateway &rest options)
"Configures an interface with a static IP address.
OPTIONS is a list of even length of alternating keys and values."