File tree Expand file tree Collapse file tree 3 files changed +85
-1
lines changed Expand file tree Collapse file tree 3 files changed +85
-1
lines changed Original file line number Diff line number Diff line change 131
131
132
132
- [ 使用 Ansible 专辑] ( usage/collection.md )
133
133
- [ 安装专辑] ( usage/collection/installation.md )
134
+ - [ 移除专辑] ( usage/collection/installation.md#移除某个专辑 )
135
+ - [ 下载专辑] ( usage/collection/downloading.md )
134
136
- [ 验证专辑] ( usage/collection/verifying.md )
135
137
136
138
- [ 使用 Ansible 专辑] ( usage/collections.md )
Original file line number Diff line number Diff line change
1
+ # 下载专辑
2
+
3
+
4
+ 要为离线安装而下载某个专辑及其依赖项,请运行 ` ansible-galaxy collection download ` 命令。这会下载将指定专辑及其依赖项,到指定文件夹,并会创建出一个可用于在无法访问 Galaxy 服务器的主机上,安装这些程序集的 ` requirements.yml ` 文件。默认情况下,所有这些专辑都会下载到 ` ./collections ` 这个文件夹。
5
+
6
+
7
+ 与 ` install ` 命令一样,这些专辑的来源,也是基于 [ 所配置的 Galaxy 服务器配置] ( installation.md##配置-ansible-galaxy-客户端 ) 。即使要下载的专辑是由某个 URL 或到 ` tar ` 包的路径所指定的,该专辑也会从所配置的 Galaxy 服务器重新下载。
8
+
9
+
10
+ 这些专辑可被指定为一或多个专辑,或就像 ` ansible-galaxy collection install ` 命令一样,使用一个 ` requirements.yml ` 文件。
11
+
12
+
13
+ 要下载某单个专辑与其依赖项:
14
+
15
+
16
+ ``` console
17
+ ansible-galaxy collection download my_namespace.my_collection
18
+ ```
19
+
20
+
21
+ 要下载指定版本的某单个专辑:
22
+
23
+
24
+ ``` console
25
+ ansible-galaxy collection download my_namespace.my_collection:1.0.0
26
+ ```
27
+
28
+ 要下载多个专辑,要么如上所示将多个专辑指定为命令行参数,要么以 [ “使用需求文件安装多个专辑”] ( installation.md#使用需求文件安装多个专辑 ) 中所记录的格式,使用一个需求文件。
29
+
30
+
31
+ ``` console
32
+ ansible-galaxy collection download -r requirements.yml
33
+ ```
34
+
35
+ 咱们还可下载某个源代码的专辑目录。该专辑将以必须的 ` galaxy.yml ` 文件构建出来。
36
+
37
+
38
+ ``` console
39
+ ansible-galaxy collection download /path/to/collection
40
+
41
+ ansible-galaxy collection download git+file:///path/to/collection/.git
42
+ ```
43
+
44
+ 通过提供到某单个命名空间的路径,咱们可下载该命名空间中的多个源代码专辑。
45
+
46
+
47
+ ``` console
48
+ ns/
49
+ ├── collection1/
50
+ │ ├── galaxy.yml
51
+ │ └── plugins/
52
+ └── collection2/
53
+ ├── galaxy.yml
54
+ └── plugins/
55
+ ```
56
+
57
+
58
+ ``` console
59
+ ansible-galaxy collection install /path/to/ns
60
+ ```
61
+
62
+ 默认情况下,所有专辑都会被下载到 ` ./collections ` 这个文件夹,但也可以使用 ` -p ` 或 ` --download-path ` 命令行参数,指定其他路径:
63
+
64
+ ``` console
65
+ ansible-galaxy collection download my_namespace.my_collection -p ~/offline-collections
66
+ ```
67
+
68
+ 一旦咱们已下载这些专辑,该文件夹就会包含所指定的专辑、他们的依赖项以及一个 ` requirements.yml ` 文件。咱们可以将此文件夹原封不动地与 ` ansible-galaxy collection install ` 一起使用,在无法访问 Galaxy 服务器的主机上安装这些专辑。
69
+
70
+
71
+ ``` console
72
+ # This must be run from the folder that contains the offline collections and requirements.yml file downloaded
73
+ # by the internet-connected host
74
+ cd ~/offline-collections
75
+ ansible-galaxy collection install -r requirements.yml
76
+ ```
77
+
78
+ (End)
79
+
80
+
Original file line number Diff line number Diff line change @@ -275,7 +275,9 @@ ansible-galaxy install -r requirements.yml
275
275
276
276
咱们可能还需要手动下载全部依赖的专辑。
277
277
278
- > **译注**:这说明 Ansible 还缺少像是 [`pip` 中那样的](https://tips.xfoss.com/49_Python_tips.html#%E5%9C%A8%E5%86%85%E7%BD%91%E5%AE%89%E8%A3%85-python-%E7%AC%AC%E4%B8%89%E6%96%B9%E5%8C%85),下载专辑及其依赖的工具。
278
+ > **译注**:~~这说明 Ansible 还缺少像是 [`pip` 中那样的](https://tips.xfoss.com/49_Python_tips.html#%E5%9C%A8%E5%86%85%E7%BD%91%E5%AE%89%E8%A3%85-python-%E7%AC%AC%E4%B8%89%E6%96%B9%E5%8C%85),下载专辑及其依赖的工具~~。
279
+ >
280
+ > 后面的 [下载专辑](downloading.md) 小节,将专门讲到使用 `ansible-galaxy collection download` 命令,下载专辑及其依赖项。
279
281
280
282
281
283
# # 将专辑安装在 playbook 旁边
You can’t perform that action at this time.
0 commit comments