PR

【Windows】Vagrant + Chef で環境構築を自動化する(2)

chef Windows

前回、ライセンス認証問題が発生し先に進まなくなっていました。が、目先の問題は解決しましたので改めてChefを導入していきます。

原因

F:/vagrant/centos/Vagrantfile の設定が古かったのが原因のようです。

前回は、config.vm.provision :chef_solo と記載していましたが、chef_soloはサポートされなくなったようです。代わりに、chef_zeroに変更します。

  config.omnibus.chef_version = "15.7.32"
  config.vm.provision :chef_zero do |chef|
    chef.cookbooks_path = ["F:/chef-repo/cookbooks"]
    chef.nodes_path = "F:/chef-repo/nodes"
    chef.roles_path = "F:/chef-repo/roles"
    chef.add_recipe "apache"
  end

設定にある通り、nodesとrolesのフォルダが必要になりますので、適当な場所に作成してください。フォルダを作成したら、仮想マシンを一旦削除して入れなおしてみます。

PS F:\vagrant\centos> vagrant halt
==> default: Attempting graceful shutdown of VM...
PS F:\vagrant\centos> vagrant destroy
    default: Are you sure you want to destroy the 'default' VM? [y/N] y
==> default: Destroying VM and associated drives...
PS F:\vagrant\centos> vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'bento/centos-6.7'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'bento/centos-6.7' version '2.2.7' is up to date...
==> default: Setting the name of the VM: centos_default_1581748706320_71302
==> default: Auto-generating node name for Chef...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
[default] GuestAdditions versions on your host (6.0.16) and guest (5.0.20) do not match.
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
Resolving Dependencies
--> Running transaction check
---> Package centos-release.x86_64 0:6-7.el6.centos.12.3 will be updated
---> Package centos-release.x86_64 0:6-10.el6.centos.12.3 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package              Arch         Version                     Repository  Size
================================================================================
Updating:
 centos-release       x86_64       6-10.el6.centos.12.3        base        22 k

Transaction Summary
================================================================================
Upgrade       1 Package(s)

Total download size: 22 k
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
 Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>
 Package: centos-release-6-7.el6.centos.12.3.x86_64 (@anaconda-CentOS-201508042137.x86_64/6.7)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : centos-release-6-10.el6.centos.12.3.x86_64                   1/2
  Cleanup    : centos-release-6-7.el6.centos.12.3.x86_64                    2/2
  Verifying  : centos-release-6-10.el6.centos.12.3.x86_64                   1/2
  Verifying  : centos-release-6-7.el6.centos.12.3.x86_64                    2/2

Updated:
  centos-release.x86_64 0:6-10.el6.centos.12.3

Complete!
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
Resolving Dependencies
--> Running transaction check
---> Package kernel-devel.x86_64 0:2.6.32-573.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package             Arch          Version               Repository        Size
================================================================================
Installing:
 kernel-devel        x86_64        2.6.32-573.el6        C6.7-base         10 M

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 10 M
Installed size: 25 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : kernel-devel-2.6.32-573.el6.x86_64                           1/1
  Verifying  : kernel-devel-2.6.32-573.el6.x86_64                           1/1

Installed:
  kernel-devel.x86_64 0:2.6.32-573.el6

Complete!
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
Package bzip2-1.0.5-7.el6_0.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package binutils.x86_64 0:2.20.51.0.2-5.43.el6 will be updated
---> Package binutils.x86_64 0:2.20.51.0.2-5.48.el6_10.1 will be an update
---> Package elfutils-libelf-devel.x86_64 0:0.164-2.el6 will be installed
--> Processing Dependency: elfutils-libelf(x86-64) = 0.164-2.el6 for package: elfutils-libelf-devel-0.164-2.el6.x86_64
---> Package gcc.x86_64 0:4.4.7-23.el6 will be installed
--> Processing Dependency: libgomp = 4.4.7-23.el6 for package: gcc-4.4.7-23.el6.x86_64
--> Processing Dependency: cpp = 4.4.7-23.el6 for package: gcc-4.4.7-23.el6.x86_64
--> Processing Dependency: libgcc >= 4.4.7-23.el6 for package: gcc-4.4.7-23.el6.x86_64
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.4.7-23.el6.x86_64
---> Package make.x86_64 1:3.81-20.el6 will be updated
---> Package make.x86_64 1:3.81-23.el6 will be an update
---> Package perl.x86_64 4:5.10.1-144.el6 will be installed
--> Processing Dependency: perl-libs = 4:5.10.1-144.el6 for package: 4:perl-5.10.1-144.el6.x86_64
--> Processing Dependency: perl-libs for package: 4:perl-5.10.1-144.el6.x86_64
--> Processing Dependency: perl(version) for package: 4:perl-5.10.1-144.el6.x86_64
--> Processing Dependency: perl(Pod::Simple) for package: 4:perl-5.10.1-144.el6.x86_64
--> Processing Dependency: perl(Module::Pluggable) for package: 4:perl-5.10.1-144.el6.x86_64
--> Processing Dependency: libperl.so()(64bit) for package: 4:perl-5.10.1-144.el6.x86_64
--> Running transaction check
---> Package cpp.x86_64 0:4.4.7-23.el6 will be installed
---> Package elfutils-libelf.x86_64 0:0.161-3.el6 will be updated
--> Processing Dependency: elfutils-libelf(x86-64) = 0.161-3.el6 for package: elfutils-libs-0.161-3.el6.x86_64
---> Package elfutils-libelf.x86_64 0:0.164-2.el6 will be an update
---> Package glibc-devel.x86_64 0:2.12-1.212.el6_10.3 will be installed
--> Processing Dependency: glibc-headers = 2.12-1.212.el6_10.3 for package: glibc-devel-2.12-1.212.el6_10.3.x86_64
--> Processing Dependency: glibc = 2.12-1.212.el6_10.3 for package: glibc-devel-2.12-1.212.el6_10.3.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.12-1.212.el6_10.3.x86_64
---> Package libgcc.x86_64 0:4.4.7-16.el6 will be updated
---> Package libgcc.x86_64 0:4.4.7-23.el6 will be an update
---> Package libgomp.x86_64 0:4.4.7-16.el6 will be updated
---> Package libgomp.x86_64 0:4.4.7-23.el6 will be an update
---> Package perl-Module-Pluggable.x86_64 1:3.90-144.el6 will be installed
---> Package perl-Pod-Simple.x86_64 1:3.13-144.el6 will be installed
--> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.13-144.el6.x86_64
---> Package perl-libs.x86_64 4:5.10.1-144.el6 will be installed
---> Package perl-version.x86_64 3:0.77-144.el6 will be installed
--> Running transaction check
---> Package elfutils-libs.x86_64 0:0.161-3.el6 will be updated
---> Package elfutils-libs.x86_64 0:0.164-2.el6 will be an update
---> Package glibc.x86_64 0:2.12-1.166.el6 will be updated
--> Processing Dependency: glibc = 2.12-1.166.el6 for package: glibc-common-2.12-1.166.el6.x86_64
---> Package glibc.x86_64 0:2.12-1.212.el6_10.3 will be an update
---> Package glibc-headers.x86_64 0:2.12-1.212.el6_10.3 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.12-1.212.el6_10.3.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.12-1.212.el6_10.3.x86_64
---> Package perl-Pod-Escapes.x86_64 1:1.04-144.el6 will be installed
--> Running transaction check
---> Package glibc-common.x86_64 0:2.12-1.166.el6 will be updated
---> Package glibc-common.x86_64 0:2.12-1.212.el6_10.3 will be an update
--> Processing Dependency: tzdata >= 2015g-4 for package: glibc-common-2.12-1.212.el6_10.3.x86_64
---> Package kernel-headers.x86_64 0:2.6.32-754.27.1.el6 will be installed
--> Running transaction check
---> Package tzdata.noarch 0:2015e-1.el6 will be updated
---> Package tzdata.noarch 0:2019c-1.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                 Arch     Version                       Repository
                                                                           Size
================================================================================
Installing:
 elfutils-libelf-devel   x86_64   0.164-2.el6                   base       32 k
 gcc                     x86_64   4.4.7-23.el6                  base       10 M
 perl                    x86_64   4:5.10.1-144.el6              base       10 M
Updating:
 binutils                x86_64   2.20.51.0.2-5.48.el6_10.1     updates   2.8 M
 make                    x86_64   1:3.81-23.el6                 base      389 k
Installing for dependencies:
 cpp                     x86_64   4.4.7-23.el6                  base      3.7 M
 glibc-devel             x86_64   2.12-1.212.el6_10.3           updates   991 k
 glibc-headers           x86_64   2.12-1.212.el6_10.3           updates   620 k
 kernel-headers          x86_64   2.6.32-754.27.1.el6           updates   4.6 M
 perl-Module-Pluggable   x86_64   1:3.90-144.el6                base       41 k
 perl-Pod-Escapes        x86_64   1:1.04-144.el6                base       33 k
 perl-Pod-Simple         x86_64   1:3.13-144.el6                base      213 k
 perl-libs               x86_64   4:5.10.1-144.el6              base      579 k
 perl-version            x86_64   3:0.77-144.el6                base       52 k
Updating for dependencies:
 elfutils-libelf         x86_64   0.164-2.el6                   base      197 k
 elfutils-libs           x86_64   0.164-2.el6                   base      230 k
 glibc                   x86_64   2.12-1.212.el6_10.3           updates   3.8 M
 glibc-common            x86_64   2.12-1.212.el6_10.3           updates    14 M
 libgcc                  x86_64   4.4.7-23.el6                  base      104 k
 libgomp                 x86_64   4.4.7-23.el6                  base      135 k
 tzdata                  noarch   2019c-1.el6                   updates   508 k

Transaction Summary
================================================================================
Install      12 Package(s)
Upgrade       9 Package(s)

Total download size: 53 M
Downloading Packages:
--------------------------------------------------------------------------------
Total                                           6.3 MB/s |  53 MB     00:08
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : libgcc-4.4.7-23.el6.x86_64                                  1/30
  Updating   : tzdata-2019c-1.el6.noarch                                   2/30
  Updating   : glibc-2.12-1.212.el6_10.3.x86_64                            3/30
  Updating   : glibc-common-2.12-1.212.el6_10.3.x86_64                     4/30
  Installing : 1:perl-Pod-Escapes-1.04-144.el6.x86_64                      5/30
  Installing : 4:perl-libs-5.10.1-144.el6.x86_64                           6/30
  Installing : 1:perl-Pod-Simple-3.13-144.el6.x86_64                       7/30
  Installing : 1:perl-Module-Pluggable-3.90-144.el6.x86_64                 8/30
  Installing : 3:perl-version-0.77-144.el6.x86_64                          9/30
  Installing : 4:perl-5.10.1-144.el6.x86_64                               10/30
  Updating   : elfutils-libelf-0.164-2.el6.x86_64                         11/30
  Updating   : libgomp-4.4.7-23.el6.x86_64                                12/30
  Updating   : binutils-2.20.51.0.2-5.48.el6_10.1.x86_64                  13/30
  Installing : cpp-4.4.7-23.el6.x86_64                                    14/30
  Installing : kernel-headers-2.6.32-754.27.1.el6.x86_64                  15/30
  Installing : glibc-headers-2.12-1.212.el6_10.3.x86_64                   16/30
  Installing : glibc-devel-2.12-1.212.el6_10.3.x86_64                     17/30
  Installing : gcc-4.4.7-23.el6.x86_64                                    18/30
  Updating   : elfutils-libs-0.164-2.el6.x86_64                           19/30
  Installing : elfutils-libelf-devel-0.164-2.el6.x86_64                   20/30
  Updating   : 1:make-3.81-23.el6.x86_64                                  21/30
  Cleanup    : elfutils-libs-0.161-3.el6.x86_64                           22/30
  Cleanup    : elfutils-libelf-0.161-3.el6.x86_64                         23/30
  Cleanup    : binutils-2.20.51.0.2-5.43.el6.x86_64                       24/30
  Cleanup    : 1:make-3.81-20.el6.x86_64                                  25/30
  Cleanup    : libgomp-4.4.7-16.el6.x86_64                                26/30
  Cleanup    : glibc-common-2.12-1.166.el6.x86_64                         27/30
  Cleanup    : glibc-2.12-1.166.el6.x86_64                                28/30
  Cleanup    : tzdata-2015e-1.el6.noarch                                  29/30
  Cleanup    : libgcc-4.4.7-16.el6.x86_64                                 30/30
  Verifying  : 3:perl-version-0.77-144.el6.x86_64                          1/30
  Verifying  : 4:perl-5.10.1-144.el6.x86_64                                2/30
  Verifying  : gcc-4.4.7-23.el6.x86_64                                     3/30
  Verifying  : libgomp-4.4.7-23.el6.x86_64                                 4/30
  Verifying  : glibc-devel-2.12-1.212.el6_10.3.x86_64                      5/30
  Verifying  : 4:perl-libs-5.10.1-144.el6.x86_64                           6/30
  Verifying  : glibc-headers-2.12-1.212.el6_10.3.x86_64                    7/30
  Verifying  : 1:perl-Pod-Simple-3.13-144.el6.x86_64                       8/30
  Verifying  : 1:perl-Pod-Escapes-1.04-144.el6.x86_64                      9/30
  Verifying  : elfutils-libelf-0.164-2.el6.x86_64                         10/30
  Verifying  : 1:make-3.81-23.el6.x86_64                                  11/30
  Verifying  : elfutils-libs-0.164-2.el6.x86_64                           12/30
  Verifying  : 1:perl-Module-Pluggable-3.90-144.el6.x86_64                13/30
  Verifying  : glibc-common-2.12-1.212.el6_10.3.x86_64                    14/30
  Verifying  : elfutils-libelf-devel-0.164-2.el6.x86_64                   15/30
  Verifying  : kernel-headers-2.6.32-754.27.1.el6.x86_64                  16/30
  Verifying  : tzdata-2019c-1.el6.noarch                                  17/30
  Verifying  : binutils-2.20.51.0.2-5.48.el6_10.1.x86_64                  18/30
  Verifying  : cpp-4.4.7-23.el6.x86_64                                    19/30
  Verifying  : libgcc-4.4.7-23.el6.x86_64                                 20/30
  Verifying  : glibc-2.12-1.212.el6_10.3.x86_64                           21/30
  Verifying  : libgomp-4.4.7-16.el6.x86_64                                22/30
  Verifying  : glibc-common-2.12-1.166.el6.x86_64                         23/30
  Verifying  : glibc-2.12-1.166.el6.x86_64                                24/30
  Verifying  : binutils-2.20.51.0.2-5.43.el6.x86_64                       25/30
  Verifying  : elfutils-libs-0.161-3.el6.x86_64                           26/30
  Verifying  : 1:make-3.81-20.el6.x86_64                                  27/30
  Verifying  : libgcc-4.4.7-16.el6.x86_64                                 28/30
  Verifying  : tzdata-2015e-1.el6.noarch                                  29/30
  Verifying  : elfutils-libelf-0.161-3.el6.x86_64                         30/30

Installed:
  elfutils-libelf-devel.x86_64 0:0.164-2.el6      gcc.x86_64 0:4.4.7-23.el6
  perl.x86_64 4:5.10.1-144.el6

Dependency Installed:
  cpp.x86_64 0:4.4.7-23.el6
  glibc-devel.x86_64 0:2.12-1.212.el6_10.3
  glibc-headers.x86_64 0:2.12-1.212.el6_10.3
  kernel-headers.x86_64 0:2.6.32-754.27.1.el6
  perl-Module-Pluggable.x86_64 1:3.90-144.el6
  perl-Pod-Escapes.x86_64 1:1.04-144.el6
  perl-Pod-Simple.x86_64 1:3.13-144.el6
  perl-libs.x86_64 4:5.10.1-144.el6
  perl-version.x86_64 3:0.77-144.el6

Updated:
  binutils.x86_64 0:2.20.51.0.2-5.48.el6_10.1     make.x86_64 1:3.81-23.el6

Dependency Updated:
  elfutils-libelf.x86_64 0:0.164-2.el6
  elfutils-libs.x86_64 0:0.164-2.el6
  glibc.x86_64 0:2.12-1.212.el6_10.3
  glibc-common.x86_64 0:2.12-1.212.el6_10.3
  libgcc.x86_64 0:4.4.7-23.el6
  libgomp.x86_64 0:4.4.7-23.el6
  tzdata.noarch 0:2019c-1.el6

Complete!
Copy iso file C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
Mounting Virtualbox Guest Additions ISO to: /mnt
Installing Virtualbox Guest Additions 6.0.16 - guest version is 5.0.20
Verifying archive integrity... All good.
Uncompressing VirtualBox 6.0.16 Guest Additions for Linux........
VirtualBox Guest Additions installer
Removing installed version 5.0.20 of VirtualBox Guest Additions...
Stopping VirtualBox Additions [FAILED]
(Cannot unload module vboxguest)
Removing existing VirtualBox non-DKMS kernel modules[  OK  ]
[  OK  ] VirtualBox Guest Addition service [  OK  ]
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel
2.6.32-573.el6.x86_64.
VirtualBox Guest Additions: Running kernel modules will not be replaced until
the system is restarted
Building the VirtualBox Guest Additions kernel modules.  This may take a while.
To build modules for other installed kernels, run
  /sbin/rcvboxadd quicksetup <version>
or
  /sbin/rcvboxadd quicksetup all
Running kernel modules will not be replaced until the system is restarted
vboxadd-service.sh: Starting VirtualBox Guest Addition service.
An error occurred during installation of VirtualBox Guest Additions 6.0.16. Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Running kernel modules will not be replaced until
the system is restarted
Unmounting Virtualbox Guest Additions ISO from: /mnt
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   5.0.20
VBoxService inside the vm claims: 6.0.16
Going on, assuming VBoxService is correct...
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   5.0.20
VBoxService inside the vm claims: 6.0.16
Going on, assuming VBoxService is correct...
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   5.0.20
VBoxService inside the vm claims: 6.0.16
Going on, assuming VBoxService is correct...
Restarting VM to apply changes...
==> default: Attempting graceful shutdown of VM...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => F:/vagrant/centos
    default: /tmp/vagrant-chef/e8a96593415796600212f9551581133f/roles => F:/chef-repo/roles
    default: /tmp/vagrant-chef/dadef8742a0abc3f886ce650c9973deb/nodes => F:/chef-repo/nodes
    default: /tmp/vagrant-chef/b8f9988f119676fe58f7fedfb779c05e/cookbooks => F:/chef-repo/cookbooks
==> default: Installing Chef 15.7.32 Omnibus package...
==> default: el 6 x86_64
==> default: Getting information for chef stable 15.7.32 for el...
==> default: downloading https://www.chef.io/stable/chef/metadata?v=15.7.32&p=el&pv=6&m=x86_64
==> default:   to file /tmp/install.sh.2540/metadata.txt
==> default: trying wget...
==> default: sha1       9cf007f150b3e70eaea49930e2faf081fb77cebf
==> default: sha256     1da1dd57c084a0470607fc997db1672695b6212c784cbd18c3dbe3f820877d5f
==> default: url        https://packages.chef.io/files/stable/chef/15.7.32/el/6/chef-15.7.32-1.el6.x86_64.rpm
==> default: version    15.7.32

==> default: downloaded metadata file looks valid...
==> default: downloading https://packages.chef.io/files/stable/chef/15.7.32/el/6/chef-15.7.32-1.el6.x86_64.rpm
==> default:   to file /tmp/install.sh.2540/chef-15.7.32-1.el6.x86_64.rpm
==> default: trying wget...
==> default: Comparing checksum with sha256sum...
==> default: Installing chef 15.7.32
==> default: installing with rpm...
==> default: warning:
==> default: /tmp/install.sh.2540/chef-15.7.32-1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY
==> default: Preparing...
==> default: ##################################################

==> default: chef
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #

==> default: Thank you for installing Chef Infra Client! For help getting started visit https://learn.chef.io
==> default: Running provisioner: chef_zero...
==> default: Detected Chef (latest) is already installed
==> default: Generating chef JSON and uploading...
==> default: Running chef-client (local-mode)...
==> default: Chef Infra Client cannot execute without accepting the license
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
PS F:\vagrant\centos>

ライセンスに同意しろと言われました。

ライセンスに同意するには

調べた結果、公式に答えがありました。

Accept the Chef License
This document describes how to accept the End User License Agreement (EULA) and Master License and Services Agreement (M...

というわけで、Vagrantfileに追記して、Vagrant provisionを実行します。

PS F:\vagrant\centos> vagrant provision
==> default: Installing Chef 15.7.32 Omnibus package...
==> default: el 6 x86_64
==> default: Getting information for chef stable 15.7.32 for el...
==> default: downloading https://www.chef.io/stable/chef/metadata?v=15.7.32&p=el&pv=6&m=x86_64
==> default:   to file /tmp/install.sh.3322/metadata.txt
==> default: trying wget...
==> default: sha1       9cf007f150b3e70eaea49930e2faf081fb77cebf
==> default: sha256     1da1dd57c084a0470607fc997db1672695b6212c784cbd18c3dbe3f820877d5f
==> default: url        https://packages.chef.io/files/stable/chef/15.7.32/el/6/chef-15.7.32-1.el6.x86_64.rpm
==> default: version    15.7.32

==> default: downloaded metadata file looks valid...
==> default: downloading https://packages.chef.io/files/stable/chef/15.7.32/el/6/chef-15.7.32-1.el6.x86_64.rpm
==> default:   to file /tmp/install.sh.3322/chef-15.7.32-1.el6.x86_64.rpm
==> default: trying wget...
==> default: Comparing checksum with sha256sum...
==> default: Installing chef 15.7.32
==> default: installing with rpm...
==> default: warning:
==> default: /tmp/install.sh.3322/chef-15.7.32-1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY
==> default: Preparing...
==> default: ##################################################

==> default: removing /opt/chef...
==> default: chef
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #
==> default: #

==> default: Thank you for installing Chef Infra Client! For help getting started visit https://learn.chef.io
==> default: Running provisioner: chef_zero...
==> default: Detected Chef (latest) is already installed
==> default: Generating chef JSON and uploading...
==> default: Running chef-client (local-mode)...
==> default: [2020-02-15T14:27:52+00:00] INFO: Persisting a license for Chef Infra Client at path /etc/chef/accepted_licenses/chef_infra_client
==> default: [2020-02-15T14:27:52+00:00] INFO: Persisting a license for Chef InSpec at path /etc/chef/accepted_licenses/inspec
==> default: +---------------------------------------------+
==> default: ✔ 2 product licenses accepted.
==> default: +---------------------------------------------+
==> default: [2020-02-15T14:27:52+00:00] INFO: Started Chef Infra Zero at chefzero://localhost:1 with repository at /tmp/vagrant-chef/b8f9988f119676fe58f7fedfb779c05e
==> default:   One version per cookbook
==> default:   roles at /tmp/vagrant-chef/e8a96593415796600212f9551581133f/roles
==> default:   nodes at /tmp/vagrant-chef/dadef8742a0abc3f886ce650c9973deb/nodes
==> default: Starting Chef Infra Client, version 15.7.32
==> default: [2020-02-15T14:27:52+00:00] INFO: *** Chef Infra Client 15.7.32 ***
==> default: [2020-02-15T14:27:52+00:00] INFO: Platform: x86_64-linux
==> default: [2020-02-15T14:27:52+00:00] INFO: Chef-client pid: 4448
==> default: [2020-02-15T14:27:54+00:00] INFO: Setting the run_list to ["recipe[apache]"] from CLI options
==> default: [2020-02-15T14:27:54+00:00] INFO: Run List is [recipe[apache]]
==> default: [2020-02-15T14:27:54+00:00] INFO: Run List expands to [apache]
==> default: [2020-02-15T14:27:54+00:00] INFO: Starting Chef Infra Client Run for vagrant-aa299267
==> default: [2020-02-15T14:27:54+00:00] INFO: Running start handlers
==> default: [2020-02-15T14:27:54+00:00] INFO: Start handlers complete.
==> default: resolving cookbooks for run list: ["apache"]
==> default: [2020-02-15T14:27:54+00:00] INFO: Loading cookbooks [apache@0.1.0]
==> default: Synchronizing Cookbooks:
==> default: [2020-02-15T14:27:54+00:00] INFO: Storing updated cookbooks/apache/recipes/default.rb in the cache.
==> default: [2020-02-15T14:27:54+00:00] INFO: Storing updated cookbooks/apache/chefignore in the cache.
==> default: [2020-02-15T14:27:54+00:00] INFO: Storing updated cookbooks/apache/README.md in the cache.
==> default: [2020-02-15T14:27:54+00:00] INFO: Storing updated cookbooks/apache/LICENSE in the cache.
==> default: [2020-02-15T14:27:54+00:00] INFO: Storing updated cookbooks/apache/metadata.rb in the cache.
==> default:
==> default: - apache (0.1.0)
==> default: Installing Cookbook Gems:
==> default: Compiling Cookbooks...
==> default: Converging 2 resources
==> default: Recipe: apache::default
==> default:
==> default: * yum_package[httpd] action install
==> default: [2020-02-15T14:28:03+00:00] INFO: yum_package[httpd] installed httpd at 0:2.2.15-69.el6.centos.x86_64
==> default:
==> default:     - install version 0:2.2.15-69.el6.centos.x86_64 of package httpd
==> default:   * service[httpd] action enable
==> default: [2020-02-15T14:28:03+00:00] INFO: service[httpd] enabled
==> default:
==> default:     - enable service service[httpd]
==> default:   * service[httpd] action start
==> default: [2020-02-15T14:28:03+00:00] INFO: service[httpd] started
==> default:
==> default:     - start service service[httpd]
==> default: [2020-02-15T14:28:03+00:00] INFO: Chef Infra Client Run complete in 9.535982013 seconds
==> default: Running handlers:
==> default: [2020-02-15T14:28:03+00:00] INFO: Running report handlers
==> default: Running handlers complete
==> default: [2020-02-15T14:28:03+00:00] INFO: Report handlers complete
==> default: Chef Infra Client finished, 3/3 resources updated in 11 seconds
PS F:\vagrant\centos>

やっと、chefで環境構築できた模様。

アクセスしてみる

ブラウザで192.168.33.11にアクセスした結果、無事サンプルページが表示されました。

とりあえずは、ここまで。
使いこなせばかなり便利だろうなという片鱗を感じることができました。

Dockerも使ってみて比較してみたいですね。
以上。

コメント

タイトルとURLをコピーしました