Mac OS を利用しており、開発に利用するパッケージなどは(ほぼ全て)パッケージマネージャーで管理しています。
パッケージマネージャーは 3 つ使っており、以下の優先度で管理しています。
(中には対応していないパッケージがあるので、asdf に対応していなければ aqua で管理する…みたいにしてます。)
以前までは Homebrew で管理していた ansible ですが、asdf に対応していることを知ったのでそちらに乗り換えました。
asdf では、ansible-base
という名前で管理されています。
asdf plugin-add ansible-base
asdf install ansible-base latest
asdf global ansible-base latest
インストールされたバージョンは 2.10.17
でした。
❯ ansible --version
ansible 2.10.17
config file = None
configured module search path = ['/Users/yukihisa/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/yukihisa/.asdf/installs/ansible-base/2.10.17/venv/lib/python3.10/site-packages/ansible
executable location = /Users/yukihisa/.asdf/installs/ansible-base/2.10.17/bin/ansible
python version = 3.10.1 (main, Jan 12 2022, 21:01:44) [Clang 13.0.0 (clang-1300.0.29.30)]
利用可能なコマンドを調べたところ、頻繁に使いそうなものは網羅されているようです。(ansible-playbook、ansible-vault、ansible-doc)
❯ ansible # tab 入力
ansible (Define and run a single task 'playbook' against a set of hosts) ansible-doc (Plugin documentation tool) ansible-pull (Pulls playbooks from a VCS repo and executes them for the local host)
ansible-config (View ansible configuration) ansible-galaxy (Perform various Role and Collection related operations) ansible-test (command)
ansible-connection (command) ansible-inventory (None) ansible-vault (Encryption/decryption utility for Ansible data files)
ansible-console (REPL console for executing Ansible tasks) ansible-playbook (Runs Ansible playbooks, executing the defined tasks on the targeted hosts)
ちなみに、asdf では ansible-lint が管理されていないようです。(Homebrew では管理されていて、個人的にコミット前などによく使っていました。)
❯ brew search ansible
==> Formulae
ansible ansible-cmdb ansible-language-server ansible-lint ansible@2.8 ansible@2.9
==> Casks
ansible-dk
ただ、ansible-lint は GitHub Actions などでも公開されていますし、ansible role のテストには Molecule という強力なツールがあるので、Mac にインストールしなくてもいいかと思います。