Skip to content

Commit 10741e3

Browse files
AAP-33897 Devtools Add scaffolding collections chapter (#2404)
1 parent 341fa33 commit 10741e3

13 files changed

+308
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
ifdef::context[:parent-context-of-devtools-ansible-sign: {context}]
2+
3+
:_mod-docs-content-type: ASSEMBLY
4+
5+
ifndef::context[]
6+
[id="devtools-ansible-sign"]
7+
endif::[]
8+
ifdef::context[]
9+
[id="devtools-ansible-sign_{context}"]
10+
endif::[]
11+
12+
= Working with ansible-sign
13+
14+
:context: devtools-ansible-sign
15+
16+
// You must move roles into collections if you want to use them in {PlatformNameShort}.
17+
18+
Working with ansible-sign
19+
20+
// include::devtools/proc-devtools-zzz.adoc[leveloffset=+1]
21+
22+
ifdef::parent-context-of-devtools-ansible-sign[:context: {parent-context-of-devtools-ansible-sign}]
23+
ifndef::parent-context-of-devtools-ansible-sign[:!context:]
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
ifdef::context[:parent-context-of-devtools-builder: {context}]
2+
3+
:_mod-docs-content-type: ASSEMBLY
4+
5+
ifndef::context[]
6+
[id="devtools-builder"]
7+
endif::[]
8+
ifdef::context[]
9+
[id="devtools-builder_{context}"]
10+
endif::[]
11+
12+
= Working with {Builder}
13+
14+
:context: devtools-builder
15+
16+
// You must move roles into collections if you want to use them in {PlatformNameShort}.
17+
18+
Working with {Builder}
19+
20+
// include::devtools/proc-devtools-zzz.adoc[leveloffset=+1]
21+
22+
ifdef::parent-context-of-devtools-builder[:context: {parent-context-of-devtools-builder}]
23+
ifndef::parent-context-of-devtools-builder[:!context:]
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
ifdef::context[:parent-context-of-devtools-create-plugins-collection: {context}]
2+
3+
:_mod-docs-content-type: ASSEMBLY
4+
5+
ifndef::context[]
6+
[id="devtools-create-plugins-collection"]
7+
endif::[]
8+
ifdef::context[]
9+
[id="devtools-create-plugins-collection_{context}"]
10+
endif::[]
11+
12+
= Creating a collection for distributing plug-ins and modules
13+
14+
:context: devtools-create-plugins-collection
15+
16+
// You must move roles into collections if you want to use them in {PlatformNameShort}.
17+
18+
include::devtools/con-devtools-plan-plugins-collection.adoc[leveloffset=+1]
19+
include::devtools/con-devtools-plugins-collection-prerequisites.adoc[leveloffset=+1]
20+
21+
include::devtools/proc-devtools-scaffold-roles-collection.adoc[leveloffset=+1]
22+
23+
ifdef::parent-context-of-devtools-create-plugins-collection[:context: {parent-context-of-devtools-create-plugins-collection}]
24+
ifndef::parent-context-of-devtools-create-plugins-collection[:!context:]
25+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
ifdef::context[:parent-context-of-devtools-lint: {context}]
2+
3+
:_mod-docs-content-type: ASSEMBLY
4+
5+
ifndef::context[]
6+
[id="devtools-lint"]
7+
endif::[]
8+
ifdef::context[]
9+
[id="devtools-lint_{context}"]
10+
endif::[]
11+
12+
= Working with ansible-lint
13+
14+
:context: devtools-lint
15+
16+
// You must move roles into collections if you want to use them in {PlatformNameShort}.
17+
18+
Working with ansible-lint
19+
20+
// include::devtools/proc-devtools-zzz.adoc[leveloffset=+1]
21+
22+
ifdef::parent-context-of-devtools-lint[:context: {parent-context-of-devtools-lint}]
23+
ifndef::parent-context-of-devtools-lint[:!context:]
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
ifdef::context[:parent-context-of-devtools-molecule: {context}]
2+
3+
:_mod-docs-content-type: ASSEMBLY
4+
5+
ifndef::context[]
6+
[id="devtools-molecule"]
7+
endif::[]
8+
ifdef::context[]
9+
[id="devtools-molecule_{context}"]
10+
endif::[]
11+
12+
= Working with Molecule
13+
14+
:context: devtools-molecule
15+
16+
// You must move roles into collections if you want to use them in {PlatformNameShort}.
17+
18+
Working with Molecule
19+
20+
// include::devtools/proc-devtools-zzz.adoc[leveloffset=+1]
21+
22+
ifdef::parent-context-of-devtools-molecule[:context: {parent-context-of-devtools-molecule}]
23+
ifndef::parent-context-of-devtools-molecule[:!context:]
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
ifdef::context[:parent-context-of-devtools-navigator: {context}]
2+
3+
:_mod-docs-content-type: ASSEMBLY
4+
5+
ifndef::context[]
6+
[id="devtools-navigator"]
7+
endif::[]
8+
ifdef::context[]
9+
[id="devtools-navigator_{context}"]
10+
endif::[]
11+
12+
= Working with {Navigator}
13+
14+
:context: devtools-navigator
15+
16+
// You must move roles into collections if you want to use them in {PlatformNameShort}.
17+
18+
Working with {Navigator}
19+
20+
// include::devtools/proc-devtools-zzz.adoc[leveloffset=+1]
21+
22+
ifdef::parent-context-of-devtools-navigator[:context: {parent-context-of-devtools-navigator}]
23+
ifndef::parent-context-of-devtools-navigator[:!context:]
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
ifdef::context[:parent-context-of-devtools-pytest-ansible: {context}]
2+
3+
:_mod-docs-content-type: ASSEMBLY
4+
5+
ifndef::context[]
6+
[id="devtools-pytest-ansible"]
7+
endif::[]
8+
ifdef::context[]
9+
[id="devtools-pytest-ansible_{context}"]
10+
endif::[]
11+
12+
= Working with pytest-ansible
13+
14+
:context: devtools-pytest-ansible
15+
16+
// You must move roles into collections if you want to use them in {PlatformNameShort}.
17+
18+
Working with pytest-ansible
19+
20+
// include::devtools/proc-devtools-zzz.adoc[leveloffset=+1]
21+
22+
ifdef::parent-context-of-devtools-pytest-ansible[:context: {parent-context-of-devtools-pytest-ansible}]
23+
ifndef::parent-context-of-devtools-pytest-ansible[:!context:]
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
ifdef::context[:parent-context-of-devtools-tox-ansible: {context}]
2+
3+
:_mod-docs-content-type: ASSEMBLY
4+
5+
ifndef::context[]
6+
[id="devtools-tox-ansible"]
7+
endif::[]
8+
ifdef::context[]
9+
[id="devtools-tox-ansible_{context}"]
10+
endif::[]
11+
12+
= Working with tox-ansible
13+
14+
:context: devtools-tox-ansible
15+
16+
// You must move roles into collections if you want to use them in {PlatformNameShort}.
17+
18+
Working with tox-ansible
19+
20+
// include::devtools/proc-devtools-zzz.adoc[leveloffset=+1]
21+
22+
ifdef::parent-context-of-devtools-tox-ansible[:context: {parent-context-of-devtools-tox-ansible}]
23+
ifndef::parent-context-of-devtools-tox-ansible[:!context:]
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
:_mod-docs-content-type: CONCEPT
2+
3+
[id="plan-plugins-collection_{context}"]
4+
= Planning your collection of plugins and modules
5+
6+
// Organize smaller bundles of curated automation into separate collections for specific functions, rather than creating one big general collection for all of your roles.
7+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
:_mod-docs-content-type: CONCEPT
2+
3+
[id="devtools-plugins-collection-prerequisites_{context}"]
4+
= Prerequisites
5+
6+
* You have installed {VSCode} and the Ansible extension.
7+
* You have installed the Microsoft Dev Containers extension in {VSCode}.
8+
* You have installed {ToolsName}.
9+
* You have installed a containerization platform, for example Podman, Podman Desktop, Docker, or Docker Desktop.
10+
* You have a Red Hat account and you can log in to the Red Hat container registry at `registry.redhat.io`.
11+
For information about logging in to `registry.redhat.io`, see
12+
xref:devtools-setup-registry-redhat-io_installing-devtools[Authenticating with the Red Hat container registry].
13+
// * Considerations about environments / isolation (ADE / devcontainer files)
14+
15+

downstream/modules/devtools/con-devtools-roles-collection-prerequisites.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
= Prerequisites
55

66
* You have installed {VSCode} and the Ansible extension.
7-
* You have installed the Microsoft Dev Containers extension in {{VSCode}.
7+
* You have installed the Microsoft Dev Containers extension in {VSCode}.
88
* You have installed {ToolsName}.
99
* You have installed a containerization platform, for example Podman, Podman Desktop, Docker, or Docker Desktop.
1010
* You have a Red Hat account and you can log in to the Red Hat container registry at `registry.redhat.io`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
:_mod-docs-content-type: PROCEDURE
2+
3+
[id="devtools-scaffold-plugins-collection_{context}"]
4+
= Scaffolding a collection for your plug-ins and modules
5+
6+
You can scaffold a collection for plug-ins and modules from the Ansible extension in {VSCode}.
7+
8+
.Procedure
9+
10+
. Open {VSCode}.
11+
. Navigate to the directory where you want to create your collection.
12+
. Click the Ansible icon in the {VSCode} activity bar to open the Ansible extension.
13+
. Select *Get started* in the *Ansible content creator* section.
14+
+
15+
The *Ansible content creator* tab opens.
16+
. In the *Create* section, click *Ansible collection project*.
17+
+
18+
The *Create new Ansible project* tab opens.
19+
. In the form in the *Create Ansible project* tab, enter the following:
20+
** *Namespace*: Enter a name for your namespace, for example `company_namespace`.
21+
** *Collection*: Enter a name for your collection, for example, `myapp_network`.
22+
** *Init path*: Enter the path to the directory where you want to scaffold your new collection.
23+
+
24+
If you enter an existing directory name, the scaffolding process overwrites the contents of that directory.
25+
The scaffold process only allows you to use an existing directory if you enable the Force option.
26+
27+
*** If you are using the containerized version of Ansible development tools,
28+
the destination directory path is relative to the container, not a path in your local system.
29+
To discover the current directory name in the container, run the pwd command in a terminal in {VSCode}.
30+
If the current directory in the container is `workspaces`, enter `workspaces/<current_project>/collections`.
31+
*** If you are using a locally installed version of Ansible Dev tools,
32+
enter the full path to the directory, for example `/user/<username>/path/to/<collection_directory>`.
33+
. Click btn:[Create].
34+
35+
.Verification
36+
37+
The following message appears in the *Logs* pane of the *Create Ansible collection* tab.
38+
// In this example, the destination directory name is
39+
40+
----
41+
--------------------- ansible-creator logs ---------------------
42+
43+
Note: collection company_namespace.myapp_network created at /path/to/collections/directory
44+
----
45+
46+
The following directories and files are created in your `collections/` directory:
47+
48+
----
49+
├── .devcontainer
50+
├── .github
51+
├── .gitignore
52+
├── .isort.cfg
53+
├── .pre-commit-config.yaml
54+
├── .prettierignore
55+
├── .vscode
56+
├── CHANGELOG.rst
57+
├── CODE_OF_CONDUCT.md
58+
├── CONTRIBUTING
59+
├── LICENSE
60+
├── MAINTAINERS
61+
├── README.md
62+
├── changelogs
63+
├── devfile.yaml
64+
├── docs
65+
├── extensions
66+
├── galaxy.yml
67+
├── meta
68+
├── plugins
69+
├── pyproject.toml
70+
├── requirements.txt
71+
├── roles
72+
├── test-requirements.txt
73+
├── tests
74+
└── tox-ansible.ini
75+
76+
----
77+
78+

downstream/titles/develop-automation-content/master.adoc

+14
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,18 @@ include::devtools/assembly-publishing-playbook-collection-aap.adoc[leveloffset=+
2929

3030
include::devtools/assembly-devtools-develop-collections.adoc[leveloffset=+1]
3131
include::devtools/assembly-devtools-create-roles-collection.adoc[leveloffset=+1]
32+
include::devtools/assembly-devtools-create-plugins-collection.adoc[leveloffset=+1]
33+
34+
// Components
35+
36+
37+
include::devtools/assembly-devtools-navigator.adoc[leveloffset=+1]
38+
include::devtools/assembly-devtools-builder.adoc[leveloffset=+1]
39+
40+
include::devtools/assembly-devtools-lint.adoc[leveloffset=+1]
41+
include::devtools/assembly-devtools-molecule.adoc[leveloffset=+1]
42+
43+
include::devtools/assembly-devtools-tox-ansible.adoc[leveloffset=+1]
44+
include::devtools/assembly-devtools-pytest-ansible.adoc[leveloffset=+1]
45+
include::devtools/assembly-devtools-ansible-sign.adoc[leveloffset=+1]
3246

0 commit comments

Comments
 (0)