Ansible with CentOS on Docker

## 目的

- CentOS(v7.3.1) を Docker で起動して Ansible(v2.3.1) を動かす。

## Docker  起動

```
Inohana:~ inoko$ docker run --name centos -v `pwd`:/centos -itd --restart=always centos tail -f /dev/null
b34358e67eaa4d3140dff0a10e2d7271e8e358e8d945377256916493c7acb71e
Inohana:~ inoko$ docker exec -it centos /bin/bash
[root@b34358e67eaa /]#
```

## CentOS 上に Ansible を Install

```
[root@b34358e67eaa /]# yum install epel-release
Loaded plugins: fastestmirror, ovl
base                                                                                                               | 3.6 kB  00:00:00
extras                                                                                                             | 3.4 kB  00:00:00
updates                                                                                                            | 3.4 kB  00:00:00
(1/4): extras/7/x86_64/primary_db                                                                                  | 191 kB  00:00:00
(2/4): base/7/x86_64/group_gz                                                                                      | 155 kB  00:00:00
(3/4): updates/7/x86_64/primary_db                                                                                 | 7.8 MB  00:00:04
(4/4): base/7/x86_64/primary_db                                                                                    | 5.6 MB  00:00:12
Determining fastest mirrors
 * base: ftp.nara.wide.ad.jp
 * extras: ftp.yz.yamagata-u.ac.jp
 * updates: ftp.yz.yamagata-u.ac.jp
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-9 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================
 Package                               Arch                            Version                      Repository                       Size
==========================================================================================================================================
Installing:
 epel-release                          noarch                          7-9                          extras                           14 k

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

[root@b34358e67eaa /]# yum install ansible sshpass
Loaded plugins: fastestmirror, ovl
epel/x86_64/metalink                                                                                               | 5.6 kB  00:00:00
epel                                                                                                               | 4.3 kB  00:00:00
(略)

[root@b34358e67eaa /]# yum install git
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: ftp.nara.wide.ad.jp
 * epel: ftp.jaist.ac.jp
 * extras: ftp.yz.yamagata-u.ac.jp
 * updates: ftp.yz.yamagata-u.ac.jp
Resolving Dependencies
--> Running transaction check
---> Package git.x86_64 0:1.8.3.1-6.el7_2.1 will be installed
(略)

```
[参考]
http://docs.ansible.com/ansible/latest/intro_installation.html

[抜粋]
We’ve changed how the Ansible community packages are distributed. For users of RHEL/CentOS/Scientific Linux version 7, the Ansible community RPM package will transition from the EPEL repository to the Extras channel. There will be no change for version 6 of RHEL/CentOS/Scientific Linux since Extras is not a part of version 6.