Ansible の複数バージョンを virtualenv で管理する
- 2019 8/6
Ansible を使い始めて最初にハマったことは、パスワードなしで SSH 接続できるサーバには ansible-playbook コマンドの -k, –ask-pass オプションを付けるとエラーになるということでした。
Ansible 2 系を brew コマンドを使ってサクッと Mac にインストールしました。
$ brew info ansible ansible: stable 2.0.2.0 (bottled), devel 2.0.2.0-0.4.rc4, 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 ✘ ==> Caveats Homebrew writes wrapper scripts that set PYTHONPATH in ansible's execution environment, which is inherited by Python scripts invoked by ansible. If this causes problems, you can modify your playbooks to invoke python with -E, which causes python to ignore PYTHONPATH. |
$ brew install ansible |
$ ansible --version ansible 2.0.2.0 config file = configured module search path = Default w/o overrides |
以上です。