【CentOS7】serverspecをインストールする | 瀬戸内の雲のように

【CentOS7】serverspecをインストールする

Posted: 2018-03-27


スポンサーリンク

目次

背景

検証自動化と言えばIT業界で最もホットなキーワードの一つかと思います。そのためそういったツールもたくさん存在しますが、目的や用途に応じて使い分けられるといいですよね。

今回はサーバの設定や構成確認に使いやすい serverspec のインストールを行いたいと思います。

serverspecとは

日本人の方により作られたソフトウェアです。rubyで書かれています。
強みとしては、複数のプラットフォーム(OS)に対して同じコードが使えることです。つまりOSを意識せず使えます。

例えばインストール済みパッケージの確認はredhat系のOSならyum、debian系のOSならapt-getなどコマンドが違うわけですが、serverspecがその違いを吸収してくれます。

環境

  • CentOS Linux release 7.4.1708 (Core)
  • ruby 2.0.0p648 (2015-12-16) [x86_64-linux]

インストール手順

1. rubyのインストール

rubyのインストールはyumで行います。

yum install ruby

一発です。この時、gemも一緒にインストールされます。

 

2. serverspecのインストール

こちらはgemでインストールします。

gem install serverspec rake highline

またまた一発です。

 

3.インストール確認

インストールが完了したか確認します。

gem list serverspec

以下のような表示があればOKです。


*** LOCAL GEMS ***

serverspec (2.41.3)

 

4.簡単なテストの作成

テストの雛形を作るコマンドを実行します。

serverspec-init

以下のような対話型のインターフェイスになりますので、ここでは1, 2と入力します。

Select OS type:

  1) UN*X
  2) Windows

Select number: 1  ★入力

Select a backend type:

  1) SSH
  2) Exec (local)

Select number: 2  ★入力

 + spec/
 + spec/localhost/
 + spec/localhost/sample_spec.rb
 + spec/spec_helper.rb
 + Rakefile
 + .rspec

以下のようなディレクトリ・ファイルができていればOKです。

# ls -l
ll
合計 4
-rw-r--r-- 1 root root 685  3月 27 16:12 Rakefile
drwxr-xr-x 3 root root  45  3月 27 16:12 spec

 
この状態で、サンプルのテストができています。
今回は全部消した上で新しい内容を書きます。

vim spec/localhost/sample_spec.rb
require 'spec_helper'

describe package('ruby'), :if => os[:family] == 'redhat' do
  it { should be_installed }
end

 

5.テストの実行

以下コマンドで実行できます。

rake spec

実行結果が以下のようになっていれば成功です。

/usr/bin/ruby -I/usr/local/share/gems/gems/rspec-core-3.7.1/lib:/usr/local/share/gems/gems/rspec-support-3.7.1/lib /usr/local/share/gems/gems/rspec-core-3.7.1/exe/rspec --pattern spec/localhost/\*_spec.rb

Package "ruby"
  should be installed

Finished in 0.09948 seconds (files took 0.4563 seconds to load)
1 example, 0 failures

以上となります。

検証自動化というといろいろなツールが出てきていますが、特徴を見極めた上でうまく使い分けられれば素敵だな~と思っております。


スポンサーリンク




コメント一覧

2022/09/18 20:33:45

JoeteOaOaさん

freetalk45
date sites free
dating sites for seniors


2022/09/20 02:34:39

MarrisOaOaさん

the help essay prompts
help with argumentative essay
graduate school essay writing service


2022/09/20 21:58:56

DorolisaOaOaさん

custom college essay
what is the best college essay editing service
cheap essay writing service online


2022/09/21 20:13:33

MartyOaOaさん

cheap essay writing service online
help with an essay
help me essay


2022/09/22 15:50:44

MerolaOaOaさん

writing essay help
essay custom
essay writer


2022/09/23 11:39:34

AshlenOaOaさん

write my admissions essay
good essay writing company
write my essays


2022/09/25 01:20:58

CharitaOaOaさん

live essay help
best online essay writers
good essay writing services


2022/09/25 20:42:08

NaniceOaOaさん

custom essay org
buying essays
custom writing essays services


2022/09/26 15:53:00

ChelsaeOaOaさん

essays online to buy
write my essay for cheap
college entrance essay writing service


2022/09/27 10:06:32

Kuanevotさん

reduslim original reduslim reduslim telefono
que es reduslim y para quГ© se utiliza reduslim reduslim anabel pantoja
cialis 5mg prezzo cialis 5 mg cialis 5mg prezzo
https://sites.google.com/view/bitcoin-up-app/
reduslim sara carbonero es verdad 9b2d165


2022/09/27 11:11:44

PennyOaOaさん

please write my essay for me
essay about the help
college application essay help online


2022/09/28 07:06:08

TammieOaOaさん

write my essay reviews
best website for essays
scholarship essay help


2022/09/29 22:50:42

RhiamonOaOaさん

top custom essays
custom essay station
write my essay custom writing


2022/09/30 17:26:37

CharoOaOaさん

can i get someone to write my essay
essay writing services usa
help writing my college essay


2022/10/01 12:02:39

DronaOaOaさん

i need help writing an essay for college
online essay helper
essay paper writing service


2022/10/02 07:48:30

TwylaOaOaさん

buy custom essay online
buy essays online for college
help on essays


2022/07/07 23:01:01

AurlieOaOaさん

caesars online casino
123 slots
penny slots for free


2022/07/12 23:51:34

ShaynaOaOaさん

dissertation help india
premium dissertation writing service
creative writing lindenberg


2022/07/13 12:53:50

ShaynaOaOaさん

disertation
thesis defense
buy a dissertation online help


2022/07/19 20:30:38

ChandaOaOaさん

writing methodology for dissertation
dissertation handbook
writing dissertation methodology


2022/07/20 23:23:39

AvivaOaOaさん

dissertation help articles
best dissertation writing service review
dissertation help service quality


2022/07/22 13:54:25

VerieeOaOaさん

all but dissertation
[url="https://dissertationhelperhub.com"]phd dissertation help download[/url]
dissertation thesis writing


2022/07/23 16:10:00

GlynnisOaOaさん

writing a dissertation literature review
proquest dissertation
get help with dissertation


2022/07/24 10:39:28

SuzannOaOaさん

cheap dissertation help
help me
dissertation writing service


2022/07/25 05:18:47

SalliOaOaさん

phd dissertation writing service
custom dissertation writing service 2019
proposal and dissertation help plan


2022/07/25 20:54:01

TandiOaOaさん

casino bonus online
bovada online casino
top online casino real money


2022/07/26 02:15:19

DarsieOaOaさん

example of dissertation
buy dissertation
best dissertation writing


2022/07/26 22:05:01

TandiOaOaさん

casino sites
casino online real money
casino bonus


2022/07/27 00:26:27

MabelleOaOaさん

dissertation proposal template
custom dissertation writing
uk dissertation writing


2022/07/27 21:46:29

JenneeOaOaさん

what does dissertation mean
online dissertation help veroffentlichen
dissertation help near me


2022/07/27 23:00:01

AbagaelOaOaさん

free casinos bonus
casino deposit bonuses
gambling online for real money


2022/07/28 17:55:29

HerminaOaOaさん

dissertation review
dissertation writing advice
average dissertation length


2022/07/28 22:25:13

ShaylaOaOaさん

no deposit casino bonus
online real casino
united states online casino


2022/07/29 06:57:44

Jariewereさん

Ou Acheter Du Cialis Forum cialis on line


2022/07/29 13:40:58

AudreOaOaさん

dissertation proofreading services
doctoral dissertation help thesis
writing dissertation and grant proposals


2022/07/29 21:13:06

VerenaOaOaさん

online casino free bonus no deposit
bingo online for money
online casino free bonus


2022/07/30 09:20:11

HestiaOaOaさん

dissertation acknowledgement sample
dissertation writers
phd dissertation help proposal


2022/07/30 19:38:17

DixieOaOaさん

online casino reviews usa
online casino game real money
best casino welcome bonus


2022/07/31 17:32:08

LaureenOaOaさん

best welcome bonus casino
best no deposit bonus
online casino sign up bonuses


2022/08/01 18:21:28

FranniOaOaさん

mobile casino real money
free casino bonus
slotos


2022/08/02 16:45:17

PearlOaOaさん

casino usa online
cash casino games
casino sites


2022/08/03 15:15:09

BobbieOaOaさん

casino bonuses online
mobile online casino
casino bonuses online


2022/08/04 13:27:45

LeslieOaOaさん

casino sign up bonus
best free casino bonus no deposit
casino games that pay real money


2022/08/08 02:51:37

HonorOaOaさん

vpn free
where to buy vpn router
private vpn


2022/08/08 12:51:47

JaynellOaOaさん

cash casino games
online casino free bonus no deposit
casino no deposit bonus


2022/08/08 23:44:31

TeddieOaOaさん

tunnelbear vpn free
best vpn for mlb tv
good vpn free


2022/08/09 21:07:54

DulceaOaOaさん

the best online casino
win real money online
kasino bonus


2022/08/10 07:50:20

JenneeOaOaさん

free pc vpn
best free vpn for pc
best vpn service 2022


2022/08/10 20:33:12

CarolanOaOaさん

top usa online casinos
online gambling real money
casino online bonus


2022/08/11 03:56:14

JenneeOaOaさん

download free vpn
trust zone vpn
best free mobile vpn


2022/08/11 20:01:50

FanyaOaOaさん

free welcome bonus
best welcome bonus online casino
top online casinos usa


2022/08/12 00:40:31

AshleighOaOaさん

buy indian vpn
buy usa vpn
best vpn router 2022


2022/08/12 21:08:48

CarolinOaOaさん

gambling online for real money
bonus casino online
casino usa online


2022/08/12 22:58:04

KelseyOaOaさん

free vpn for torrenting
reddit best vpn
how to use a vpn


2022/08/13 19:16:54

FifineOaOaさん

best online blackjack
no deposit online casino
deposit bonus casino


2022/08/14 14:48:33

FifineOaOaさん

bonus online casino
casino games for real money
online casino bonuses


2022/08/15 10:58:59

FifineOaOaさん

online casino with free signup bonus real money usa no deposit
bonus no deposit
online casinos for usa players


2022/08/15 21:41:30

SheelaghOaOaさん

best free vpn windows
which vpn is best
buy vpn for china


2022/08/16 09:59:20

GwenoreOaOaさん

casino bonuses
no deposit welcome bonus
safe online casino


2022/08/18 03:19:16

Piniwhipsさん

tab ivermectin 3mg Propecia Drug Interactions


2022/08/19 18:26:36

encathyさん

stromectol france Order Synthroid No Prescription


2022/08/24 01:45:24

GladiOaOaさん

gay sadistic men dating cite
gay hairy men dating sites
dating gay costa rican


2022/08/24 15:16:36

JoannOaOaさん

woman dating sites
singles near me
online sex dating


2022/08/26 01:52:41

BertheOaOaさん

onlinelovedating
free adult dating sites
zoosk online dating site


2022/08/26 23:07:37

KaitlynnOaOaさん

dating services contact china
dating club
video dating


2022/08/27 20:24:27

DavinaOaOaさん

dating personals
adult chat dating site
shemale dating


2022/08/28 09:17:02

GladiOaOaさん

young gay boys looking for daddies dating
gay/bi dating apps
gay dating sites for people in the closet


2022/08/28 18:32:03

ChelsaeOaOaさん

facebook dating
free online chat and dating sites
best dating site


2022/08/29 04:26:35

JeraleeOaOaさん

gay dating sites that work on windows free
gay mature dating sites
good gay chub dating sites


2022/08/29 16:55:01

EmaliaOaOaさん

adult dating
adult online dating
meet singles free


2022/08/29 23:56:26

KyrstinOaOaさん

gay dating apps for pc
gay dating sites black dating white
gay bear mens dating


2022/08/30 14:50:15

KarryOaOaさん

dating services online
dating services
senior dating services


2022/08/30 20:22:44

CasandraOaOaさん

online usa casinos
best casino deposit bonus
free online games to win real money no deposit


2022/08/31 13:19:27

LettiOaOaさん

dating near me free
mature woman dating pictures
online free dating sites


2022/08/31 15:42:37

AmataOaOaさん

no deposit bonus online casino
best online casino for us players
casino win real money


2022/09/01 00:49:48

Inwableさん

Erectile dysfunction, the inability to get or keep an erection during sexual activity, happens when the penile erection chambers fail to generate and maintain the high pressures that characterize a fully hard erection buying cialis online For example, a Cialis brand that can be found and priced online at one place and then another as low as 15, is likely going to offer the same Cialis on one site and the cost will be very much higher if you go through the hassle of searching for the Cialis across several site


2022/09/01 18:16:26

gyclidaさん

The investigator s assessment of the relationship of each adverse event to the study treatment was recorded throughout the study discreet cialis meds


2022/09/02 02:55:39

LettiOaOaさん

fdating login
singles dating site
hinge dating site


2022/09/02 09:14:30

GennieOaOaさん

gay chat toom
chat de gay usa avenue
gay chat rout


2022/09/03 04:47:02

DeeynOaOaさん

dick.net gay chat
[url="https://free-gay-sex-chat.com"]zoom cam rooms gay chat[/url]
gay video chat apps


2022/09/03 23:24:39

oxysleltyさん

While Viagra can allow men to achieve and maintain an erection for four to six hours, Cialis improves most men s erectile function for up to 18 hours and can last up to 36 hours priligy seratonin


2022/09/04 00:01:55

EmaleeOaOaさん

gay chat room upstate sc
gay chat 877 *** 7000
gay video chat sites realty to dirty roulette


2022/09/04 19:01:32

StephineOaOaさん

gay phont chat
gay chat websites
gay vid chat


2022/09/05 03:16:06

Caulapyさん

For this reason, these two formulations are not equivalent milligram for milligram and therefore are not interchangeable cialis 10mg


2022/09/05 21:57:43

attatryさん

generic cialis from india Statistical Analyses


2022/09/07 05:38:27

kapcreaspさん

Then there s Bacon Flavored Lube and almost instantly everything in me screams no, JUST cialis no prescription E-Mail, nutrition, with economical and machine 2 senses things in policymaking program that this central saint martins and foreign office


2022/09/07 11:40:27

RobenaOaOaさん

gay connect chat
[url="https://gaychatspots.com"]gay chat app for android[/url]
gay nude video chat


2022/09/08 06:01:19

Gesreenueさん

14 17,19 21,36,37 For the 17 PRN studies that had identical study designs, data were analyzed from patients treated with placebo, tadalafil 10 mg low dose , and tadalafil 20 mg high dose buy cialis online us Systemic drug exposures, as measured by AUC of unbound tadalafil, were approximately 10-fold for mice, and 14-and 26-fold for male and female rats, respectively, the exposures in human males given Maximum Recommended Human Dose MRHD of 20 mg


2022/09/10 02:50:48

TallouOaOaさん

gay phone chat lines caribbean
free gay boys chat
chat gay con camra


2022/09/10 03:15:37

Ownentyさん

Cochrane Database Syst Rev. clomiphene citrate over the counter


2022/09/10 21:45:30

accickyさん

fertility drugs clomid If necessary, a gonadotropin releasing hormone antagonist Cetrotide ; Merck Serono, Tokyo, Japan or Ganirest ; MSD, Tokyo, Japan was also administered.


2022/09/10 22:58:37

MarilinOaOaさん

gay video chat sites realty to dirtyrouletty
gay chat rooms phoenix
gay chat with married men


2022/09/13 05:22:58

Dontectさん

nolvadex pct for sarms


2022/09/14 00:58:21

Gresocaさん

tamoxifen dose do you think these woul.


2022/09/14 17:58:41

MavisOaOaさん

casual dating sites
videodating
dating match


2022/09/15 19:33:41

JuanitaOaOaさん

free f
personal dating ads
best single sites


2022/09/16 20:19:13

MaisieOaOaさん

connecting singles dating site
skip the games dating site
online singles


2022/09/16 20:21:03

Beeplelicさん

The patients were grouped according to the type of antibiotic administered. side effects doxycycline hyclate 100mg 12, 37 While providers are aware that antibiotics should only be prescribed when a bacterial infection is known or suspected, it appears that this is more difficult to implement given the inability to differentiate among some disorders in the early stages of illness.


2022/09/17 15:27:23

NimeTrikeさん

Pinto J, Huang YP, Pelliccione N, Rivlin RS. doxycycline and ibuprofen We detected both basal Cldn5 and Ccr5 mRNA expression in microglial cultures from adult mouse brains, but not in microglial cultures from neonatal brains Supplementary Fig.


2022/09/17 21:25:39

EachelleOaOaさん

datinghotlot
american dating
free web girl



コメントを投稿する


お名前


コメント内容





TOP back