親バカエンジニアのナレッジ帳

webのエンジニアをやっており、日頃の開発で詰まったことや書き残しておきたいことを載せています。

HomebrewでMacにAnsibleをインストール


構成管理ツールといえば、ChefやAnsibleなど色々ありますが、今回はAnsibleを使ってみた時のメモです。

Homebrewでインストール

Macはyumではなく、Homebrewでインストールを行います。
まずは以下コマンドで、インストールするAnsibleのバージョンを確認しましょう。

brew info ansible

結果は以下のようになり、私の場合は「2.2.1.0」でした。

ansible: stable 2.2.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

続いてインストールです。

brew install ansible

いきなりエラーが!?

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

もうすでにAnsibleあるよって怒られてますね。
入れた覚えは全くないのですが...とりあえず言われた通り消してみます。

rm /usr/local/bin/ansible
brew link --overwrite ansible

再度実行!

brew install ansible

念のためansibleのバーションを確認して、問題なくインストールされていることを確認しましょう。

ansible --version
 
ansible 2.2.1.0
  config file =
  configured module search path = Default w/o overrides

バージョン情報が表示されたのでこれでOKです!


Fire TV Stick

Fire TV Stick

新登場  Fire TV Stick 4K - Alexa対応音声認識リモコン付属

新登場 Fire TV Stick 4K - Alexa対応音声認識リモコン付属

Fire HD 10 タブレット (10インチHDディスプレイ) 64GB

Fire HD 10 タブレット (10インチHDディスプレイ) 64GB