2016年11月28日

Vagrant+VirtualBox+Ansibleで開発環境を構築する(その1)

Share

  1. ansible実行用のhostをvagrantのansible_localで設定 ← ここ
  2. hostからansibleでcentOS 7.2の基本設定

前提

  • OS X El Capitan(10.11.6)

  • Vagrantインストール済み

$ vagrant version
Installed Version: 1.8.7
Latest Version: 1.8.7
$ VBoxManage -version
5.0.30r112061

1.ansible実行用のhostをvagrantのansible_localで設定

vagrantの初期化

Vagrantfile作成

$ vagrant init
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
$ tree
.
└── Vagrantfile

0 directories, 1 file

設定

公式ページを参考に編集 ansible_local

ファイル構成

$ tree
.
├── Vagrantfile
├── ansible.cfg
└── provision
    ├── inventory
    └── playbook.yml

1 directory, 4 files

各ファイル

Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
  config.vm.define "host" do |node|
    node.vm.box = "bento/centos-7.2"
    node.vm.hostname = "host"
    node.vm.network :private_network, ip: "192.168.52.51"

    # Run Ansible from the Vagrant VM
    node.vm.provision :ansible_local do |ansible|
      ansible.playbook       = "provision/playbook.yml"
      ansible.verbose        = true
      ansible.install        = true
      ansible.install_mode   = :default
      ansible.limit          = "all" # or only "nodes" group, etc.
      ansible.inventory_path = "provision/inventory"
    end
  end
end

ansible.cfg

[defaults]
host_key_checking = no

[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes

provision/inventory

host ansible_connection=local

provision/playbook.yml

---
# file: ./provision/playbook.yml

- hosts: host
  tasks:
    - name: provision test
      debug: msg="provision test"

vagrantの実行

$ vagrant up --provision
Bringing machine 'host' up with 'virtualbox' provider...
==> host: Importing base box 'bento/centos-7.2'...
==> host: Matching MAC address for NAT networking...
==> host: Checking if box 'bento/centos-7.2' is up to date...
==> host: There was a problem while downloading the metadata for your box
==> host: to check for updates. This is not an error, since it is usually due
==> host: to temporary network problems. This is just a warning. The problem
==> host: encountered was:
==> host:
==> host:
==> host:
==> host: If you want to check for box updates, verify your network connection
==> host: is valid and try again.
==> host: Setting the name of the VM: vagrant_host_1480286713505_67653
==> host: Clearing any previously set network interfaces...
==> host: Preparing network interfaces based on configuration...
    host: Adapter 1: nat
    host: Adapter 2: hostonly
==> host: Forwarding ports...
    host: 22 (guest) => 2222 (host) (adapter 1)
==> host: Booting VM...
==> host: Waiting for machine to boot. This may take a few minutes...
    host: SSH address: 127.0.0.1:2222
    host: SSH username: vagrant
    host: SSH auth method: private key
    host: Warning: Remote connection disconnect. Retrying...
    host: Warning: Remote connection disconnect. Retrying...
    host: Warning: Remote connection disconnect. Retrying...
    host:
    host: Vagrant insecure key detected. Vagrant will automatically replace
    host: this with a newly generated keypair for better security.
    host:
    host: Inserting generated public key within guest...
    host: Removing insecure key from the guest if it's present...
    host: Key inserted! Disconnecting and reconnecting using new SSH key...
==> host: Machine booted and ready!
[host] GuestAdditions versions on your host (5.0.30) and guest (5.0.26) do not match.
Loaded plugins: fastestmirror
^@Determining fastest mirrors
 * base: ftp.tsukuba.wide.ad.jp
 * extras: ftp.tsukuba.wide.ad.jp
 * updates: ftp.tsukuba.wide.ad.jp
Package binutils-2.23.52.0.1-55.el7.x86_64 already installed and latest version
Package 1:make-3.82-21.el7.x86_64 already installed and latest version
Package bzip2-1.0.6-13.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.8.5-4.el7 will be installed
--> Processing Dependency: cpp = 4.8.5-4.el7 for package: gcc-4.8.5-4.el7.x86_64
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.8.5-4.el7.x86_64
---> Package kernel-devel.x86_64 0:3.10.0-327.el7 will be installed
---> Package perl.x86_64 4:5.16.3-286.el7 will be installed
--> Processing Dependency: perl-libs = 4:5.16.3-286.el7 for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(Socket) >= 1.3 for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(Scalar::Util) >= 1.10 for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl-macros for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl-libs for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(threads::shared) for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(threads) for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(constant) for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(Time::Local) for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(Time::HiRes) for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(Storable) for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(Socket) for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(Scalar::Util) for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(Pod::Simple::XHTML) for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(Pod::Simple::Search) for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(Getopt::Long) for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(Filter::Util::Call) for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(File::Temp) for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(File::Spec::Unix) for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(File::Spec::Functions) for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(File::Spec) for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(File::Path) for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(Exporter) for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(Cwd) for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: perl(Carp) for package: 4:perl-5.16.3-286.el7.x86_64
--> Processing Dependency: libperl.so()(64bit) for package: 4:perl-5.16.3-286.el7.x86_64
--> Running transaction check
---> Package cpp.x86_64 0:4.8.5-4.el7 will be installed
---> Package glibc-devel.x86_64 0:2.17-106.el7_2.8 will be installed
--> Processing Dependency: glibc-headers = 2.17-106.el7_2.8 for package: glibc-devel-2.17-106.el7_2.8.x86_64
--> Processing Dependency: glibc = 2.17-106.el7_2.8 for package: glibc-devel-2.17-106.el7_2.8.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.17-106.el7_2.8.x86_64
---> Package perl-Carp.noarch 0:1.26-244.el7 will be installed
---> Package perl-Exporter.noarch 0:5.68-3.el7 will be installed
---> Package perl-File-Path.noarch 0:2.09-2.el7 will be installed
---> Package perl-File-Temp.noarch 0:0.23.01-3.el7 will be installed
---> Package perl-Filter.x86_64 0:1.49-3.el7 will be installed
---> Package perl-Getopt-Long.noarch 0:2.40-2.el7 will be installed
--> Processing Dependency: perl(Pod::Usage) >= 1.14 for package: perl-Getopt-Long-2.40-2.el7.noarch
--> Processing Dependency: perl(Text::ParseWords) for package: perl-Getopt-Long-2.40-2.el7.noarch
---> Package perl-PathTools.x86_64 0:3.40-5.el7 will be installed
---> Package perl-Pod-Simple.noarch 1:3.28-4.el7 will be installed
--> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
--> Processing Dependency: perl(Encode) for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
---> Package perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 will be installed
---> Package perl-Socket.x86_64 0:2.010-3.el7 will be installed
---> Package perl-Storable.x86_64 0:2.45-3.el7 will be installed
---> Package perl-Time-HiRes.x86_64 4:1.9725-3.el7 will be installed
---> Package perl-Time-Local.noarch 0:1.2300-2.el7 will be installed
---> Package perl-constant.noarch 0:1.27-2.el7 will be installed
---> Package perl-libs.x86_64 4:5.16.3-286.el7 will be installed
---> Package perl-macros.x86_64 4:5.16.3-286.el7 will be installed
---> Package perl-threads.x86_64 0:1.87-4.el7 will be installed
---> Package perl-threads-shared.x86_64 0:1.43-6.el7 will be installed
--> Running transaction check
---> Package glibc.x86_64 0:2.17-105.el7 will be updated
--> Processing Dependency: glibc = 2.17-105.el7 for package: glibc-common-2.17-105.el7.x86_64
---> Package glibc.x86_64 0:2.17-106.el7_2.8 will be an update
---> Package glibc-headers.x86_64 0:2.17-106.el7_2.8 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.17-106.el7_2.8.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.17-106.el7_2.8.x86_64
---> Package perl-Encode.x86_64 0:2.51-7.el7 will be installed
---> Package perl-Pod-Escapes.noarch 1:1.04-286.el7 will be installed
---> Package perl-Pod-Usage.noarch 0:1.63-3.el7 will be installed
--> Processing Dependency: perl(Pod::Text) >= 3.15 for package: perl-Pod-Usage-1.63-3.el7.noarch
--> Processing Dependency: perl-Pod-Perldoc for package: perl-Pod-Usage-1.63-3.el7.noarch
---> Package perl-Text-ParseWords.noarch 0:3.29-4.el7 will be installed
--> Running transaction check
---> Package glibc-common.x86_64 0:2.17-105.el7 will be updated
---> Package glibc-common.x86_64 0:2.17-106.el7_2.8 will be an update
---> Package kernel-headers.x86_64 0:3.10.0-327.36.3.el7 will be installed
---> Package perl-Pod-Perldoc.noarch 0:3.20-4.el7 will be installed
--> Processing Dependency: perl(parent) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
--> Processing Dependency: perl(HTTP::Tiny) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
---> Package perl-podlators.noarch 0:2.5.1-3.el7 will be installed
--> Running transaction check
---> Package perl-HTTP-Tiny.noarch 0:0.033-3.el7 will be installed
---> Package perl-parent.noarch 1:0.225-244.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                   Arch      Version                   Repository  Size
================================================================================
Installing:
 gcc                       x86_64    4.8.5-4.el7               base        16 M
 kernel-devel              x86_64    3.10.0-327.el7            base        11 M
 perl                      x86_64    4:5.16.3-286.el7          base       8.0 M
Installing for dependencies:
 cpp                       x86_64    4.8.5-4.el7               base       5.9 M
 glibc-devel               x86_64    2.17-106.el7_2.8          updates    1.0 M
 glibc-headers             x86_64    2.17-106.el7_2.8          updates    663 k
 kernel-headers            x86_64    3.10.0-327.36.3.el7       updates    3.2 M
 perl-Carp                 noarch    1.26-244.el7              base        19 k
 perl-Encode               x86_64    2.51-7.el7                base       1.5 M
 perl-Exporter             noarch    5.68-3.el7                base        28 k
 perl-File-Path            noarch    2.09-2.el7                base        26 k
 perl-File-Temp            noarch    0.23.01-3.el7             base        56 k
 perl-Filter               x86_64    1.49-3.el7                base        76 k
 perl-Getopt-Long          noarch    2.40-2.el7                base        56 k
 perl-HTTP-Tiny            noarch    0.033-3.el7               base        38 k
 perl-PathTools            x86_64    3.40-5.el7                base        82 k
 perl-Pod-Escapes          noarch    1:1.04-286.el7            base        50 k
 perl-Pod-Perldoc          noarch    3.20-4.el7                base        87 k
 perl-Pod-Simple           noarch    1:3.28-4.el7              base       216 k
 perl-Pod-Usage            noarch    1.63-3.el7                base        27 k
 perl-Scalar-List-Utils    x86_64    1.27-248.el7              base        36 k
 perl-Socket               x86_64    2.010-3.el7               base        49 k
 perl-Storable             x86_64    2.45-3.el7                base        77 k
 perl-Text-ParseWords      noarch    3.29-4.el7                base        14 k
 perl-Time-HiRes           x86_64    4:1.9725-3.el7            base        45 k
 perl-Time-Local           noarch    1.2300-2.el7              base        24 k
 perl-constant             noarch    1.27-2.el7                base        19 k
 perl-libs                 x86_64    4:5.16.3-286.el7          base       687 k
 perl-macros               x86_64    4:5.16.3-286.el7          base        43 k
 perl-parent               noarch    1:0.225-244.el7           base        12 k
 perl-podlators            noarch    2.5.1-3.el7               base       112 k
 perl-threads              x86_64    1.87-4.el7                base        49 k
 perl-threads-shared       x86_64    1.43-6.el7                base        39 k
Updating for dependencies:
 glibc                     x86_64    2.17-106.el7_2.8          updates    3.6 M
 glibc-common              x86_64    2.17-106.el7_2.8          updates     11 M

Transaction Summary
================================================================================
Install  3 Packages (+30 Dependent packages)
Upgrade             (  2 Dependent packages)

Total download size: 64 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
Public key for cpp-4.8.5-4.el7.x86_64.rpm is not installed
warning: /var/cache/yum/x86_64/7/base/packages/cpp-4.8.5-4.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for glibc-2.17-106.el7_2.8.x86_64.rpm is not installed
--------------------------------------------------------------------------------
Total                                               16 MB/s |  64 MB  00:04
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-2.1511.el7.centos.2.10.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : glibc-2.17-106.el7_2.8.x86_64                               1/37
  Updating   : glibc-common-2.17-106.el7_2.8.x86_64                        2/37
  Installing : 1:perl-parent-0.225-244.el7.noarch                          3/37
  Installing : perl-HTTP-Tiny-0.033-3.el7.noarch                           4/37
  Installing : perl-podlators-2.5.1-3.el7.noarch                           5/37
  Installing : perl-Pod-Perldoc-3.20-4.el7.noarch                          6/37
  Installing : 1:perl-Pod-Escapes-1.04-286.el7.noarch                      7/37
  Installing : perl-Text-ParseWords-3.29-4.el7.noarch                      8/37
  Installing : perl-Encode-2.51-7.el7.x86_64                               9/37
  Installing : perl-Pod-Usage-1.63-3.el7.noarch                           10/37
  Installing : 4:perl-libs-5.16.3-286.el7.x86_64                          11/37
  Installing : 4:perl-macros-5.16.3-286.el7.x86_64                        12/37
  Installing : perl-Storable-2.45-3.el7.x86_64                            13/37
  Installing : perl-Exporter-5.68-3.el7.noarch                            14/37
  Installing : perl-constant-1.27-2.el7.noarch                            15/37
  Installing : perl-Time-Local-1.2300-2.el7.noarch                        16/37
  Installing : perl-Socket-2.010-3.el7.x86_64                             17/37
  Installing : perl-Carp-1.26-244.el7.noarch                              18/37
  Installing : 4:perl-Time-HiRes-1.9725-3.el7.x86_64                      19/37
  Installing : perl-PathTools-3.40-5.el7.x86_64                           20/37
  Installing : perl-Scalar-List-Utils-1.27-248.el7.x86_64                 21/37
  Installing : perl-File-Temp-0.23.01-3.el7.noarch                        22/37
  Installing : perl-File-Path-2.09-2.el7.noarch                           23/37
  Installing : perl-threads-shared-1.43-6.el7.x86_64                      24/37
  Installing : perl-threads-1.87-4.el7.x86_64                             25/37
  Installing : perl-Filter-1.49-3.el7.x86_64                              26/37
  Installing : 1:perl-Pod-Simple-3.28-4.el7.noarch                        27/37
  Installing : perl-Getopt-Long-2.40-2.el7.noarch                         28/37
  Installing : 4:perl-5.16.3-286.el7.x86_64                               29/37
  Installing : cpp-4.8.5-4.el7.x86_64                                     30/37
  Installing : kernel-headers-3.10.0-327.36.3.el7.x86_64                  31/37
  Installing : glibc-headers-2.17-106.el7_2.8.x86_64                      32/37
  Installing : glibc-devel-2.17-106.el7_2.8.x86_64                        33/37
  Installing : gcc-4.8.5-4.el7.x86_64                                     34/37^@
  Installing : kernel-devel-3.10.0-327.el7.x86_64                         35/37
  Cleanup    : glibc-2.17-105.el7.x86_64                                  36/37
  Cleanup    : glibc-common-2.17-105.el7.x86_64                           37/37
  Verifying  : perl-HTTP-Tiny-0.033-3.el7.noarch                           1/37
  Verifying  : gcc-4.8.5-4.el7.x86_64                                      2/37
  Verifying  : perl-threads-shared-1.43-6.el7.x86_64                       3/37
  Verifying  : perl-Storable-2.45-3.el7.x86_64                             4/37
  Verifying  : kernel-headers-3.10.0-327.36.3.el7.x86_64                   5/37
  Verifying  : perl-Exporter-5.68-3.el7.noarch                             6/37
  Verifying  : perl-constant-1.27-2.el7.noarch                             7/37
  Verifying  : perl-PathTools-3.40-5.el7.x86_64                            8/37
  Verifying  : 4:perl-libs-5.16.3-286.el7.x86_64                           9/37
  Verifying  : 4:perl-macros-5.16.3-286.el7.x86_64                        10/37
  Verifying  : 1:perl-Pod-Escapes-1.04-286.el7.noarch                     11/37
  Verifying  : 1:perl-parent-0.225-244.el7.noarch                         12/37
  Verifying  : 4:perl-5.16.3-286.el7.x86_64                               13/37
  Verifying  : glibc-devel-2.17-106.el7_2.8.x86_64                        14/37
  Verifying  : perl-File-Temp-0.23.01-3.el7.noarch                        15/37
  Verifying  : 1:perl-Pod-Simple-3.28-4.el7.noarch                        16/37
  Verifying  : glibc-headers-2.17-106.el7_2.8.x86_64                      17/37
  Verifying  : perl-Time-Local-1.2300-2.el7.noarch                        18/37
  Verifying  : glibc-common-2.17-106.el7_2.8.x86_64                       19/37
  Verifying  : perl-Pod-Perldoc-3.20-4.el7.noarch                         20/37
  Verifying  : perl-Socket-2.010-3.el7.x86_64                             21/37
  Verifying  : perl-Carp-1.26-244.el7.noarch                              22/37
  Verifying  : perl-podlators-2.5.1-3.el7.noarch                          23/37
  Verifying  : 4:perl-Time-HiRes-1.9725-3.el7.x86_64                      24/37
  Verifying  : perl-Scalar-List-Utils-1.27-248.el7.x86_64                 25/37
  Verifying  : glibc-2.17-106.el7_2.8.x86_64                              26/37
  Verifying  : perl-Pod-Usage-1.63-3.el7.noarch                           27/37
  Verifying  : perl-Encode-2.51-7.el7.x86_64                              28/37
  Verifying  : perl-Getopt-Long-2.40-2.el7.noarch                         29/37
  Verifying  : kernel-devel-3.10.0-327.el7.x86_64                         30/37
  Verifying  : cpp-4.8.5-4.el7.x86_64                                     31/37
  Verifying  : perl-File-Path-2.09-2.el7.noarch                           32/37
  Verifying  : perl-threads-1.87-4.el7.x86_64                             33/37
  Verifying  : perl-Filter-1.49-3.el7.x86_64                              34/37
  Verifying  : perl-Text-ParseWords-3.29-4.el7.noarch                     35/37
  Verifying  : glibc-common-2.17-105.el7.x86_64                           36/37
  Verifying  : glibc-2.17-105.el7.x86_64                                  37/37

Installed:
  gcc.x86_64 0:4.8.5-4.el7           kernel-devel.x86_64 0:3.10.0-327.el7
  perl.x86_64 4:5.16.3-286.el7

Dependency Installed:
  cpp.x86_64 0:4.8.5-4.el7
  glibc-devel.x86_64 0:2.17-106.el7_2.8
  glibc-headers.x86_64 0:2.17-106.el7_2.8
  kernel-headers.x86_64 0:3.10.0-327.36.3.el7
  perl-Carp.noarch 0:1.26-244.el7
  perl-Encode.x86_64 0:2.51-7.el7
  perl-Exporter.noarch 0:5.68-3.el7
  perl-File-Path.noarch 0:2.09-2.el7
  perl-File-Temp.noarch 0:0.23.01-3.el7
  perl-Filter.x86_64 0:1.49-3.el7
  perl-Getopt-Long.noarch 0:2.40-2.el7
  perl-HTTP-Tiny.noarch 0:0.033-3.el7
  perl-PathTools.x86_64 0:3.40-5.el7
  perl-Pod-Escapes.noarch 1:1.04-286.el7
  perl-Pod-Perldoc.noarch 0:3.20-4.el7
  perl-Pod-Simple.noarch 1:3.28-4.el7
  perl-Pod-Usage.noarch 0:1.63-3.el7
  perl-Scalar-List-Utils.x86_64 0:1.27-248.el7
  perl-Socket.x86_64 0:2.010-3.el7
  perl-Storable.x86_64 0:2.45-3.el7
  perl-Text-ParseWords.noarch 0:3.29-4.el7
  perl-Time-HiRes.x86_64 4:1.9725-3.el7
  perl-Time-Local.noarch 0:1.2300-2.el7
  perl-constant.noarch 0:1.27-2.el7
  perl-libs.x86_64 4:5.16.3-286.el7
  perl-macros.x86_64 4:5.16.3-286.el7
  perl-parent.noarch 1:0.225-244.el7
  perl-podlators.noarch 0:2.5.1-3.el7
  perl-threads.x86_64 0:1.87-4.el7
  perl-threads-shared.x86_64 0:1.43-6.el7

Dependency Updated:
  glibc.x86_64 0:2.17-106.el7_2.8     glibc-common.x86_64 0:2.17-106.el7_2.8

Complete!
Copy iso file /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
mount: /dev/loop0 is write-protected, mounting read-only
Installing Virtualbox Guest Additions 5.0.30 - guest version is 5.0.26
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.0.30 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 5.0.26 of VirtualBox Guest Additions...
Removing existing VirtualBox non-DKMS kernel modules[  OK  ]
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules[  OK  ]
Building the VirtualBox Guest Additions kernel modules
Building the main Guest Additions module^@[  OK  ]
Building the shared folder support module[  OK  ]
Building the graphics driver module[  OK  ]
Doing non-kernel setup of the Guest Additions[  OK  ]
You should restart your guest to make sure the new modules are actually used


==> host: Checking for guest additions in VM...
==> host: Setting hostname...
==> host: Configuring and enabling network interfaces...
^@==> host: Mounting shared folders...
    host: /vagrant => /Users/XXXXX/development/vagrant
==> host: Running provisioner: ansible_local...
    host: Installing Ansible...
    host: Running ansible-playbook...
cd /vagrant && PYTHONUNBUFFERED=1 ANSIBLE_FORCE_COLOR=true ansible-playbook --limit="all" --inventory-file=provision/inventory -v provision/playbook.yml
Using /vagrant/ansible.cfg as config file

PLAY [host] ********************************************************************

TASK [setup] *******************************************************************
ok: [host]

TASK [provision test] **********************************************************
ok: [host] => {
    "msg": "provision test"
}

PLAY RECAP *********************************************************************
host                       : ok=2    changed=0    unreachable=0    failed=0

vagrant 起動確認

$ vagrant ssh host
[vagrant@host ~]$ ansible --version
ansible 2.2.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
[vagrant@host ~]$
ssh 出来て、ansibleのインストールが確認できたらここまでは完了。