有时无法通过 `ansible-galaxy list` 命令获取版本信息

在使用ansible-galaxy list时获取角色版本信息真是方便呢。

如果使用ansible-galaxy install命令进行安装的话,

{install_date: 'Wed Apr  8 11:05:54 2015', version: 1.0.2}

这个文件能做出来真方便呢。

嗯,但我记得好像有一次它没有显示出来……

所以

验证

角色要求文件

---

- 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安装

$ 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列表。

$ 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在细节方面表现出微妙的多样行为…

广告
将在 10 秒后关闭
bannerAds