More than 1 year has passed since last update.

Ansibleのコードをtest-kitchenとServerSpec、Dockerでテストします。サンプルとして、AnsibleでApacheをインストールし、ServerSpecでテストを行います。

事前準備

test-kitchenをインストールします。

$ sudo gem install test-kitchen -v 1.2.1
Fetching: test-kitchen-1.2.1.gem (100%)
Successfully installed test-kitchen-1.2.1
Installing ri documentation for test-kitchen-1.2.1
1 gem installed

プロジェクト用のディレクトリを作成。

$ mkdir foobar && cd foobar

Gemfileを作成して必要なライブラリをインストールします。

Gemfile
source "https://rubygems.org"

gem 'test-kitchen', '~> 1.2.1'
gem 'kitchen-ansible', '~> 0.0.2'
gem 'kitchen-docker', '~> 1.5.0'

group :integration do
  gem 'serverspec', '~> 2.3.1'
  gem 'specinfra', '~> 2.4.4'
end
$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Using diff-lcs (1.2.5)
Using kitchen-ansible (0.0.2)
Installing mixlib-shellout (1.6.0)
Using net-ssh (2.9.1)
Using net-scp (1.2.1)
Using safe_yaml (1.0.4)
Using thor (0.19.1)
Using test-kitchen (1.2.1)
Using kitchen-docker (1.5.0)
Using multi_json (1.10.1)
Using rspec-support (3.1.2)
Using rspec-core (3.1.7)
Using rspec-expectations (3.1.2)
Using rspec-mocks (3.1.3)
Using rspec (3.1.0)
Using rspec-its (1.1.0)
Using specinfra (2.4.4)
Using serverspec (2.3.1)
Using bundler (1.3.5)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

test-kitchenの設定

まずはtest-kitchenの初期化を行います。-Dオプションで使用するドライバーを、-Pオプションで使用するプロビジョナーを指定することができます。今回はドライバにDockerを、プロビジョナーにはansible_playbookを使用します。

$ bundle exec kitchen init -D docker -P ansible_playbook
      create  .kitchen.yml
      create  test/integration/default
      append  Gemfile
You must run `bundle install' to fetch any new gems.

kitchen init で作成された.kitchen.ymlは以下の通り。

.kitchen.yml
---
driver:
  name: docker

provisioner:
  name: ansible_playbook

platforms:
  - name: ubuntu-12.04
  - name: centos-6.4

suites:
  - name: default
    run_list:
    attributes:

これを、以下のように変更します。driver_configのsocketはDockerの接続先です。

.kitchen.yml
---
driver:
  name: docker

provisioner:
  name: ansible_playbook
  hosts: foobar
  roles_path: roles
  require_ansible_repo: true

platforms:
  - name: ubuntu-12.04
    driver_config:
      image: ubuntu:12.04
      socket: tcp://localhost:4242

suites:
  - name: default

Ansibleのコードを作成する

今回はAnsibleでapacheをインストールすることにします。

$ mkdir -p roles/foo/tasks
roles/foo/tasks/main.yml
- apt: pkg=apache2

site.ymlファイルは以下のようにしておきます。

site.yml
- hosts: foobar
  roles:
    - foo

ServerSpecの設定をする

Serverspecで使用するファイルを追加します。
specというディレクトリ以下に作成されるので、このディレクトリをserverspecにリネームします。

$ cd test/integration/default
$ serverspec-init
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
$ mv spec serverspec

初期状態ではapacheのテストが書かれています。
Ansibleでapacheをインストールするようにしているため、インストールされているかどうかのテストは通るはずです。

test/integration/default/serverspec/localhost/sample_spec.rb
require 'spec_helper'

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

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

describe service('httpd'), :if => os[:family] == 'redhat' do
  it { should be_enabled }
  it { should be_running }
end

describe service('apache2'), :if => os[:family] == 'ubuntu' do
  it { should be_enabled }
  it { should be_running }
end

describe service('org.apache.httpd'), :if => os[:family] == 'darwin' do
  it { should be_enabled }
  it { should be_running }
end

describe port(80) do
  it { should be_listening }
end

テストの実行

テスト用の環境を作成する

まず、デストで使用するためのDockerコンテナを作成します。
なぜか、実行時にDockerのUsageが出力されていたのでこの記事ではその箇所を削除しています。

 $ kitchen create
-----> Starting Kitchen (v1.2.1)
-----> Creating <default-ubuntu-1204>...
       Sending build context to Docker daemon 2.048 kB
       Sending build context to Docker daemon
       Step 0 : FROM ubuntu:12.04
        ---> 0b310e6bf058
       Step 1 : RUN dpkg-divert --local --rename --add /sbin/initctl
        ---> Using cache
        ---> 76685424c7fa
       Step 2 : RUN ln -sf /bin/true /sbin/initctl
        ---> Using cache
        ---> 83c6a5f1d537
       Step 3 : ENV DEBIAN_FRONTEND noninteractive
        ---> Using cache
        ---> 5bfc7d3c21f2
       Step 4 : RUN apt-get update
        ---> Using cache
        ---> 43896feefd33
       Step 5 : RUN apt-get install -y sudo openssh-server curl lsb-release
        ---> Using cache
        ---> 208d8a4f2538
       Step 6 : RUN useradd -d /home/kitchen -m -s /bin/bash kitchen
        ---> Using cache
        ---> 3bd9c4c07cbb
       Step 7 : RUN echo kitchen:kitchen | chpasswd
        ---> Using cache
        ---> f2d079722c7f
       Step 8 : RUN echo 'kitchen ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
        ---> Using cache
        ---> 900ee3f2a87d
       Successfully built 900ee3f2a87d
       234361d227b0a7093ac561c48ff087e4d6b26db0a63bdcdcd4827756a01c7747
       [{
           "Args": [
        "-D",
        "-o",
        "UseDNS=no",
        "-o",
        "UsePAM=no",
        "-o",
        "UsePrivilegeSeparation=no",
        "-o",
        "PidFile=/tmp/sshd.pid"
           ],
           "Config": {
        "AttachStderr": false,
        "AttachStdin": false,
        "AttachStdout": false,
        "Cmd": [
            "/usr/sbin/sshd",
            "-D",
            "-o",
            "UseDNS=no",
            "-o",
            "UsePAM=no",
            "-o",
            "UsePrivilegeSeparation=no",
            "-o",
            "PidFile=/tmp/sshd.pid"
        ],
        "CpuShares": 0,
        "Cpuset": "",
        "Domainname": "",
        "Entrypoint": null,
        "Env": [
            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "DEBIAN_FRONTEND=noninteractive"
        ],
        "ExposedPorts": {
            "22/tcp": {}
        },
        "Hostname": "234361d227b0",
        "Image": "900ee3f2a87d",
        "Memory": 0,
        "MemorySwap": 0,
        "NetworkDisabled": false,
        "OnBuild": null,
        "OpenStdin": false,
        "PortSpecs": null,
        "SecurityOpt": null,
        "StdinOnce": false,
        "Tty": false,
        "User": "",
        "Volumes": null,
        "WorkingDir": ""
           },
           "Created": "2014-11-18T05:59:28.90033457Z",
           "Driver": "aufs",
           "ExecDriver": "native-0.2",
           "HostConfig": {
        "Binds": null,
        "CapAdd": null,
        "CapDrop": null,
        "ContainerIDFile": "",
        "Devices": [],
        "Dns": null,
        "DnsSearch": null,
        "ExtraHosts": null,
        "Links": null,
        "LxcConf": [],
        "NetworkMode": "bridge",
        "PortBindings": {
            "22/tcp": [
                {
                    "HostIp": "",
                    "HostPort": ""
                }
            ]
        },
        "Privileged": false,
        "PublishAllPorts": false,
        "RestartPolicy": {
            "MaximumRetryCount": 0,
            "Name": ""
        },
        "VolumesFrom": null
           },
           "HostnamePath": "/mnt/VirtualBox/docker/containers/234361d227b0a7093ac561c48ff087e4d6b26db0a63bdcdcd4827756a01c7747/hostname",
           "HostsPath": "/mnt/VirtualBox/docker/containers/234361d227b0a7093ac561c48ff087e4d6b26db0a63bdcdcd4827756a01c7747/hosts",
           "Id": "234361d227b0a7093ac561c48ff087e4d6b26db0a63bdcdcd4827756a01c7747",
           "Image": "900ee3f2a87d35843bbb34009c2f972e99c99449e02639d7fec43e5c04a7d66e",
           "MountLabel": "",
           "Name": "/grave_euclid",
           "NetworkSettings": {
        "Bridge": "docker0",
        "Gateway": "172.17.42.1",
        "IPAddress": "172.17.0.44",
        "IPPrefixLen": 16,
        "MacAddress": "02:42:ac:11:00:2c",
        "PortMapping": null,
        "Ports": {
            "22/tcp": [
                {
                    "HostIp": "0.0.0.0",
                    "HostPort": "49169"
                }
            ]
        }
           },
           "Path": "/usr/sbin/sshd",
           "ProcessLabel": "",
           "ResolvConfPath": "/mnt/VirtualBox/docker/containers/234361d227b0a7093ac561c48ff087e4d6b26db0a63bdcdcd4827756a01c7747/resolv.conf",
           "State": {
        "ExitCode": 0,
        "FinishedAt": "0001-01-01T00:00:00Z",
        "Paused": false,
        "Pid": 26746,
        "Restarting": false,
        "Running": true,
        "StartedAt": "2014-11-18T05:59:29.001133273Z"
           },
           "Volumes": {},
           "VolumesRW": {}
       }
       ]
       Finished creating <default-ubuntu-1204> (0m0.41s).
-----> Kitchen is finished. (0m0.45s)

作成した環境を確認します。最後のアクションが「Created」となっていることがわかります。

$ kitchen list
Instance             Driver  Provisioner      Last Action
default-ubuntu-1204  Docker  AnsiblePlaybook  Created

Ansibleのコードを実行する

$ kitchen converge
-----> Starting Kitchen (v1.2.1)
-----> Converging <default-ubuntu-1204>...
       Preparing files for transfer
       Preparing playbook
       Preparing modules
       nothing to do for modules
       Preparing roles
       Preparing ansible.cfg file
       Preparing group_vars
       nothing to do for group_vars
       Preparing host_vars
       nothing to do for host_vars
       Preparing hosts file
       Finished Preparing files for transfer
       Installing ansible, will try to determine platform os
Reading package lists... Done
Building dependency tree
Reading state information... 1%
Reading state information... Done
       The following extra packages will be installed:
         libapt-inst1.4 libapt-pkg4.12
       The following NEW packages will be installed:
         apt-utils libapt-inst1.4
       The following packages will be upgraded:
         libapt-pkg4.12
       1 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
       Need to get 1229 kB of archives.
       After this operation, 1407 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ precise-updates/main libapt-pkg4.12 amd64 0.8.16~exp12ubuntu10.22 [936 kB]
1% [1 libapt-pkg4.12 14.2 kB/936 kB 2%]
Get:2 http://archive.ubuntu.com/ubuntu/ precise-updates/main libapt-inst1.4 amd64 0.8.16~exp12ubuntu10.22 [102 kB]
78% [2 libapt-inst1.4 20.6 kB/102 kB 20%]
Get:3 http://archive.ubuntu.com/ubuntu/ precise-updates/main apt-utils amd64 0.8.16~exp12ubuntu10.22 [191 kB]
85% [3 apt-utils 9521 B/191 kB 5%]
Fetched 1229 kB in 5s (241 kB/s)
       debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 9171 files and directories currently installed.)
       Preparing to replace libapt-pkg4.12 0.8.16~exp12ubuntu10.21 (using .../libapt-pkg4.12_0.8.16~exp12ubuntu10.22_amd64.deb) ...
       Unpacking replacement libapt-pkg4.12 ...
       Setting up libapt-pkg4.12 (0.8.16~exp12ubuntu10.22) ...
       Processing triggers for libc-bin ...
       ldconfig deferred processing now taking place
       Selecting previously unselected package libapt-inst1.4.
       (Reading database ...
(Reading database ... 9171 files and directories currently installed.)
       Unpacking libapt-inst1.4 (from .../libapt-inst1.4_0.8.16~exp12ubuntu10.22_amd64.deb) ...
       Selecting previously unselected package apt-utils.
       Unpacking apt-utils (from .../apt-utils_0.8.16~exp12ubuntu10.22_amd64.deb) ...
       Setting up libapt-inst1.4 (0.8.16~exp12ubuntu10.22) ...
       Setting up apt-utils (0.8.16~exp12ubuntu10.22) ...
       Processing triggers for libc-bin ...
       ldconfig deferred processing now taking place
Reading package lists... Done
Building dependency tree
Reading state information... 0%
Reading state information... Done
       The following extra packages will be installed:
         gir1.2-glib-2.0 libdbus-glib-1-2 libgirepository-1.0-1 python-dbus
         python-dbus-dev python-gi
       Suggested packages:
         python-dbus-doc python-dbus-dbg python-gi-cairo
       The following NEW packages will be installed:
         gir1.2-glib-2.0 libdbus-glib-1-2 libgirepository-1.0-1 python-dbus
         python-dbus-dev python-gi software-properties-common
       0 upgraded, 7 newly installed, 0 to remove and 1 not upgraded.
       Need to get 669 kB of archives.
       After this operation, 2578 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ precise-updates/main libdbus-glib-1-2 amd64 0.98-1ubuntu1.1 [73.6 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ precise/main libgirepository-1.0-1 amd64 1.32.0-1 [101 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ precise/main gir1.2-glib-2.0 amd64 1.32.0-1 [157 kB]
28% [3 gir1.2-glib-2.0 13.0 kB/157 kB 8%]
Get:4 http://archive.ubuntu.com/ubuntu/ precise/main python-dbus-dev all 1.0.0-1ubuntu1 [5556 B]
50% [4 python-dbus-dev 5556 B/5556 B 100%]
Get:5 http://archive.ubuntu.com/ubuntu/ precise/main python-dbus amd64 1.0.0-1ubuntu1 [102 kB]
52% [5 python-dbus 9189 B/102 kB 9%]
Get:6 http://archive.ubuntu.com/ubuntu/ precise-updates/main python-gi amd64 3.2.2-1~precise [222 kB]
67% [6 python-gi 7871 B/222 kB 4%]
Get:7 http://archive.ubuntu.com/ubuntu/ precise-updates/main software-properties-common all 0.82.7.7 [8450 B]
100% [7 software-properties-common 8450 B/8450 B 100%]
Fetched 669 kB in 4s (157 kB/s)
       Selecting previously unselected package libdbus-glib-1-2.
       (Reading database ...
(Reading database ... 9252 files and directories currently installed.)
       Unpacking libdbus-glib-1-2 (from .../libdbus-glib-1-2_0.98-1ubuntu1.1_amd64.deb) ...
       Selecting previously unselected package libgirepository-1.0-1.
       Unpacking libgirepository-1.0-1 (from .../libgirepository-1.0-1_1.32.0-1_amd64.deb) ...
       Selecting previously unselected package gir1.2-glib-2.0.
       Unpacking gir1.2-glib-2.0 (from .../gir1.2-glib-2.0_1.32.0-1_amd64.deb) ...
       Selecting previously unselected package python-dbus-dev.
       Unpacking python-dbus-dev (from .../python-dbus-dev_1.0.0-1ubuntu1_all.deb) ...
       Selecting previously unselected package python-dbus.
       Unpacking python-dbus (from .../python-dbus_1.0.0-1ubuntu1_amd64.deb) ...
       Selecting previously unselected package python-gi.
       Unpacking python-gi (from .../python-gi_3.2.2-1~precise_amd64.deb) ...
       Selecting previously unselected package software-properties-common.
       Unpacking software-properties-common (from .../software-properties-common_0.82.7.7_all.deb) ...
       Setting up libdbus-glib-1-2 (0.98-1ubuntu1.1) ...
       Setting up libgirepository-1.0-1 (1.32.0-1) ...
       Setting up gir1.2-glib-2.0 (1.32.0-1) ...
       Setting up python-dbus-dev (1.0.0-1ubuntu1) ...
       Setting up python-dbus (1.0.0-1ubuntu1) ...
       Remove stale byte-compiled files...
       Setting up python-gi (3.2.2-1~precise) ...
       Setting up software-properties-common (0.82.7.7) ...
       Processing triggers for libc-bin ...
       ldconfig deferred processing now taking place
Reading package lists... Done
Building dependency tree
Reading state information... 0%
Reading state information... Done
       The following extra packages will be installed:
         iso-codes libcurl3-gnutls python-apt python-apt-common python-gnupginterface
         python-pycurl ucf unattended-upgrades xz-lzma
       Suggested packages:
         isoquery python-apt-dbg python-gtk2 python-vte python-apt-doc
         libcurl4-gnutls-dev python-pycurl-dbg bsd-mailx
       The following NEW packages will be installed:
         iso-codes libcurl3-gnutls python-apt python-apt-common python-gnupginterface
         python-pycurl python-software-properties ucf unattended-upgrades xz-lzma
       0 upgraded, 10 newly installed, 0 to remove and 1 not upgraded.
       Need to get 4167 kB of archives.
       After this operation, 16.1 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ precise-updates/main libcurl3-gnutls amd64 7.22.0-3ubuntu4.11 [227 kB]
0% [1 libcurl3-gnutls 14.2 kB/227 kB 6%]
Get:2 http://archive.ubuntu.com/ubuntu/ precise/main ucf all 3.0025+nmu2ubuntu1 [54.4 kB]
6% [2 ucf 16.4 kB/54.4 kB 30%]
Get:3 http://archive.ubuntu.com/ubuntu/ precise/main iso-codes all 3.31-1 [3547 kB]
8% [3 iso-codes 45.1 kB/3547 kB 1%]
Get:4 http://archive.ubuntu.com/ubuntu/ precise-updates/main python-apt-common all 0.8.3ubuntu7.2 [22.2 kB]
92% [4 python-apt-common 8840 B/22.2 kB 40%]
Get:5 http://archive.ubuntu.com/ubuntu/ precise-updates/main python-apt amd64 0.8.3ubuntu7.2 [187 kB]
93% [5 python-apt 12.4 kB/187 kB 7%]
Get:6 http://archive.ubuntu.com/ubuntu/ precise/main python-gnupginterface all 0.3.2-9.1ubuntu3 [19.2 kB]
97% [6 python-gnupginterface 18.9 kB/19.2 kB 98%]
Get:7 http://archive.ubuntu.com/ubuntu/ precise/main xz-lzma all 5.1.1alpha+20110809-3 [12.4 kB]
97% [7 xz-lzma 4000 B/12.4 kB 32%]
Get:8 http://archive.ubuntu.com/ubuntu/ precise-updates/main unattended-upgrades all 0.76ubuntu1 [24.7 kB]
98% [8 unattended-upgrades 12.7 kB/24.7 kB 52%]
Get:9 http://archive.ubuntu.com/ubuntu/ precise/main python-pycurl amd64 7.19.0-4ubuntu3 [49.2 kB]
98% [9 python-pycurl 5139 B/49.2 kB 10%]
Get:10 http://archive.ubuntu.com/ubuntu/ precise-updates/main python-software-properties all 0.82.7.7 [23.5 kB]
100% [10 python-software-properties 10.7 kB/23.5 kB 46%]
Fetched 4167 kB in 3s (1302 kB/s)
       Preconfiguring packages ...
       Selecting previously unselected package libcurl3-gnutls.
(Reading database ... 30%...
(Reading database ... 9428 files and directories currently installed.)
       Unpacking libcurl3-gnutls (from .../libcurl3-gnutls_7.22.0-3ubuntu4.11_amd64.deb) ...
       Selecting previously unselected package ucf.
       Unpacking ucf (from .../ucf_3.0025+nmu2ubuntu1_all.deb) ...
       Moving old data out of the way
Selecting previously unselected package iso-codes.
Unpacking iso-codes (from .../iso-codes_3.31-1_all.deb) ...
       Selecting previously unselected package python-apt-common.
       Unpacking python-apt-common (from .../python-apt-common_0.8.3ubuntu7.2_all.deb) ...
       Selecting previously unselected package python-apt.
       Unpacking python-apt (from .../python-apt_0.8.3ubuntu7.2_amd64.deb) ...
       Selecting previously unselected package python-gnupginterface.
       Unpacking python-gnupginterface (from .../python-gnupginterface_0.3.2-9.1ubuntu3_all.deb) ...
       Selecting previously unselected package xz-lzma.
       Unpacking xz-lzma (from .../xz-lzma_5.1.1alpha+20110809-3_all.deb) ...
       Selecting previously unselected package unattended-upgrades.
       Unpacking unattended-upgrades (from .../unattended-upgrades_0.76ubuntu1_all.deb) ...
       Selecting previously unselected package python-pycurl.
       Unpacking python-pycurl (from .../python-pycurl_7.19.0-4ubuntu3_amd64.deb) ...
       Selecting previously unselected package python-software-properties.
       Unpacking python-software-properties (from .../python-software-properties_0.82.7.7_all.deb) ...
       Setting up libcurl3-gnutls (7.22.0-3ubuntu4.11) ...
       Setting up ucf (3.0025+nmu2ubuntu1) ...
       Setting up iso-codes (3.31-1) ...
       Setting up python-apt-common (0.8.3ubuntu7.2) ...
       Setting up python-apt (0.8.3ubuntu7.2) ...
       Setting up python-gnupginterface (0.3.2-9.1ubuntu3) ...
       Setting up xz-lzma (5.1.1alpha+20110809-3) ...
       Setting up unattended-upgrades (0.76ubuntu1) ...
       Setting up python-pycurl (7.19.0-4ubuntu3) ...
       Setting up python-software-properties (0.82.7.7) ...
       Processing triggers for libc-bin ...
       ldconfig deferred processing now taking place
       gpg: keyring `/tmp/tmp7ofJgJ/secring.gpg' created
       gpg: keyring `/tmp/tmp7ofJgJ/pubring.gpg' created
       gpg: requesting key 5504681D from hkp server keyserver.ubuntu.com
       gpg: /tmp/tmp7ofJgJ/trustdb.gpg: trustdb created
       gpg: key 5504681D: public key "Launchpad PPA for Rodney Quillo" imported
       gpg: Total number processed: 1
       gpg:               imported: 1  (RSA: 1)
       OK
Hit http://archive.ubuntu.com precise Release.gpg
Get:1 http://archive.ubuntu.com precise-updates Release.gpg [198 B]
98% [1 Release.gpg 198 B/198 B 100%] [Waiting for headers]
Get:2 http://archive.ubuntu.com precise-security Release.gpg [198 B]
99% [Waiting for headers]
Hit http://archive.ubuntu.com precise-proposed Release.gpg
99% [Waiting for headers]
Hit http://archive.ubuntu.com precise Release
Get:3 http://archive.ubuntu.com precise-updates Release [194 kB]
7% [3 Release 12.7 kB/194 kB 7%] [Waiting for headers]
Get:4 http://ppa.launchpad.net precise Release.gpg [316 B]
Get:5 http://ppa.launchpad.net precise Release [11.9 kB]
20% [3 Release 28.6 kB/194 kB 15%] [5 Release 11.9 kB/11.9 kB 100%]
Get:6 http://ppa.launchpad.net precise/main Sources [560 B]
Get:7 http://ppa.launchpad.net precise/main amd64 Packages [549 B]
50% [3 Release 90.9 kB/194 kB 47%] [Waiting for headers]
Get:8 http://ppa.launchpad.net precise/main i386 Packages [549 B]
50% [3 Release 90.9 kB/194 kB 47%]
Get:9 http://archive.ubuntu.com precise-security Release [53.0 kB]
88% [9 Release 20.8 kB/53.0 kB 39%]
Hit http://archive.ubuntu.com precise-proposed Release
100% [Waiting for headers]
Hit http://archive.ubuntu.com precise/main Sources
100% [9 Release gpgv 53.0 kB]
Hit http://archive.ubuntu.com precise/restricted Sources
Hit http://archive.ubuntu.com precise/universe Sources
Hit http://archive.ubuntu.com precise/main amd64 Packages
Hit http://archive.ubuntu.com precise/restricted amd64 Packages
100% [9 Release gpgv 53.0 kB] [Waiting for headers]
Hit http://archive.ubuntu.com precise/universe amd64 Packages
Hit http://archive.ubuntu.com precise/main i386 Packages
Hit http://archive.ubuntu.com precise/restricted i386 Packages
100% [Sources 1175 kB] [Waiting for headers]
Hit http://archive.ubuntu.com precise/universe i386 Packages
Get:10 http://archive.ubuntu.com precise-updates/main Sources [588 kB]
Get:11 http://archive.ubuntu.com precise-updates/restricted Sources [8241 B]
100% [Packages 6180 kB] [11 Sources 8241 B/8241 B 100%]
Get:12 http://archive.ubuntu.com precise-updates/universe Sources [136 kB]
Get:13 http://archive.ubuntu.com precise-updates/main amd64 Packages [1091 kB]
94% [Packages 6180 kB] [13 Packages 23.4 kB/1091 kB 2%]
Get:14 http://archive.ubuntu.com precise-updates/restricted amd64 Packages [16.1 kB]
Get:15 http://archive.ubuntu.com precise-updates/universe amd64 Packages [321 kB]
99% [13 Packages 1091 kB] [15 Packages 81.5 kB/321 kB 25%]
Get:16 http://archive.ubuntu.com precise-updates/main i386 Packages [1134 kB]
Get:17 http://archive.ubuntu.com precise-updates/restricted i386 Packages [16.0 kB]
100% [17 Packages 16.0 kB/16.0 kB 100%]
Get:18 http://archive.ubuntu.com precise-updates/universe i386 Packages [330 kB]
99% [16 Packages 1134 kB] [18 Packages 32.0 kB/330 kB 10%]
Get:19 http://archive.ubuntu.com precise-security/main Sources [144 kB]
100% [19 Sources 32.3 kB/144 kB 22%]                               4410 kB/s 0s
Get:20 http://archive.ubuntu.com precise-security/restricted Sources [2258 B]
Get:21 http://archive.ubuntu.com precise-security/universe Sources [37.9 kB]
Get:22 http://archive.ubuntu.com precise-security/main amd64 Packages [565 kB]
98% [18 Packages 330 kB] [22 Packages 35.1 kB/565 kB 6%]           4410 kB/s 0s
Get:23 http://archive.ubuntu.com precise-security/restricted amd64 Packages [5282 B]
Get:24 http://archive.ubuntu.com precise-security/universe amd64 Packages [129 kB]
Get:25 http://archive.ubuntu.com precise-security/main i386 Packages [607 kB]
98% [22 Packages 565 kB] [25 Packages 4096 B/607 kB 1%]            4410 kB/s 0s
Get:26 http://archive.ubuntu.com precise-security/restricted i386 Packages [5273 B]
Get:27 http://archive.ubuntu.com precise-security/universe i386 Packages [136 kB]
100% [25 Packages 607 kB] [27 Packages 8192 B/136 kB 6%]           4410 kB/s 0s
Hit http://archive.ubuntu.com precise-proposed/main amd64 Packages
Hit http://archive.ubuntu.com precise-proposed/restricted amd64 Packages
Hit http://archive.ubuntu.com precise-proposed/main i386 Packages
Hit http://archive.ubuntu.com precise-proposed/restricted i386 Packages
100% [25 Packages 607 kB]                                          4410 kB/s 0s
Fetched 5534 kB in 6s (817 kB/s)
Reading package lists... Done
        package lists... Done
Building dependency tree
Reading state information... 0%
Reading state information... Done
       The following extra packages will be installed:
         libgmp10 libyaml-0-2 python-crypto python-httplib2 python-jinja2
         python-markupsafe python-paramiko python-pkg-resources python-setuptools
         python-support python-yaml sshpass
       Suggested packages:
         python-crypto-dbg python-crypto-doc python-jinja2-doc python-distribute
         python-distribute-doc
       The following NEW packages will be installed:
         ansible libgmp10 libyaml-0-2 python-crypto python-httplib2 python-jinja2
         python-markupsafe python-paramiko python-pkg-resources python-setuptools
         python-support python-yaml sshpass
       0 upgraded, 13 newly installed, 0 to remove and 1 not upgraded.
       Need to get 2974 kB of archives.
       After this operation, 15.8 MB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/rquillo/ansible/ubuntu/ precise/main ansible all 1.7.1-precise-unstable-ppa [696 kB]
0% [Waiting for headers] [1 ansible 14.2 kB/696 kB 2%]
Get:2 http://archive.ubuntu.com/ubuntu/ precise/main libgmp10 amd64 2:5.0.2+dfsg-2ubuntu1 [238 kB]
1% [2 libgmp10 14.2 kB/238 kB 6%] [1 ansible 14.2 kB/696 kB 2%]
Get:3 http://archive.ubuntu.com/ubuntu/ precise-updates/main libyaml-0-2 amd64 0.1.4-2ubuntu0.12.04.3 [57.8 kB]
15% [3 libyaml-0-2 8795 B/57.8 kB 15%] [1 ansible 188 kB/696 kB 27%]
Get:4 http://archive.ubuntu.com/ubuntu/ precise/universe python-support all 1.0.14ubuntu2 [26.1 kB]
18% [4 python-support 11.5 kB/26.1 kB 44%] [1 ansible 231 kB/696 kB 33%]
Get:5 http://archive.ubuntu.com/ubuntu/ precise/main python-markupsafe amd64 0.15-1 [13.6 kB]
Get:6 http://archive.ubuntu.com/ubuntu/ precise-updates/main python-jinja2 amd64 2.6-1ubuntu0.1 [158 kB]
Get:7 http://archive.ubuntu.com/ubuntu/ precise/main python-yaml amd64 3.10-2 [122 kB]
32% [7 python-yaml 28.3 kB/122 kB 23%] [1 ansible 424 kB/696 kB 61%]
Get:8 http://archive.ubuntu.com/ubuntu/ precise-updates/main python-crypto amd64 2.4.1-1ubuntu0.1 [293 kB]
38% [8 python-crypto 18.4 kB/293 kB 6%] [1 ansible 506 kB/696 kB 73%]
Get:9 http://archive.ubuntu.com/ubuntu/ precise-updates/main python-paramiko all 1.7.7.1-2ubuntu1 [797 kB]
54% [9 python-paramiko 8192 B/797 kB 1%]
Get:10 http://archive.ubuntu.com/ubuntu/ precise-updates/main python-httplib2 all 0.7.2-1ubuntu2.1 [57.1 kB]
81% [10 python-httplib2 12.7 kB/57.1 kB 22%]
Get:11 http://archive.ubuntu.com/ubuntu/ precise/universe sshpass amd64 1.05-1 [10.5 kB]
83% [11 sshpass 3053 B/10.5 kB 29%]
Get:12 http://archive.ubuntu.com/ubuntu/ precise/main python-pkg-resources all 0.6.24-1ubuntu1 [63.1 kB]
83% [12 python-pkg-resources 2369 B/63.1 kB 4%]
Get:13 http://archive.ubuntu.com/ubuntu/ precise/main python-setuptools all 0.6.24-1ubuntu1 [441 kB]
85% [13 python-setuptools 5567 B/441 kB 1%]
Fetched 2974 kB in 6s (481 kB/s)
       Selecting previously unselected package libgmp10.
       (Reading database ...
(Reading database ... 10166 files and directories currently installed.)
       Unpacking libgmp10 (from .../libgmp10_2%3a5.0.2+dfsg-2ubuntu1_amd64.deb) ...
       Selecting previously unselected package libyaml-0-2.
       Unpacking libyaml-0-2 (from .../libyaml-0-2_0.1.4-2ubuntu0.12.04.3_amd64.deb) ...
       Selecting previously unselected package python-support.
       Unpacking python-support (from .../python-support_1.0.14ubuntu2_all.deb) ...
       Selecting previously unselected package python-markupsafe.
       Unpacking python-markupsafe (from .../python-markupsafe_0.15-1_amd64.deb) ...
       Selecting previously unselected package python-jinja2.
       Unpacking python-jinja2 (from .../python-jinja2_2.6-1ubuntu0.1_amd64.deb) ...
       Selecting previously unselected package python-yaml.
       Unpacking python-yaml (from .../python-yaml_3.10-2_amd64.deb) ...
       Selecting previously unselected package python-crypto.
       Unpacking python-crypto (from .../python-crypto_2.4.1-1ubuntu0.1_amd64.deb) ...
       Selecting previously unselected package python-paramiko.
       Unpacking python-paramiko (from .../python-paramiko_1.7.7.1-2ubuntu1_all.deb) ...
       Selecting previously unselected package python-httplib2.
       Unpacking python-httplib2 (from .../python-httplib2_0.7.2-1ubuntu2.1_all.deb) ...
       Selecting previously unselected package sshpass.
       Unpacking sshpass (from .../sshpass_1.05-1_amd64.deb) ...
       Selecting previously unselected package python-pkg-resources.
       Unpacking python-pkg-resources (from .../python-pkg-resources_0.6.24-1ubuntu1_all.deb) ...
       Selecting previously unselected package python-setuptools.
       Unpacking python-setuptools (from .../python-setuptools_0.6.24-1ubuntu1_all.deb) ...
       Selecting previously unselected package ansible.
       Unpacking ansible (from .../ansible_1.7.1-precise-unstable-ppa_all.deb) ...
       Setting up libgmp10 (2:5.0.2+dfsg-2ubuntu1) ...
       Setting up libyaml-0-2 (0.1.4-2ubuntu0.12.04.3) ...
       Setting up python-support (1.0.14ubuntu2) ...
       Setting up python-markupsafe (0.15-1) ...
       Setting up python-jinja2 (2.6-1ubuntu0.1) ...
       Setting up python-yaml (3.10-2) ...
       Setting up python-crypto (2.4.1-1ubuntu0.1) ...
       Setting up python-paramiko (1.7.7.1-2ubuntu1) ...
       Setting up python-httplib2 (0.7.2-1ubuntu2.1) ...
       Setting up sshpass (1.05-1) ...
       Setting up python-pkg-resources (0.6.24-1ubuntu1) ...
       Setting up python-setuptools (0.6.24-1ubuntu1) ...
       Setting up ansible (1.7.1-precise-unstable-ppa) ...
       Processing triggers for libc-bin ...
       ldconfig deferred processing now taking place
       Processing triggers for python-support ...
-----> Installing Chef Omnibus to install busser to run tests
       downloading https://www.getchef.com/chef/install.sh
         to file /tmp/install.sh

       trying wget...
       Downloading Chef  for ubuntu...
       downloading https://www.getchef.com/chef/metadata?v=&prerelease=false&nightlies=false&p=ubuntu&pv=12.04&m=x86_64
         to file /tmp/install.sh.649/metadata.txt
       trying wget...
       url      https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef_11.16.4-1_amd64.deb
       md5      2ffff5b4d80e4dcffc917f8eb2003a31
       sha256   28b08975e7e33ac46c888616ec7fa232a0c624aeeda81e58a6047d2c6b62edfb
       downloaded metadata file looks valid...
       downloading https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef_11.16.4-1_amd64.deb
         to file /tmp/install.sh.649/chef_11.16.4-1_amd64.deb
       trying wget...
       Comparing checksum with sha256sum...
       Installing Chef
       installing with dpkg...
       Selecting previously unselected package chef.
(Reading database ... 25%...
(Reading database ... 11500 files and directories currently installed.)
       Unpacking chef (from .../chef_11.16.4-1_amd64.deb) ...
       Setting up chef (11.16.4-1) ...
       Thank you for installing Chef!
       Transfering files to <default-ubuntu-1204>

       PLAY [foobar] *****************************************************************

       GATHERING FACTS ***************************************************************
       ok: [localhost]

       TASK: [foo | apt pkg=apache2] *************************************************
       changed: [localhost]

       PLAY RECAP ********************************************************************
       localhost                  : ok=2    changed=1    unreachable=0    failed=0

       Finished converging <default-ubuntu-1204> (2m20.92s).
-----> Kitchen is finished. (2m20.96s)

テストする

$ kitchen verify
-----> Starting Kitchen (v1.2.1)
-----> Setting up <default-ubuntu-1204>...
Fetching: thor-0.19.0.gem (100%)
Fetching: busser-0.6.2.gem (100%)
       Successfully installed thor-0.19.0
       Successfully installed busser-0.6.2
       2 gems installed
-----> Setting up Busser
       Creating BUSSER_ROOT in /tmp/busser
       Creating busser binstub
       Plugin serverspec installed (version 0.5.3)
-----> Running postinstall for serverspec plugin
       Finished setting up <default-ubuntu-1204> (0m46.47s).
-----> Verifying <default-ubuntu-1204>...
       Suite path directory /tmp/busser/suites does not exist, skipping.
       Uploading /tmp/busser/suites/serverspec/spec_helper.rb (mode=0644)
       Uploading /tmp/busser/suites/serverspec/localhost/sample_spec.rb (mode=0644)
-----> Running serverspec test suite
-----> Installing Serverspec..
Fetching: rspec-support-3.1.2.gem (100%)
Fetching: rspec-core-3.1.7.gem (100%)
Fetching: diff-lcs-1.2.5.gem (100%)
Fetching: rspec-expectations-3.1.2.gem (100%)
Fetching: rspec-mocks-3.1.3.gem (100%)
Fetching: rspec-3.1.0.gem (100%)
Fetching: rspec-its-1.1.0.gem (100%)
Fetching: multi_json-1.10.1.gem (100%)
Fetching: net-ssh-2.9.1.gem (100%)
Fetching: net-scp-1.2.1.gem (100%)
Fetching: specinfra-2.4.4.gem (100%)
Fetching: serverspec-2.3.1.gem (100%)
-----> serverspec installed (version 2.3.1)
       /opt/chef/embedded/bin/ruby -I/tmp/busser/suites/serverspec -I/tmp/busser/gems/gems/rspec-support-3.1.2/lib:/tmp/busser/gems/gems/rspec-core-3.1.7/lib /opt/chef/embedded/bin/rspec --pattern /tmp/busser/suites/serverspec/\*\*/\*_spec.rb --color --format documentation --default-path /tmp/busser/suites/serverspec

       Package "apache2"
         should be installed

       Service "apache2"
         should be enabled
         should be running (FAILED - 1)

       Port "80"
         should be listening (FAILED - 2)

       Failures:

         1) Service "apache2" should be running

            Failure/Error: it { should be_running }
              expected Service "apache2" to be running
              /bin/sh -c service\ apache2\ status\ \&\&\ service\ apache2\ status\ \|\ grep\ \'running\'
              Apache2 is NOT running.

            # /tmp/busser/suites/serverspec/localhost/sample_spec.rb:18:in `block (2 levels) in <top (required)>'

         2) Port "80" should be listening
            Failure/Error: it { should be_listening }
              expected Port "80" to be listening
              /bin/sh -c netstat\ -tunl\ \|\ grep\ --\ :80
              /bin/sh: 1: netstat: not found

            # /tmp/busser/suites/serverspec/localhost/sample_spec.rb:27:in `block (2 levels) in <top (required)>'

       Finished in 0.03473 seconds (files took 0.36989 seconds to load)
       4 examples, 2 failures

       Failed examples:

       rspec /tmp/busser/suites/serverspec/localhost/sample_spec.rb:18 # Service "apache2" should be running
       rspec /tmp/busser/suites/serverspec/localhost/sample_spec.rb:27 # Port "80" should be listening
       /opt/chef/embedded/bin/ruby -I/tmp/busser/suites/serverspec -I/tmp/busser/gems/gems/rspec-support-3.1.2/lib:/tmp/busser/gems/gems/rspec-core-3.1.7/lib /opt/chef/embedded/bin/rspec --pattern /tmp/busser/suites/serverspec/\*\*/\*_spec.rb --color --format documentation --default-path /tmp/busser/suites/serverspec failed
       Ruby Script [/tmp/busser/gems/gems/busser-serverspec-0.5.3/lib/busser/runner_plugin/../serverspec/runner.rb /tmp/busser/suites/serverspec] exit code was 1
>>>>>> Verify failed on instance <default-ubuntu-1204>.
>>>>>> Please see .kitchen/logs/default-ubuntu-1204.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sh -c 'BUSSER_ROOT="/tmp/busser" GEM_HOME="/tmp/busser/gems" GEM_PATH="/tmp/busser/gems" GEM_CACHE="/tmp/busser/gems/cache" ; export BUSSER_ROOT GEM_HOME GEM_PATH GEM_CACHE; sudo -E /tmp/busser/bin/busser test']
>>>>>> ----------------------

4テスト中2つが失敗しました。

修正して再度実行・テスト

失敗したテストから、以下の修正を加えます。。

  • サービスの設定が行われていなかったのでapache2のサービスを起動するように設定します。
  • また、netstatがインストールされていなかったので、net-toolsをインストールします
main.yml
- apt: pkg=apache2
- service: name=apache2 state=started
- apt: pkg=net-tools

修正後はkitchen convergeでテストできます。作成済みのインスタンスを使用するため、実行が早いです。

$ kitchen converge
-----> Starting Kitchen (v1.2.1)
-----> Converging <default-ubuntu-1204>...
       Preparing files for transfer
       Preparing playbook
       Preparing modules
       nothing to do for modules
       Preparing roles
       Preparing ansible.cfg file
       Preparing group_vars
       nothing to do for group_vars
       Preparing host_vars
       nothing to do for host_vars
       Preparing hosts file
       Finished Preparing files for transfer
       Installing ansible, will try to determine platform os
       Transfering files to <default-ubuntu-1204>

       PLAY [foobar] *****************************************************************

       GATHERING FACTS ***************************************************************
       ok: [localhost]

       TASK: [foo | apt pkg=apache2] *************************************************
       ok: [localhost]

       TASK: [foo | service name=apache2 state=started] ******************************
       changed: [localhost]

       TASK: [foo | apt pkg=net-tools] ***********************************************
       changed: [localhost]

       PLAY RECAP ********************************************************************
       localhost                  : ok=4    changed=2    unreachable=0    failed=0

       Finished converging <default-ubuntu-1204> (0m14.13s).
-----> Kitchen is finished. (0m14.17s)

変更に対して再度テストを実行します。

$ kitchen verify
-----> Starting Kitchen (v1.2.1)
-----> Setting up <default-ubuntu-1204>...
-----> Setting up Busser
       Creating BUSSER_ROOT in /tmp/busser

       Creating busser binstub
       Plugin serverspec already installed
       Finished setting up <default-ubuntu-1204> (0m6.15s).
-----> Verifying <default-ubuntu-1204>...
       Removing /tmp/busser/suites/serverspec
       Uploading /tmp/busser/suites/serverspec/spec_helper.rb (mode=0644)
       Uploading /tmp/busser/suites/serverspec/localhost/sample_spec.rb (mode=0644)
-----> Running serverspec test suite
       /opt/chef/embedded/bin/ruby -I/tmp/busser/suites/serverspec -I/tmp/busser/gems/gems/rspec-support-3.1.2/lib:/tmp/busser/gems/gems/rspec-core-3.1.7/lib /opt/chef/embedded/bin/rspec --pattern /tmp/busser/suites/serverspec/\*\*/\*_spec.rb --color --format documentation --default-path /tmp/busser/suites/serverspec

       Package "apache2"
         should be installed

       Service "apache2"
         should be enabled
         should be running

       Port "80"
         should be listening

       Finished in 0.04397 seconds (files took 0.37108 seconds to load)
       4 examples, 0 failures
       Finished verifying <default-ubuntu-1204> (0m1.69s).
-----> Kitchen is finished. (0m7.90s)

無事、テストが全て通りました。

後片付け

インタンスは残ったままなので、削除します。

$ kitchen destroy
-----> Starting Kitchen (v1.2.1)
-----> Destroying <default-ubuntu-1204>...
       [{
           "Args": [
        "-D",
        "-o",
        "UseDNS=no",
        "-o",
        "UsePAM=no",
        "-o",
        "UsePrivilegeSeparation=no",
        "-o",
        "PidFile=/tmp/sshd.pid"
           ],
           "Config": {
        "AttachStderr": false,
        "AttachStdin": false,
        "AttachStdout": false,
        "Cmd": [
            "/usr/sbin/sshd",
            "-D",
            "-o",
            "UseDNS=no",
            "-o",
            "UsePAM=no",
            "-o",
            "UsePrivilegeSeparation=no",
            "-o",
            "PidFile=/tmp/sshd.pid"
        ],
        "CpuShares": 0,
        "Cpuset": "",
        "Domainname": "",
        "Entrypoint": null,
        "Env": [
            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "DEBIAN_FRONTEND=noninteractive"
        ],
        "ExposedPorts": {
            "22/tcp": {}
        },
        "Hostname": "db1821df6a63",
        "Image": "900ee3f2a87d",
        "Memory": 0,
        "MemorySwap": 0,
        "NetworkDisabled": false,
        "OnBuild": null,
        "OpenStdin": false,
        "PortSpecs": null,
        "SecurityOpt": null,
        "StdinOnce": false,
        "Tty": false,
        "User": "",
        "Volumes": null,
        "WorkingDir": ""
           },
           "Created": "2014-11-18T06:18:38.815094709Z",
           "Driver": "aufs",
           "ExecDriver": "native-0.2",
           "HostConfig": {
        "Binds": null,
        "CapAdd": null,
        "CapDrop": null,
        "ContainerIDFile": "",
        "Devices": [],
        "Dns": null,
        "DnsSearch": null,
        "ExtraHosts": null,
        "Links": null,
        "LxcConf": [],
        "NetworkMode": "bridge",
        "PortBindings": {
            "22/tcp": [
                {
                    "HostIp": "",
                    "HostPort": ""
                }
            ]
        },
        "Privileged": false,
        "PublishAllPorts": false,
        "RestartPolicy": {
            "MaximumRetryCount": 0,
            "Name": ""
        },
        "VolumesFrom": null
           },
           "HostnamePath": "/mnt/VirtualBox/docker/containers/db1821df6a638dfa99a7c286eb8893f9be6a3a48c41d272ed78207baf17f3581/hostname",
           "HostsPath": "/mnt/VirtualBox/docker/containers/db1821df6a638dfa99a7c286eb8893f9be6a3a48c41d272ed78207baf17f3581/hosts",
           "Id": "db1821df6a638dfa99a7c286eb8893f9be6a3a48c41d272ed78207baf17f3581",
           "Image": "900ee3f2a87d35843bbb34009c2f972e99c99449e02639d7fec43e5c04a7d66e",
           "MountLabel": "",
           "Name": "/stoic_elion",
           "NetworkSettings": {
        "Bridge": "docker0",
        "Gateway": "172.17.42.1",
        "IPAddress": "172.17.0.45",
        "IPPrefixLen": 16,
        "MacAddress": "02:42:ac:11:00:2d",
        "PortMapping": null,
        "Ports": {
            "22/tcp": [
                {
                    "HostIp": "0.0.0.0",
                    "HostPort": "49170"
                }
            ]
        }
           },
           "Path": "/usr/sbin/sshd",
           "ProcessLabel": "",
           "ResolvConfPath": "/mnt/VirtualBox/docker/containers/db1821df6a638dfa99a7c286eb8893f9be6a3a48c41d272ed78207baf17f3581/resolv.conf",
           "State": {
        "ExitCode": 0,
        "FinishedAt": "0001-01-01T00:00:00Z",
        "Paused": false,
        "Pid": 4911,
        "Restarting": false,
        "Running": true,
        "StartedAt": "2014-11-18T06:18:38.933269334Z"
           },
           "Volumes": {},
           "VolumesRW": {}
       }
       ]
       db1821df6a638dfa99a7c286eb8893f9be6a3a48c41d272ed78207baf17f3581
       db1821df6a638dfa99a7c286eb8893f9be6a3a48c41d272ed78207baf17f3581
       Finished destroying <default-ubuntu-1204> (0m0.75s).
-----> Kitchen is finished. (0m0.80s)
$ kitchen list
Instance             Driver  Provisioner      Last Action
default-ubuntu-1204  Docker  AnsiblePlaybook  <Not Created>

参考