Max*_*ock 5 ansible ansible-galaxy
有一个银河角色:git@site.net/ansible-myapp.git
我可以这样安装:
ansible-galaxy install git+git@site.net/ansible-myapp.git
Run Code Online (Sandbox Code Playgroud)
,但它创建了一个名为“ansible-myapp”的角色。
如何安装与 git url 中名称不同的角色?
可以通过requirements.yml来完成:
- src: git@site.net/ansible-myapp.git
scm: git
name: myapp
Run Code Online (Sandbox Code Playgroud)
ansible-galaxy install -r requirements.yml
将以名称“myapp”安装它
但是如何在没有requirements.yml 文件的情况下通过一个命令来完成此操作呢?
通过反复试验,从官方文档中推断出这个实际上未记录的功能(至少我没有找到文档)
在版本后面添加所需的名称。
ansible-galaxy role install git+git@site.net/ansible-myapp.git,master,myapp
Run Code Online (Sandbox Code Playgroud)
myapp
这将安装使用指定版本的角色。对于master
版本,如果这是默认存储库分支,您可以传递一个空版本,该版本将默认为它:
ansible-galaxy role install git+git@site.net/ansible-myapp.git,,myapp
Run Code Online (Sandbox Code Playgroud)
这是用以下方法测试的:
$ ansible-galaxy --version
ansible-galaxy 2.9.10
config file = None
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
executable location = /usr/local/bin/ansible-galaxy
python version = 3.6.9 (default, Apr 18 2020, 01:56:04) [GCC 8.4.0]
Run Code Online (Sandbox Code Playgroud)
role
注意:上面命令行中的TYPE 位置参数是为了区分角色和集合而引入的,role
如果省略则默认为(为了与以前的 ansible Galaxy 版本兼容)
归档时间: |
|
查看次数: |
485 次 |
最近记录: |