ansible-galaxy list
でロールのバージョン情報取れるのって便利よね
ansible-galaxy install ...
でインストールすれば、
rolename/meta/.galaxy_install_info
{install_date: 'Wed Apr 8 11:05:54 2015', version: 1.0.2}
ってファイル出来るので便利よね。
あれ、でも表示されないことあった気がするなぁ...
ということで
検証
Role requirements file
requirements.yml
---
- src: geerlingguy.repo-epel
name: installed-via-ansible-galaxy
- src: geerlingguy.repo-epel
version: 1.0.1
name: installed-via-ansible-galaxy-with-specific-version
- src: https://github.com/geerlingguy/ansible-role-repo-epel
name: installed-via-github
- src: https://github.com/geerlingguy/ansible-role-repo-epel
version: 1.0.2
name: installed-via-github-with-specific-version
ansible-galaxy install
$ ansible-galaxy install -r requirements.yml -p test
- downloading role 'repo-epel', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-repo-epel/archive/1.0.2.tar.gz
- extracting installed-via-ansible-galaxy to test/installed-via-ansible-galaxy
- installed-via-ansible-galaxy was installed successfully
- downloading role 'repo-epel', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-repo-epel/archive/1.0.1.tar.gz
- extracting installed-via-ansible-galaxy-with-specific-version to test/installed-via-ansible-galaxy-with-specific-version
- installed-via-ansible-galaxy-with-specific-version was installed successfully
- executing: git clone https://github.com/geerlingguy/ansible-role-repo-epel installed-via-github
- executing: git archive --prefix=installed-via-github/ --output=/tmp/tmpuOK0wX.tar HEAD
- extracting installed-via-github to test/installed-via-github
- installed-via-github was installed successfully
- executing: git clone https://github.com/geerlingguy/ansible-role-repo-epel installed-via-github-with-specific-version
- executing: git archive --prefix=installed-via-github-with-specific-version/ --output=/tmp/tmpsmE7Zt.tar 1.0.2
- extracting installed-via-github-with-specific-version to test/installed-via-github-with-specific-version
- installed-via-github-with-specific-version was installed successfully
ansible-galaxy list
$ ansible-galaxy list -p test | sort
- installed-via-ansible-galaxy, 1.0.2
- installed-via-ansible-galaxy-with-specific-version, 1.0.1
- installed-via-github, (unknown version)
- installed-via-github-with-specific-version, 1.0.2
まとめ
細かいところで微妙な挙動の多いAnsibleです...