Posted at

Macに入っていたAnsible 1.9 を 2.3 までアップデートする

More than 1 year has passed since last update.

Macに(多分デフォルトで?)入っていたAnsibleが1.9で古かったので、brewで入れ直して2.3までアップデートします


環境


  • OS X Yosemite 10.10.3

  • homebrew


実行

brewのアップグレードをします

$ brew upgrade

結構時間がかかります。

続いてansibleのバージョンを確認して更新します。

$ ansible-playbook --version

ansible-playbook 1.9.2
configured module search path = None

brewで入れられるansibleのバージョンを確認します。

$ brew info ansible

ansible: stable 2.3.1.0 (bottled), HEAD
Automate deployment, configuration, and upgrading
https://www.ansible.com/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/ansible.rb
==> Dependencies
Build: pkg-config ✔
Required: libyaml ✘, openssl@1.1 ✔
==> Requirements
Required: python ✔

ansibleをインストールします

==> Downloading https://homebrew.bintray.com/bottles/ansible-2.3.1.0.yosemite.bottle.tar.gz

Already downloaded: /Users/yoshiyuki_sakamoto/Library/Caches/Homebrew/ansible-2.3.1.0.yosemite.bottle.tar.gz
==> Pouring ansible-2.3.1.0.yosemite.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/ansible
Target /usr/local/bin/ansible
already exists. You may want to remove it:
rm '/usr/local/bin/ansible'

To force the link and overwrite all conflicting files:
brew link --overwrite ansible

To list all files that would be deleted:
brew link --overwrite --dry-run ansible

Possible conflicting files are:
/usr/local/bin/ansible
/usr/local/bin/ansible-doc
/usr/local/bin/ansible-galaxy
/usr/local/bin/ansible-playbook
/usr/local/bin/ansible-pull
/usr/local/bin/ansible-vault
==> Summary
🍺 /usr/local/Cellar/ansible/2.3.1.0: 11,346 files, 124.4MB

するとすでに /usr/local/bin/ansible とかが存在するのでだめって言われます。こいつらをてきとうにrenameします。

$ cd /usr/local/bin

$ ls -la ansible*
-rwxr-xr-x 1 root admin 7281 8 5 2015 ansible*
-rwxr-xr-x 1 root admin 11071 8 5 2015 ansible-doc*
-rwxr-xr-x 1 root admin 36087 8 5 2015 ansible-galaxy*
-rwxr-xr-x 1 root admin 12976 8 5 2015 ansible-playbook*
-rwxr-xr-x 1 root admin 9863 8 5 2015 ansible-pull*
-rwxr-xr-x 1 root admin 7791 8 5 2015 ansible-vault*

$ mv ansible ansible19
$ mv ansible-doc ansible-doc19
$ mv ansible-galaxy ansible-galaxy19
$ mv ansible-playbook ansible-playbook19
$ mv ansible-pull ansible-pull19
$ mv ansible-vault ansible-vault19

$ ls -la ansible*
-rwxr-xr-x 1 root admin 11071 8 5 2015 ansible-doc19*
-rwxr-xr-x 1 root admin 36087 8 5 2015 ansible-galaxy19*
-rwxr-xr-x 1 root admin 12976 8 5 2015 ansible-playbook19*
-rwxr-xr-x 1 root admin 9863 8 5 2015 ansible-pull19*
-rwxr-xr-x 1 root admin 7791 8 5 2015 ansible-vault19*
-rwxr-xr-x 1 root admin 7281 8 5 2015 ansible19*

ansibleをremoveしてinstallしなおします

$ brew remove ansible

Uninstalling /usr/local/Cellar/ansible/2.3.1.0... (11,346 files, 124.4MB)

$ brew install ansible

バージョンを確認します

$ ansible-playbook --version

ansible-playbook 2.3.1.0
config file =
configured module search path = Default w/o overrides
python version = 2.7.13 (default, Jul 18 2017, 09:16:45) [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]

2.3になりました。