veeweeでCentOS 7 のVirtualBox用のVagrant Box ファイルを作成する

# 手順

```
$ cd /path/to/work

# テンプレートの確認
$ veewee vbox templates | grep -i centos

# 設定ファイルを作成
$ veewee vbox define cent7 'CentOS-7.0-1406-x86_64-netinstall' --workdir=/path/to/work

# 設定ファイルの修正
$ emacs definitions/cent7/definition.rb
$ emacs definitions/cent7/ks.cfg


# veewee vbox build cent7
(略)
```

# 設定ファイル

```definition.rb
(略)
  :iso_src => "http://mirror.nsc.liu.se/centos-store/7.0.1406/isos/x86_64/CentOS-7.0-1406-x86_64-NetInstall.iso",
(略)
  :postinstall_files => [
    "base.sh",
#    "chef.sh",
#    "puppet.sh",
    "vagrant.sh",
    "virtualbox.sh",
    #"vmfusion.sh",
    "cleanup.sh",
    "zerodisk.sh"
  ],
```


```ks.cfg
(略)
url --url=http://mirror.nsc.liu.se/centos-store/7.0.1406/os/x86_64/
(略)
```

# メモ

- definition.rbのiso_src, ki.cfgのurlは、初期値のURLが404になっているので、修正する必要がある

- postinstall_files は、vagrant+virtualbox用の環境が欲しいので、chef, puppet はコメントアウト
- デフォルトで用意されるpuppet.sh は、有効にしていると以下のようなエラーが発生する

```
failure: repodata/repomd.xml from epel: [Errno 256] No more mirrors to try.
http://download.fedoraproject.org/pub/epel/beta/7/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Waiting for ssh login on 127.0.0.1 with user veewee to sshd on port => 7222 to work, timeout=10000 sec
.
Executing command: echo 'veewee'|sudo -S sh './chef.sh'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 20307  100 20307    0     0  20210      0  0:00:01  0:00:01 --:--:-- 20226
el 7 x86_64
Getting information for chef stable  for el...
downloading https://omnitruck-direct.chef.io/stable/chef/metadata?v=&p=el&pv=7&m=x86_64
  to file /tmp/install.sh.10324/metadata.txt
trying curl...
sha1    ee2d523b7a3dbd0599e69c68626193351c78f21f
sha256  4adf75a32f4b417d4c6c764ebb7a5f1c746075da3d3e9a23465ce75f2926d34e
url     https://packages.chef.io/files/stable/chef/12.16.42/el/7/chef-12.16.42-1.el7.x86_64.rpm
version 12.16.42
downloaded metadata file looks valid...
downloading https://packages.chef.io/files/stable/chef/12.16.42/el/7/chef-12.16.42-1.el7.x86_64.rpm
  to file /tmp/install.sh.10324/chef-12.16.42-1.el7.x86_64.rpm
trying curl...
Comparing checksum with sha256sum...

WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING

You are installing an omnibus package without a version pin.  If you are installing
on production servers via an automated process this is DANGEROUS and you will
be upgraded without warning on new releases, even to new major releases.
Letting the version float is only appropriate in desktop, test, development or
CI/CD environments.

WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING

Installing chef
installing with rpm...
警告: /tmp/install.sh.10324/chef-12.16.42-1.el7.x86_64.rpm: ヘッダー V4 DSA/SHA1 Signature、鍵 ID 83ef826a: NOKEY
準備しています...              ################################# [100%]
更新中 / インストール中...
   1:chef-12.16.42-1.el7              ################################# [100%]
Thank you for installing Chef!
Waiting for ssh login on 127.0.0.1 with user veewee to sshd on port => 7222 to work, timeout=10000 sec
.
Executing command: echo 'veewee'|sudo -S sh './puppet.sh'
読み込んだプラグイン:fastestmirror
base                                                     | 3.6 kB     00:00
http://download.fedoraproject.org/pub/epel/beta/7/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
他のミラーを試します。


 One of the configured repositories failed (epel),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Disable the repository, so yum won't use it by default. Yum will then
        just ignore the repository until you permanently enable it again or use
        --enablerepo for temporary usage:

            yum-config-manager --disable epel

     4. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=epel.skip_if_unavailable=true

failure: repodata/repomd.xml from epel: [Errno 256] No more mirrors to try.
http://download.fedoraproject.org/pub/epel/beta/7/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
ERROR: exit code 1
Error executing command echo 'veewee'|sudo -S sh './puppet.sh' : Exitcode was not what we expected
Exitcode was not what we expected
```