Serverspec サービスの状態を検証するサンプル

環境
AlmaLinux release 9.2 (Turquoise Kodkod)
Serverspec

構文

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
describe service('サービス名') do
it { should be_running }
it { should be_enabled }
end
describe service('サービス名') do it { should be_running } it { should be_enabled } end
describe service('サービス名') do
  it { should be_running }
  it { should be_enabled }
end

be_enabledで、サービスの自動起動が有効化されていること検証します。

操作例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
describe service('httpd') do
it { should be_running }
it { should be_enabled }
end
describe service('httpd') do it { should be_running } it { should be_enabled } end
describe service('httpd') do
  it { should be_running }
  it { should be_enabled }
end

 

Ansible

Posted by arkgame