标签: ansible-galaxy

在需求中指定版本时,ansible-galaxy安装失败

不确定这是否是一个错误ansible-galaxy,但我正在尝试从requirements.yml文件(相关的ansible文档)安装角色.其中一个角色是从git中提取的,具体version如下:

requirements.yml:

---
- src:  https://github.com/thom-nic/ansible-shell
  name: thom-nic.shell
  version: develop
Run Code Online (Sandbox Code Playgroud)

当我运行时,ansible-galaxy install我得到以下输出:

± ansible-galaxy install -r requirements.yml --force
- executing: git clone https://github.com/thom-nic/ansible-shell thom-nic.shell
- executing: git archive --prefix=thom-nic.shell/ --output=/var/folders/cw/9vh4w77n4vb_bchhsxnglrcm0000gn/T/tmpF4GAqD.tar develop
- command git archive --prefix=thom-nic.shell/ --output=/var/folders/cw/9vh4w77n4vb_bchhsxnglrcm0000gn/T/tmpF4GAqD.tar develop failed
  in directory /var/folders/cw/9vh4w77n4vb_bchhsxnglrcm0000gn/T/tmpIyYaJz
- thom-nic.shell was NOT installed successfully.
Run Code Online (Sandbox Code Playgroud)

如果我改变versionmaster它的工作原理.我已经在git repos中尝试了其他角色,结果相同.

奇怪的是,ansible-galaxy本身似乎没有--version输出,但ansible --version报告v1.8.3.

ansible ansible-galaxy

3
推荐指数
1
解决办法
896
查看次数

是什么定义了Ansible Galaxy角色的版本?

Ansible Galaxy的文档中,我发现您可以安装特定版本的角色.我无法找到角色本身的版本定义.它是Git标签,meta/main.yaml中的一些关键还是其他什么?

version provisioning package ansible ansible-galaxy

3
推荐指数
1
解决办法
381
查看次数

ansible-galaxy 因依赖于空的 meta/main.yml 而失败

我有一个 requests.yml 文件,其中列出了 Ansible 角色的依赖项:

---

- src: git@gitrepo:group/dependency1.git
  scm: git
  name: name1

- src: git@gitrepo:group/dependency1.git
  scm: git
  name: name2
Run Code Online (Sandbox Code Playgroud)

这些角色本身没有任何依赖性,并且由于它们位于私有 SCM 系统上(以及其他原因),因此它们不需要任何元数据。但是,加载 Ansible 依赖项需要此文件存在。因此,依赖项有一个空白的 meta/main.yml 来启用 ansible-galaxy。

安装依赖项时使用:

ansible-galaxy install --role-file requirements.yml --roles-path foo
Run Code Online (Sandbox Code Playgroud)

安装第一个依赖项后,会出现错误:

ERROR! Unexpected Exception: 'NoneType' object has no attribute 'get'
Run Code Online (Sandbox Code Playgroud)

使用非常非常详细的输出,可以找到错误:

galaxy.py", line 394
Run Code Online (Sandbox Code Playgroud)

经过实验后,多次运行该命令将逐步完成依赖项,一次一个。因此,嵌套依赖将会失败;因为父级会安装然后出错,或者 ansible-galaxy 会认为父级已经安装并跳过依赖项。

问题是:如何阻止此错误发生并让 ansible-galaxy 正确处理我的依赖项?

ansible ansible-2.x ansible-galaxy

3
推荐指数
1
解决办法
4992
查看次数

角色和集合的 Ansible 命名规则(破折号、下划线)

Ansible 是否有关于使用-(破折号)和_(下划线)的角色和集合的命名规则?

\n
    \n
  • 我注意到,从 2019 年左右开始,geerlingguy只使用下划线作为角色名称 (snake_case),但他的旧角色名称包含破折号 (kebab-case)。

    \n
  • \n
  • 对于Ansible Galaxy 中的一个角色,我遇到了以下注释:

    \n
    \n

    注意:此角色已从 acme-sh 重命名为 acme_sh 以满足 Ansible Galaxy 要求。

    \n
    \n
  • \n
  • 然后我查看了 Ansible Galaxy 文档,但只找到了命名空间的命名约定(限制),但没有找到角色或集合名称的命名约定(限制)。Ansible Galaxy 文档的创建角色页面上的示例也在名称中使用了破折号:test-role-1

    \n
  • \n
  • 我知道所有 Ansible 内置模块仅使用下划线,因此严格意义上的 Snake_case (据我目前所见)。可能有一些模块允许在 kebab-case 中通过别名参数(例如apt),但很少。

    \n
  • \n
  • 角色名称部分,我在第一个注释中找到了这个提示:

    \n
    \n

    角色名称仅限于小写单词字符(即 az、0-9)和 \xe2\x80\x98_\xe2\x80\x99。

    \n
    \n

    然而,我不清楚这适用于哪些地方或操作,因为 Ansible Galaxy 中有相当多的角色名称中带有破折号,同样是一个ansible-galaxy role init my-super-role …

ansible ansible-galaxy ansible-role ansible-collections

3
推荐指数
1
解决办法
3302
查看次数

ansible 和 ansible-galaxy 有什么区别

只是想了解 ansible 和 ansible-galaxy 之间的核心区别是什么?从文档来看,ansible-galaxy 是管理角色(创建和发布),那么 ansible 的用途是什么?只运行剧本?

我们不能使用 ansible 命令行创建角色吗?

问候,

ansible ansible-galaxy

2
推荐指数
1
解决办法
2550
查看次数

如何使用 brew 在 mac os 上安装 ansible-galaxy?

是否可以在 mac os 上使用 brew 安装 ansible Galaxy?我试过:

$ brew install ansible-galaxy
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 3 taps (homebrew/cask-versions, homebrew/core and homebrew/cask).
==> Updated Formulae
git-lfs ?                cpprestsdk               exercism                 gobject-introspection    kube-aws                 minio-mc                 remarshal                teleport                 vegeta
ammonite-repl            ddgr                     fluent-bit               grpc                     libimagequant            nailgun                  root                     terraform_landscape      xsimd
angular-cli              dscanner                 fmt                      instead                  librealsense             node-build               serverless               tinyxml2                 you-get
arx                      duo_unix                 fruit                    ios-deploy               libsass                  opencv@2                 sfcgal                   tty-solitaire
conan                    elektra                  git-quick-stats          jdupes                   libvirt                  osrm-backend             snappystream             urdfdom_headers
console_bridge           ethereum                 gitbucket                kallisto                 minio                    parallelstl              sysdig                   vagrant-completion

Error: …
Run Code Online (Sandbox Code Playgroud)

homebrew ansible ansible-galaxy

2
推荐指数
1
解决办法
3471
查看次数

ansible-galaxy - 指定要安装的版本范围

我正在尝试安装 Ansible Galaxy 系列,但我需要强制使用较旧的版本。根据文档,我尝试通过以下方式执行安装:

$ ansible-galaxy collection install 'weareinteractive.ufw:>=1.10.0,<2.0.0'
Process install dependency map
ERROR! Failed to find collection weareinteractive.ufw:>=1.10.0,<2.0.0
$ ansible-galaxy collection install 'weareinteractive.ufw:<2.0.0'
Process install dependency map
ERROR! Failed to find collection weareinteractive.ufw:<2.0.0
Run Code Online (Sandbox Code Playgroud)

当我尝试这样做时,我在全球范围内都会遇到同样的错误requirements.yml

---
- name: weareinteractive.ufw
  version: '>=1.8.0,<2.0.0'
Run Code Online (Sandbox Code Playgroud)

运行命令

$ ansible-galaxy install -r requirements.yml
- downloading role 'ufw', owned by weareinteractive
[WARNING]: - weareinteractive.ufw was NOT installed successfully: - the specified version (>=1.8.0,<2.0.0) of weareinteractive.ufw was not found in the list of available …
Run Code Online (Sandbox Code Playgroud)

ansible ansible-galaxy

2
推荐指数
1
解决办法
6547
查看次数

安装 ansible-galaxy azure.azcollection 时出现问题

[root@jenkins-dev playbooks]# ansible-galaxy collection install azure.azcollection 
ERROR! Unexpected Exception, this is probably a bug: cannot import name 'CollectionRequirement' from 'ansible.galaxy.collection' (/usr/local/lib/python3.7/site-packages/ansible/galaxy/collection/__init__.py)
the full traceback was:

Traceback (most recent call last):
  File "/usr/local/bin/ansible-galaxy", line 92, in <module>
    mycli = getattr(__import__("ansible.cli.%s" % sub, fromlist=[myclass]), myclass)
  File "/usr/local/lib/python3.7/site-packages/ansible/cli/galaxy.py", line 24, in <module>
    from ansible.galaxy.collection import (
ImportError: cannot import name 'CollectionRequirement' from 'ansible.galaxy.collection' (/usr/local/lib/python3.7/site-packages/ansible/galaxy/collection/__init__.py)
Run Code Online (Sandbox Code Playgroud)

ansible-galaxy

0
推荐指数
1
解决办法
2183
查看次数