てくなべ (tekunabe)

ansible / network automation / 学習メモ

[ansible] 未リリース状態のコレクションをインストールする

インストール方法

コレクションは各リポジトリで開発が進んでいて、適宜リリースされます。

リリースされたものは ansible-gallaxy collection install コレクション名 でインストールできます。

一方、バグ修正されたり、機能追加されたけどまだリリースされてない状態のものをインストールして試したいときもあります。

そんなときのインストール方法も公式ドキュメントに記載があります。

docs.ansible.com

例えば、azure.azcollection コレクションを管理しているリポジトリ ansible-collections/azuredev ブランチのものをインストールしたい場合は、以下のコマンドです。

ansible-galaxy collection install git+https://github.com/ansible-collections/azure.git,dev

実行例

$ ansible-galaxy collection install git+https://github.com/ansible-collections/azure.git,dev  
Cloning into '/Users/sakana/.ansible/tmp/ansible-local-28835hg8drawd/tmptdx3qd1l/azure36ypna5u'...
remote: Enumerating objects: 5834, done.
remote: Counting objects: 100% (625/625), done.
remote: Compressing objects: 100% (422/422), done.
remote: Total 5834 (delta 364), reused 312 (delta 147), pack-reused 5209
Receiving objects: 100% (5834/5834), 2.76 MiB | 4.73 MiB/s, done.
Resolving deltas: 100% (3832/3832), done.
Already on 'dev'
Your branch is up to date with 'origin/dev'.
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Installing 'azure.azcollection:1.13.0' to '/Users/sakana/.ansible/collections/ansible_collections/azure/azcollection'
Created collection for azure.azcollection:1.13.0 at /Users/sakana/.ansible/collections/ansible_collections/azure/azcollection
azure.azcollection:1.13.0 was installed successfully
$ 

バージョン表記状は 1.13.0 とありますが、中身はそれ以降のものになっています。

リポジトリの調べ方

この方法は、コレクション名ではなくリポジトリ名を知っておく必要があります。

以下の記事を参考にどうぞ。

tekunabe.hatenablog.jp