/var/www/yatta47.log

やったのログ置場です。スクラップみたいな短編が多いかと。

Amazon LinuxにAnsibleをインストール

インストール方法は複数あるみたい。

環境

[root@localhost ~]# uname -a
Linux localhost.localdomain 4.9.17-8.31.amzn1.x86_64 #1 SMP Sat Apr 1 01:22:16 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]#

vagrant 上に建てたAmazonLinuxです。

 

その1 : 失敗

[root@localhost ~]# pip install ansible
You are using pip version 6.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting ansible
  Downloading ansible-2.4.3.0.tar.gz (6.5MB)
    100% |████████████████████████████████| 6.5MB 74kB/s
Requirement already satisfied (use --upgrade to upgrade): jinja2 in /usr/lib/python2.7/dist-packages (from ansible)
Requirement already satisfied (use --upgrade to upgrade): PyYAML in /usr/lib64/python2.7/dist-packages (from ansible)
Requirement already satisfied (use --upgrade to upgrade): paramiko in /usr/lib/python2.7/dist-packages (from ansible)
Collecting cryptography (from ansible)

  Downloading cryptography-2.1.4.tar.gz (441kB)
    100% |████████████████████████████████| 442kB 987kB/s
    Complete output from command python setup.py egg_info:
    error in cryptography setup command: Invalid environment marker: python_version < '3'

    ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-v2eTEC/cryptography

なにやら失敗する。まぁPythonが入っていないとかそういう類じゃないかな。

ってことでyumでチャレンジ。

 

その2 : 成功

[root@localhost ~]# yum --enablerepo=epel install ansible
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main                                                                                        | 2.1 kB  00:00:00
amzn-updates                                                                                     | 2.3 kB  00:00:00
epel/x86_64/metalink                                                                             | 6.5 kB  00:00:00
epel                                                                                             | 4.7 kB  00:00:00
(1/3): epel/x86_64/updateinfo                                                                    | 776 kB  00:00:00
(2/3): epel/x86_64/group_gz                                                                      | 255 kB  00:00:02
(3/3): epel/x86_64/primary_db                                                                    | 6.0 MB  00:00:06
999 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package ansible.noarch 0:2.4.2.0-1.el6 will be installed
--> Processing Dependency: python(abi) = 2.6 for package: ansible-2.4.2.0-1.el6.noarch
--> Processing Dependency: /usr/bin/python2.6 for package: ansible-2.4.2.0-1.el6.noarch
--> Processing Dependency: PyYAML for package: ansible-2.4.2.0-1.el6.noarch
--> Processing Dependency: python-crypto for package: ansible-2.4.2.0-1.el6.noarch
--> Processing Dependency: python-crypto2.6 for package: ansible-2.4.2.0-1.el6.noarch
--> Processing Dependency: python-httplib2 for package: ansible-2.4.2.0-1.el6.noarch
--> Processing Dependency: python-jinja2-26 for package: ansible-2.4.2.0-1.el6.noarch
--> Processing Dependency: python-keyczar for package: ansible-2.4.2.0-1.el6.noarch
--> Processing Dependency: python-paramiko for package: ansible-2.4.2.0-1.el6.noarch
--> Processing Dependency: python-setuptools for package: ansible-2.4.2.0-1.el6.noarch
--> Processing Dependency: python-simplejson for package: ansible-2.4.2.0-1.el6.noarch
--> Processing Dependency: python-six for package: ansible-2.4.2.0-1.el6.noarch
--> Processing Dependency: sshpass for package: ansible-2.4.2.0-1.el6.noarch
--> Running transaction check
---> Package python-crypto2.6.x86_64 0:2.6.1-2.el6 will be installed
--> Processing Dependency: libpython2.6.so.1.0()(64bit) for package: python-crypto2.6-2.6.1-2.el6.x86_64
---> Package python-jinja2-26.noarch 0:2.6-3.el6 will be installed
--> Processing Dependency: python-babel >= 0.8 for package: python-jinja2-26-2.6-3.el6.noarch
--> Processing Dependency: python-markupsafe for package: python-jinja2-26-2.6-3.el6.noarch
---> Package python-keyczar.noarch 0:0.71c-1.el6 will be installed
--> Processing Dependency: python-pyasn1 for package: python-keyczar-0.71c-1.el6.noarch
---> Package python26.x86_64 0:2.6.9-2.88.amzn1 will be installed
---> Package python26-PyYAML.x86_64 0:3.10-3.10.amzn1 will be installed
---> Package python26-crypto.x86_64 0:2.6.1-1.14.amzn1 will be installed
---> Package python26-httplib2.noarch 0:0.7.7-1.5.amzn1 will be installed
---> Package python26-paramiko.noarch 0:1.15.1-1.5.amzn1 will be installed
--> Processing Dependency: python26-ecdsa for package: python26-paramiko-1.15.1-1.5.amzn1.noarch
---> Package python26-setuptools.noarch 0:12.2-1.32.amzn1 will be installed
--> Processing Dependency: python26-backports-ssl_match_hostname for package: python26-setuptools-12.2-1.32.amzn1.noarch
---> Package python26-simplejson.x86_64 0:3.6.5-1.12.amzn1 will be installed
---> Package python26-six.noarch 0:1.8.0-1.23.amzn1 will be installed
---> Package sshpass.x86_64 0:1.06-1.el6 will be installed
--> Running transaction check
---> Package python26-babel.noarch 0:0.9.4-5.1.8.amzn1 will be installed
---> Package python26-backports-ssl_match_hostname.noarch 0:3.4.0.2-1.12.amzn1 will be installed
--> Processing Dependency: python26-backports for package: python26-backports-ssl_match_hostname-3.4.0.2-1.12.amzn1.noarch
---> Package python26-ecdsa.noarch 0:0.11-3.3.amzn1 will be installed
---> Package python26-libs.x86_64 0:2.6.9-2.88.amzn1 will be installed
---> Package python26-markupsafe.x86_64 0:0.11-4.6.amzn1 will be installed
---> Package python26-pyasn1.noarch 0:0.1.7-2.9.amzn1 will be installed
--> Running transaction check
---> Package python26-backports.x86_64 0:1.0-3.14.amzn1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
 Package                                        Arch            Version                        Repository          Size
========================================================================================================================
Installing:
 ansible                                        noarch          2.4.2.0-1.el6                  epel               7.9 M
Installing for dependencies:
 python-crypto2.6                               x86_64          2.6.1-2.el6                    epel               513 k
 python-jinja2-26                               noarch          2.6-3.el6                      epel               527 k
 python-keyczar                                 noarch          0.71c-1.el6                    epel               219 k
 python26                                       x86_64          2.6.9-2.88.amzn1               amzn-main          5.8 M
 python26-PyYAML                                x86_64          3.10-3.10.amzn1                amzn-main          186 k
 python26-babel                                 noarch          0.9.4-5.1.8.amzn1              amzn-main          1.8 M
 python26-backports                             x86_64          1.0-3.14.amzn1                 amzn-main          5.2 k
 python26-backports-ssl_match_hostname          noarch          3.4.0.2-1.12.amzn1             amzn-main           12 k
 python26-crypto                                x86_64          2.6.1-1.14.amzn1               amzn-main          699 k
 python26-ecdsa                                 noarch          0.11-3.3.amzn1                 amzn-main           77 k
 python26-httplib2                              noarch          0.7.7-1.5.amzn1                amzn-main           81 k
 python26-libs                                  x86_64          2.6.9-2.88.amzn1               amzn-main          697 k
 python26-markupsafe                            x86_64          0.11-4.6.amzn1                 amzn-main           27 k
 python26-paramiko                              noarch          1.15.1-1.5.amzn1               amzn-main          1.3 M
 python26-pyasn1                                noarch          0.1.7-2.9.amzn1                amzn-main          112 k
 python26-setuptools                            noarch          12.2-1.32.amzn1                amzn-main          582 k
 python26-simplejson                            x86_64          3.6.5-1.12.amzn1               amzn-main          210 k
 python26-six                                   noarch          1.8.0-1.23.amzn1               amzn-main           31 k
 sshpass                                        x86_64          1.06-1.el6                     epel                20 k

Transaction Summary
========================================================================================================================
Install  1 Package (+19 Dependent packages)

Total download size: 21 M
Installed size: 82 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/2017.03/epel/packages/python-keyczar-0.71c-1.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Public key for python-keyczar-0.71c-1.el6.noarch.rpm is not installed
(1/20): python-keyczar-0.71c-1.el6.noarch.rpm                                                    | 219 kB  00:00:00
(2/20): python-jinja2-26-2.6-3.el6.noarch.rpm                                                    | 527 kB  00:00:00
(3/20): python-crypto2.6-2.6.1-2.el6.x86_64.rpm                                                  | 513 kB  00:00:02
python26-2.6.9-2.88.amzn1.x86_ FAILED                                                 ] 1.5 MB/s | 7.2 MB  00:00:09 ETA
http://packages.eu-west-1.amazonaws.com/2017.03/main/201703c0ffee/x86_64/Packages/python26-2.6.9-2.88.amzn1.x86_64.rpm?instance_id=fail&region=URLError: [Errno 12] Timeout on http://packages.eu-west-1.amazonaws.com/2017.03/main/201703c0ffee/x86_64/Packages/python26-2.6.9-2.88.amzn1.x86_64.rpm?instance_id=fail&region=URLError: (28, 'Resolving timed out after 5516 milliseconds')
Trying other mirror.
python26-PyYAML-3.10-3.10.amzn FAILED                                                 ] 1.5 MB/s | 8.3 MB  00:00:08 ETA
http://packages.eu-west-1.amazonaws.com/2017.03/main/201703c0ffee/x86_64/Packages/python26-PyYAML-3.10-3.10.amzn1.x86_64.rpm?instance_id=fail&region=URLError: [Errno 12] Timeout on http://packages.eu-west-1.amazonaws.com/2017.03/main/201703c0ffee/x86_64/Packages/python26-PyYAML-3.10-3.10.amzn1.x86_64.rpm?instance_id=fail&region=URLError: (28, 'Resolving timed out after 5519 milliseconds')
Trying other mirror.
(4/20): python26-backports-ssl_match_hostname-3.4.0.2-1.12.amzn1.noarch.rpm                      |  12 kB  00:00:01
(5/20): ansible-2.4.2.0-1.el6.noarch.rpm                                                         | 7.9 MB  00:00:06
(6/20): python26-ecdsa-0.11-3.3.amzn1.noarch.rpm                                                 |  77 kB  00:00:00
(7/20): python26-libs-2.6.9-2.88.amzn1.x86_64.rpm                                                | 697 kB  00:00:01
(8/20): python26-markupsafe-0.11-4.6.amzn1.x86_64.rpm                                            |  27 kB  00:00:00
(9/20): python26-babel-0.9.4-5.1.8.amzn1.noarch.rpm                                              | 1.8 MB  00:00:04
(10/20): python26-paramiko-1.15.1-1.5.amzn1.noarch.rpm                                           | 1.3 MB  00:00:00
python26-backports-1.0-3.14.am FAILED                                                 ] 1.2 MB/s |  13 MB  00:00:06 ETA
http://packages.us-west-1.amazonaws.com/2017.03/main/201703c0ffee/x86_64/Packages/python26-backports-1.0-3.14.amzn1.x86_64.rpm?instance_id=fail&region=URLError: [Errno 12] Timeout on http://packages.us-west-1.amazonaws.com/2017.03/main/201703c0ffee/x86_64/Packages/python26-backports-1.0-3.14.amzn1.x86_64.rpm?instance_id=fail&region=URLError: (28, 'Resolving timed out after 5521 milliseconds')
Trying other mirror.
(11/20): python26-pyasn1-0.1.7-2.9.amzn1.noarch.rpm                                              | 112 kB  00:00:01
python26-httplib2-0.7.7-1.5.am FAILED                                                 ] 1.1 MB/s |  14 MB  00:00:06 ETA
http://packages.us-east-1.amazonaws.com/2017.03/main/201703c0ffee/x86_64/Packages/python26-httplib2-0.7.7-1.5.amzn1.noarch.rpm?instance_id=fail&region=URLError: [Errno 12] Timeout on http://packages.us-east-1.amazonaws.com/2017.03/main/201703c0ffee/x86_64/Packages/python26-httplib2-0.7.7-1.5.amzn1.noarch.rpm?instance_id=fail&region=URLError: (28, 'Resolving timed out after 5518 milliseconds')
Trying other mirror.
(12/20): python26-setuptools-12.2-1.32.amzn1.noarch.rpm                                          | 582 kB  00:00:00
(13/20): python26-crypto-2.6.1-1.14.amzn1.x86_64.rpm                                             | 699 kB  00:00:06
(14/20): sshpass-1.06-1.el6.x86_64.rpm                                                           |  20 kB  00:00:00
(15/20): python26-simplejson-3.6.5-1.12.amzn1.x86_64.rpm                                         | 210 kB  00:00:00
(16/20): python26-PyYAML-3.10-3.10.amzn1.x86_64.rpm                                              | 186 kB  00:00:00
(17/20): python26-backports-1.0-3.14.amzn1.x86_64.rpm                                            | 5.2 kB  00:00:00
(18/20): python26-six-1.8.0-1.23.amzn1.noarch.rpm                                                |  31 kB  00:00:00
(19/20): python26-httplib2-0.7.7-1.5.amzn1.noarch.rpm                                            |  81 kB  00:00:00
(20/20): python26-2.6.9-2.88.amzn1.x86_64.rpm                                                    | 5.8 MB  00:00:08
------------------------------------------------------------------------------------------------------------------------
Total                                                                                   989 kB/s |  21 MB  00:00:21
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
 Userid     : "EPEL (6) <epel@fedoraproject.org>"
 Fingerprint: 8c3b e96a f230 9184 da5c 0dae 3b49 df2a 0608 b895
 Package    : epel-release-6-8.9.amzn1.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python26-2.6.9-2.88.amzn1.x86_64                                                                    1/20
  Installing : python26-libs-2.6.9-2.88.amzn1.x86_64                                                               2/20
  Installing : python26-crypto-2.6.1-1.14.amzn1.x86_64                                                             3/20
  Installing : python26-six-1.8.0-1.23.amzn1.noarch                                                                4/20
  Installing : python26-ecdsa-0.11-3.3.amzn1.noarch                                                                5/20
  Installing : python26-paramiko-1.15.1-1.5.amzn1.noarch                                                           6/20
  Installing : python26-simplejson-3.6.5-1.12.amzn1.x86_64                                                         7/20
  Installing : python26-PyYAML-3.10-3.10.amzn1.x86_64                                                              8/20
  Installing : python26-markupsafe-0.11-4.6.amzn1.x86_64                                                           9/20
  Installing : python-crypto2.6-2.6.1-2.el6.x86_64                                                                10/20
  Installing : python26-httplib2-0.7.7-1.5.amzn1.noarch                                                           11/20
  Installing : python26-backports-1.0-3.14.amzn1.x86_64                                                           12/20
  Installing : python26-backports-ssl_match_hostname-3.4.0.2-1.12.amzn1.noarch                                    13/20
  Installing : python26-setuptools-12.2-1.32.amzn1.noarch                                                         14/20
  Installing : python26-babel-0.9.4-5.1.8.amzn1.noarch                                                            15/20
  Installing : python-jinja2-26-2.6-3.el6.noarch                                                                  16/20
  Installing : python26-pyasn1-0.1.7-2.9.amzn1.noarch                                                             17/20
  Installing : python-keyczar-0.71c-1.el6.noarch                                                                  18/20
  Installing : sshpass-1.06-1.el6.x86_64                                                                          19/20
  Installing : ansible-2.4.2.0-1.el6.noarch                                                                       20/20
  Verifying  : python26-paramiko-1.15.1-1.5.amzn1.noarch                                                           1/20
  Verifying  : sshpass-1.06-1.el6.x86_64                                                                           2/20
  Verifying  : python-keyczar-0.71c-1.el6.noarch                                                                   3/20
  Verifying  : python26-ecdsa-0.11-3.3.amzn1.noarch                                                                4/20
  Verifying  : python26-simplejson-3.6.5-1.12.amzn1.x86_64                                                         5/20
  Verifying  : python26-crypto-2.6.1-1.14.amzn1.x86_64                                                             6/20
  Verifying  : python26-PyYAML-3.10-3.10.amzn1.x86_64                                                              7/20
  Verifying  : python26-backports-ssl_match_hostname-3.4.0.2-1.12.amzn1.noarch                                     8/20
  Verifying  : python26-libs-2.6.9-2.88.amzn1.x86_64                                                               9/20
  Verifying  : python26-six-1.8.0-1.23.amzn1.noarch                                                               10/20
  Verifying  : python26-2.6.9-2.88.amzn1.x86_64                                                                   11/20
  Verifying  : python26-markupsafe-0.11-4.6.amzn1.x86_64                                                          12/20
  Verifying  : python26-httplib2-0.7.7-1.5.amzn1.noarch                                                           13/20
  Verifying  : python-crypto2.6-2.6.1-2.el6.x86_64                                                                14/20
  Verifying  : python26-backports-1.0-3.14.amzn1.x86_64                                                           15/20
  Verifying  : python26-pyasn1-0.1.7-2.9.amzn1.noarch                                                             16/20
  Verifying  : ansible-2.4.2.0-1.el6.noarch                                                                       17/20
  Verifying  : python26-babel-0.9.4-5.1.8.amzn1.noarch                                                            18/20
  Verifying  : python-jinja2-26-2.6-3.el6.noarch                                                                  19/20
  Verifying  : python26-setuptools-12.2-1.32.amzn1.noarch                                                         20/20

Installed:
  ansible.noarch 0:2.4.2.0-1.el6

Dependency Installed:
  python-crypto2.6.x86_64 0:2.6.1-2.el6            python-jinja2-26.noarch 0:2.6-3.el6
  python-keyczar.noarch 0:0.71c-1.el6              python26.x86_64 0:2.6.9-2.88.amzn1
  python26-PyYAML.x86_64 0:3.10-3.10.amzn1         python26-babel.noarch 0:0.9.4-5.1.8.amzn1
  python26-backports.x86_64 0:1.0-3.14.amzn1       python26-backports-ssl_match_hostname.noarch 0:3.4.0.2-1.12.amzn1
  python26-crypto.x86_64 0:2.6.1-1.14.amzn1        python26-ecdsa.noarch 0:0.11-3.3.amzn1
  python26-httplib2.noarch 0:0.7.7-1.5.amzn1       python26-libs.x86_64 0:2.6.9-2.88.amzn1
  python26-markupsafe.x86_64 0:0.11-4.6.amzn1      python26-paramiko.noarch 0:1.15.1-1.5.amzn1
  python26-pyasn1.noarch 0:0.1.7-2.9.amzn1         python26-setuptools.noarch 0:12.2-1.32.amzn1
  python26-simplejson.x86_64 0:3.6.5-1.12.amzn1    python26-six.noarch 0:1.8.0-1.23.amzn1
  sshpass.x86_64 0:1.06-1.el6

Complete!
[root@localhost ~]# 

成功!!依存関係のやるヤツも一発で入れてくれてらくちん!

 

結論

yumで入れよう。

Ansible実践ガイド 第2版 (impress top gear)

Ansible実践ガイド 第2版 (impress top gear)

Real Time Web Analytics