forked from facebook/chef-cookbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fb_systemd: properly manage all systemd daemons
Summary: ensure we manage state and config for all the systemd daemons Reviewed By: bwann Differential Revision: D3330184 fbshipit-source-id: dee9871908e2baaeb199265e98cc1a25a3e109a5
- Loading branch information
Showing
14 changed files
with
385 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# | ||
# Cookbook Name:: fb_systemd | ||
# Recipe:: logind | ||
# | ||
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2 | ||
# | ||
# Copyright (c) 2016-present, Facebook, Inc. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. An additional grant | ||
# of patent rights can be found in the PATENTS file in the same directory. | ||
# | ||
|
||
template '/etc/systemd/logind.conf' do | ||
source 'systemd.conf.erb' | ||
owner 'root' | ||
group 'root' | ||
mode '0644' | ||
variables( | ||
:config => 'logind', | ||
:section => 'Login', | ||
) | ||
# we use :immediately here because this is a critical service for user | ||
# sessions to work | ||
notifies :restart, 'service[systemd-logind]', :immediately | ||
end | ||
|
||
service 'systemd-logind' do | ||
only_if { node['fb_systemd']['logind']['enable'] } | ||
action [:enable, :start] | ||
end | ||
|
||
service 'disable systemd-logind' do | ||
service_name 'systemd-logind' | ||
not_if { node['fb_systemd']['logind']['enable'] } | ||
action [:stop, :disable] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# | ||
# Cookbook Name:: fb_systemd | ||
# Recipe:: networkd | ||
# | ||
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2 | ||
# | ||
# Copyright (c) 2016-present, Facebook, Inc. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. An additional grant | ||
# of patent rights can be found in the PATENTS file in the same directory. | ||
# | ||
|
||
service 'systemd-networkd' do | ||
only_if { node['fb_systemd']['networkd']['enable'] } | ||
action [:enable, :start] | ||
end | ||
|
||
service 'disable systemd-networkd' do | ||
not_if { node['fb_systemd']['networkd']['enable'] } | ||
service_name 'systemd-networkd' | ||
action [:stop, :disable] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# | ||
# Cookbook Name:: fb_systemd | ||
# Recipe:: resolved | ||
# | ||
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2 | ||
# | ||
# Copyright (c) 2016-present, Facebook, Inc. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. An additional grant | ||
# of patent rights can be found in the PATENTS file in the same directory. | ||
# | ||
|
||
template '/etc/systemd/resolved.conf' do | ||
source 'systemd.conf.erb' | ||
owner 'root' | ||
group 'root' | ||
mode '0644' | ||
variables( | ||
:config => 'resolved', | ||
:section => 'Resolve', | ||
) | ||
notifies :restart, 'service[systemd-resolved]' | ||
end | ||
|
||
service 'systemd-resolved' do | ||
only_if { node['fb_systemd']['resolved']['enable'] } | ||
action [:enable, :start] | ||
end | ||
|
||
service 'disable systemd-resolved' do | ||
not_if { node['fb_systemd']['resolved']['enable'] } | ||
service_name 'systemd-resolved' | ||
action [:stop, :disable] | ||
end |
Oops, something went wrong.