Add systemd module, required by rabbitmq
[mirror/dsa-puppet.git] / 3rdparty / modules / systemd / manifests / init.pp
1 # This module allows triggering systemd commands once for all modules
2 #
3 # @api public
4 #
5 # @param service_limits
6 #   May be passed a resource hash suitable for passing directly into the
7 #   ``create_resources()`` function as called on ``systemd::service_limits``
8 #
9 # @param manage_resolved
10 #   Manage the systemd resolver
11 #
12 # @param resolved_ensure
13 #   The state that the ``resolved`` service should be in
14 #
15 # @param dns
16 #   A space-separated list of IPv4 and IPv6 addresses to use as system DNS servers.
17 #   DNS requests are sent to one of the listed DNS servers in parallel to suitable
18 #   per-link DNS servers acquired from systemd-networkd.service(8) or set at runtime
19 #   by external applications. requires puppetlabs-inifile
20 #
21 # @param fallback_dns
22 #   A space-separated list of IPv4 and IPv6 addresses to use as the fallback DNS
23 #   servers. Any per-link DNS servers obtained from systemd-networkd take
24 #   precedence over this setting. requires puppetlabs-inifile
25 #
26 # @param domains
27 #   A space-separated list of domains host names or IP addresses to be used
28 #   systemd-resolved take precedence over this setting.
29 #
30 # @param llmnr
31 #   Takes a boolean argument or "resolve".
32 #
33 # @param multicast_dns
34 #   Takes a boolean argument or "resolve".
35 #
36 # @param dnssec
37 #   Takes a boolean argument or "allow-downgrade".
38 #
39 # @param cache
40 #   Takes a boolean argument.
41 #
42 # @param dns_stub_listener
43 #   Takes a boolean argument or one of "udp" and "tcp".
44 #
45 # @param use_stub_resolver
46 #   Takes a boolean argument. When "false" (default) it uses /var/run/systemd/resolve/resolv.conf
47 #   as /etc/resolv.conf. When "true", it uses /var/run/systemd/resolve/stub-resolv.conf
48 # @param manage_networkd
49 #   Manage the systemd network daemon
50 #
51 # @param networkd_ensure
52 #   The state that the ``networkd`` service should be in
53 #
54 # @param manage_timesyncd
55 #   Manage the systemd tiemsyncd daemon
56 #
57 # @param timesyncd_ensure
58 #   The state that the ``timesyncd`` service should be in
59 #
60 # @param ntp_server
61 #   comma separated list of ntp servers, will be combined with interface specific
62 #   addresses from systemd-networkd. requires puppetlabs-inifile
63 #
64 # @param fallback_ntp_server
65 #   A space-separated list of NTP server host names or IP addresses to be used
66 #   as the fallback NTP servers. Any per-interface NTP servers obtained from
67 #   systemd-networkd take precedence over this setting. requires puppetlabs-inifile
68 class systemd (
69   Hash[String,Hash[String, Any]]                     $service_limits,
70   Boolean                                            $manage_resolved,
71   Enum['stopped','running']                          $resolved_ensure,
72   Optional[Variant[Array[String],String]]            $dns,
73   Optional[Variant[Array[String],String]]            $fallback_dns,
74   Optional[Variant[Array[String],String]]            $domains,
75   Optional[Variant[Boolean,Enum['resolve']]]         $llmnr,
76   Optional[Variant[Boolean,Enum['resolve']]]         $multicast_dns,
77   Optional[Variant[Boolean,Enum['allow-downgrade']]] $dnssec,
78   Boolean                                            $cache,
79   Optional[Variant[Boolean,Enum['udp','tcp']]]       $dns_stub_listener,
80   Boolean                                            $use_stub_resolver,
81   Boolean                                            $manage_networkd,
82   Enum['stopped','running']                          $networkd_ensure,
83   Boolean                                            $manage_timesyncd,
84   Enum['stopped','running']                          $timesyncd_ensure,
85   Optional[Variant[Array,String]]                    $ntp_server,
86   Optional[Variant[Array,String]]                    $fallback_ntp_server,
87   Boolean                                            $manage_accounting,
88   Hash[String,String]                                $accounting,
89 ){
90
91   contain systemd::systemctl::daemon_reload
92
93   create_resources('systemd::service_limits', $service_limits)
94
95   if $manage_resolved and $facts['systemd_internal_services'] and $facts['systemd_internal_services']['systemd-resolved.service'] {
96     contain systemd::resolved
97   }
98
99   if $manage_networkd and $facts['systemd_internal_services'] and $facts['systemd_internal_services']['systemd-networkd.service'] {
100     contain systemd::networkd
101   }
102
103   if $manage_timesyncd and $facts['systemd_internal_services'] and $facts['systemd_internal_services']['systemd-timesyncd.service'] {
104     contain systemd::timesyncd
105   }
106
107   if $manage_accounting {
108     contain systemd::system
109   }
110 }