Skip to content

Commit cf62e63

Browse files
wujj123456facebook-github-bot
authored andcommitted
option to manage journald config with dropin
Differential Revision: D73479410 fbshipit-source-id: 7f8fb9adab4a9ca36a4640470ba98e9dbd90aa65
1 parent 7647f06 commit cf62e63

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

cookbooks/fb_systemd/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Attributes
1414
* node['fb_systemd']['udevd']['hwdb']
1515
* node['fb_systemd']['udevd']['rules']
1616
* node['fb_systemd']['journald']['config']
17+
* node['fb_systemd']['journald']['manage_config_with_dropin']
1718
* node['fb_systemd']['journal-gatewayd']['enable']
1819
* node['fb_systemd']['journal-remote']['enable']
1920
* node['fb_systemd']['journal-remote']['config']
@@ -273,6 +274,10 @@ configure journald to use the 'auto' storage (disk if the log directory exists,
273274
or ram otherwise, which is the default for most distros). You can change these
274275
settings and more through `node['fb_systemd']['journald']['config']`.
275276

277+
If `node['fb_systemd']['journald']['manage_config_with_dropin']` is `true`, a
278+
dropin will be used to implement the journald config. If `false`, chef
279+
overwrites `/etc/systemd/journald.conf` directly.
280+
276281
Refer to the
277282
[journald documentation](https://www.freedesktop.org/software/systemd/man/journald.conf.html)
278283
for more details on possible configurations.

cookbooks/fb_systemd/attributes/default.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
'config' => {
9393
'Storage' => 'auto',
9494
},
95+
'manage_config_with_dropin' => false,
9596
},
9697
'journal-gatewayd' => {
9798
'enable' => false,

cookbooks/fb_systemd/recipes/journald.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,19 @@
1818
# limitations under the License.
1919
#
2020

21-
template '/etc/systemd/journald.conf' do
21+
if node['fb_systemd']['journald']['manage_config_with_dropin']
22+
directory '/etc/systemd/journald.conf.d' do
23+
owner node.root_user
24+
group node.root_group
25+
mode '0644'
26+
action :create
27+
end
28+
journald_conf = '/etc/systemd/journald.conf.d/90-chef.conf'
29+
else
30+
journald_conf = '/etc/systemd/journald.conf'
31+
end
32+
33+
template journald_conf do
2234
source 'systemd.conf.erb'
2335
owner node.root_user
2436
group node.root_group

0 commit comments

Comments
 (0)