|
| 1 | +# 列出专辑 |
| 2 | + |
| 3 | + |
| 4 | +要列出已安装的专辑,请运行 `ansible-galaxy collection list`。这会显示出在所配置的专辑检索路径中,找到的全部已安装集合。他还将显示出那些包含一个 `galaxy.yml` 文件而非 `MANIFEST.json` 文件的,出于开发中的专辑。专辑所处的路径,与版本信息会一并显示出来。若没有可用的版本信息,则会显示一个 `*` 作为版本号。 |
| 5 | + |
| 6 | + |
| 7 | +```console |
| 8 | +$ ansible-galaxy collection list |
| 9 | + |
| 10 | +# /home/hector/.ansible/collections/ansible_collections |
| 11 | +Collection Version |
| 12 | +--------------------- ------- |
| 13 | +ansible.netcommon 7.1.0 |
| 14 | +ansible.posix 2.0.0 |
| 15 | +ansible.utils 5.1.2 |
| 16 | +ansible.windows 2.7.0 |
| 17 | +chocolatey.chocolatey 1.5.3 |
| 18 | +community.general 10.2.0 |
| 19 | +kubernetes.core 5.0.0 |
| 20 | + |
| 21 | + |
| 22 | +# /usr/share/ansible/collections/ansible_collections |
| 23 | +Collection Version |
| 24 | +----------------- ------- |
| 25 | +fortinet.fortios 1.0.6 |
| 26 | +pureport.pureport 0.0.8 |
| 27 | +sensu.sensu_go 1.3.0 |
| 28 | +``` |
| 29 | + |
| 30 | +以 `-vvv` 命令行开关运行,就会显示更多详细信息。咱们可能会在此看到,作为咱们已安装专辑的依赖项,而添加的一些其他专辑。要在咱们的 playbook 中,只使用咱们已直接安装的那些专辑。 |
| 31 | + |
| 32 | + |
| 33 | +要列出某特定专辑,就要将一个有效的完全合格专辑名称 (FQCN),传递给 `ansible-galaxy collection list` 命令。该专辑所有实例都将被列出。 |
| 34 | + |
| 35 | + |
| 36 | +```console |
| 37 | +$ ansible-galaxy collection list fortinet.fortios |
| 38 | + |
| 39 | +# /home/hector/.ansible/collections/ansible_collections |
| 40 | +Collection Version |
| 41 | +---------------- ------- |
| 42 | +fortinet.fortios 2.3.9 |
| 43 | + |
| 44 | +# /usr/share/ansible/collections/ansible_collections |
| 45 | +Collection Version |
| 46 | +---------------- ------- |
| 47 | +fortinet.fortios 1.0.6 |
| 48 | +``` |
| 49 | + |
| 50 | +要检索其他路径的专辑,就使用 `-p` 命令行选项。以 `:` 分隔多个路径,指定出他们。在命令行中指定出的路径列表,将被添加到已配置的专辑检索路径开头。 |
| 51 | + |
| 52 | + |
| 53 | +```console |
| 54 | +> ansible-galaxy collection list -p '/opt/ansible/collections:/etc/ansible/collections' |
| 55 | + |
| 56 | +# /opt/ansible/collections/ansible_collections |
| 57 | +Collection Version |
| 58 | +--------------- ------- |
| 59 | +sandwiches.club 1.7.2 |
| 60 | + |
| 61 | +# /etc/ansible/collections/ansible_collections |
| 62 | +Collection Version |
| 63 | +-------------- ------- |
| 64 | +sandwiches.pbj 1.2.0 |
| 65 | + |
| 66 | +# /home/hector/.ansible/collections/ansible_collections |
| 67 | +Collection Version |
| 68 | +--------------------- ------- |
| 69 | +ansible.netcommon 7.1.0 |
| 70 | +ansible.posix 2.0.0 |
| 71 | +ansible.utils 5.1.2 |
| 72 | +ansible.windows 2.7.0 |
| 73 | +chocolatey.chocolatey 1.5.3 |
| 74 | +community.general 10.2.0 |
| 75 | +fortinet.fortios 2.3.9 |
| 76 | +kubernetes.core 5.0.0 |
| 77 | + |
| 78 | +# /usr/share/ansible/collections/ansible_collections |
| 79 | +Collection Version |
| 80 | +----------------- ------- |
| 81 | +fortinet.fortios 1.0.6 |
| 82 | +pureport.pureport 0.0.8 |
| 83 | +sensu.sensu_go 1.3.0 |
| 84 | +``` |
| 85 | + |
| 86 | +(End) |
| 87 | + |
| 88 | + |
0 commit comments