Skip to content

Commit

Permalink
AAP-33897 Devtools Add scaffolding collections chapter (#2404)
Browse files Browse the repository at this point in the history
  • Loading branch information
ariordan-redhat committed Dec 17, 2024
1 parent 339c146 commit 4a56bad
Show file tree
Hide file tree
Showing 13 changed files with 308 additions and 1 deletion.
24 changes: 24 additions & 0 deletions downstream/assemblies/devtools/assembly-devtools-ansible-sign.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ifdef::context[:parent-context-of-devtools-ansible-sign: {context}]

:_mod-docs-content-type: ASSEMBLY

ifndef::context[]
[id="devtools-ansible-sign"]
endif::[]
ifdef::context[]
[id="devtools-ansible-sign_{context}"]
endif::[]

= Working with ansible-sign

:context: devtools-ansible-sign

// You must move roles into collections if you want to use them in {PlatformNameShort}.

Working with ansible-sign

// include::devtools/proc-devtools-zzz.adoc[leveloffset=+1]

ifdef::parent-context-of-devtools-ansible-sign[:context: {parent-context-of-devtools-ansible-sign}]
ifndef::parent-context-of-devtools-ansible-sign[:!context:]

24 changes: 24 additions & 0 deletions downstream/assemblies/devtools/assembly-devtools-builder.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ifdef::context[:parent-context-of-devtools-builder: {context}]

:_mod-docs-content-type: ASSEMBLY

ifndef::context[]
[id="devtools-builder"]
endif::[]
ifdef::context[]
[id="devtools-builder_{context}"]
endif::[]

= Working with {Builder}

:context: devtools-builder

// You must move roles into collections if you want to use them in {PlatformNameShort}.

Working with {Builder}

// include::devtools/proc-devtools-zzz.adoc[leveloffset=+1]

ifdef::parent-context-of-devtools-builder[:context: {parent-context-of-devtools-builder}]
ifndef::parent-context-of-devtools-builder[:!context:]

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ifdef::context[:parent-context-of-devtools-create-plugins-collection: {context}]

:_mod-docs-content-type: ASSEMBLY

ifndef::context[]
[id="devtools-create-plugins-collection"]
endif::[]
ifdef::context[]
[id="devtools-create-plugins-collection_{context}"]
endif::[]

= Creating a collection for distributing plug-ins and modules

:context: devtools-create-plugins-collection

// You must move roles into collections if you want to use them in {PlatformNameShort}.

include::devtools/con-devtools-plan-plugins-collection.adoc[leveloffset=+1]
include::devtools/con-devtools-plugins-collection-prerequisites.adoc[leveloffset=+1]

include::devtools/proc-devtools-scaffold-roles-collection.adoc[leveloffset=+1]

ifdef::parent-context-of-devtools-create-plugins-collection[:context: {parent-context-of-devtools-create-plugins-collection}]
ifndef::parent-context-of-devtools-create-plugins-collection[:!context:]

24 changes: 24 additions & 0 deletions downstream/assemblies/devtools/assembly-devtools-lint.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ifdef::context[:parent-context-of-devtools-lint: {context}]

:_mod-docs-content-type: ASSEMBLY

ifndef::context[]
[id="devtools-lint"]
endif::[]
ifdef::context[]
[id="devtools-lint_{context}"]
endif::[]

= Working with ansible-lint

:context: devtools-lint

// You must move roles into collections if you want to use them in {PlatformNameShort}.

Working with ansible-lint

// include::devtools/proc-devtools-zzz.adoc[leveloffset=+1]

ifdef::parent-context-of-devtools-lint[:context: {parent-context-of-devtools-lint}]
ifndef::parent-context-of-devtools-lint[:!context:]

24 changes: 24 additions & 0 deletions downstream/assemblies/devtools/assembly-devtools-molecule.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ifdef::context[:parent-context-of-devtools-molecule: {context}]

:_mod-docs-content-type: ASSEMBLY

ifndef::context[]
[id="devtools-molecule"]
endif::[]
ifdef::context[]
[id="devtools-molecule_{context}"]
endif::[]

= Working with Molecule

:context: devtools-molecule

// You must move roles into collections if you want to use them in {PlatformNameShort}.

Working with Molecule

// include::devtools/proc-devtools-zzz.adoc[leveloffset=+1]

ifdef::parent-context-of-devtools-molecule[:context: {parent-context-of-devtools-molecule}]
ifndef::parent-context-of-devtools-molecule[:!context:]

24 changes: 24 additions & 0 deletions downstream/assemblies/devtools/assembly-devtools-navigator.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ifdef::context[:parent-context-of-devtools-navigator: {context}]

:_mod-docs-content-type: ASSEMBLY

ifndef::context[]
[id="devtools-navigator"]
endif::[]
ifdef::context[]
[id="devtools-navigator_{context}"]
endif::[]

= Working with {Navigator}

:context: devtools-navigator

// You must move roles into collections if you want to use them in {PlatformNameShort}.

Working with {Navigator}

// include::devtools/proc-devtools-zzz.adoc[leveloffset=+1]

ifdef::parent-context-of-devtools-navigator[:context: {parent-context-of-devtools-navigator}]
ifndef::parent-context-of-devtools-navigator[:!context:]

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ifdef::context[:parent-context-of-devtools-pytest-ansible: {context}]

:_mod-docs-content-type: ASSEMBLY

ifndef::context[]
[id="devtools-pytest-ansible"]
endif::[]
ifdef::context[]
[id="devtools-pytest-ansible_{context}"]
endif::[]

= Working with pytest-ansible

:context: devtools-pytest-ansible

// You must move roles into collections if you want to use them in {PlatformNameShort}.

Working with pytest-ansible

// include::devtools/proc-devtools-zzz.adoc[leveloffset=+1]

ifdef::parent-context-of-devtools-pytest-ansible[:context: {parent-context-of-devtools-pytest-ansible}]
ifndef::parent-context-of-devtools-pytest-ansible[:!context:]

24 changes: 24 additions & 0 deletions downstream/assemblies/devtools/assembly-devtools-tox-ansible.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ifdef::context[:parent-context-of-devtools-tox-ansible: {context}]

:_mod-docs-content-type: ASSEMBLY

ifndef::context[]
[id="devtools-tox-ansible"]
endif::[]
ifdef::context[]
[id="devtools-tox-ansible_{context}"]
endif::[]

= Working with tox-ansible

:context: devtools-tox-ansible

// You must move roles into collections if you want to use them in {PlatformNameShort}.

Working with tox-ansible

// include::devtools/proc-devtools-zzz.adoc[leveloffset=+1]

ifdef::parent-context-of-devtools-tox-ansible[:context: {parent-context-of-devtools-tox-ansible}]
ifndef::parent-context-of-devtools-tox-ansible[:!context:]

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:_mod-docs-content-type: CONCEPT

[id="plan-plugins-collection_{context}"]
= Planning your collection of plugins and modules

// Organize smaller bundles of curated automation into separate collections for specific functions, rather than creating one big general collection for all of your roles.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
:_mod-docs-content-type: CONCEPT

[id="devtools-plugins-collection-prerequisites_{context}"]
= Prerequisites

* You have installed {VSCode} and the Ansible extension.
* You have installed the Microsoft Dev Containers extension in {VSCode}.
* You have installed {ToolsName}.
* You have installed a containerization platform, for example Podman, Podman Desktop, Docker, or Docker Desktop.
* You have a Red Hat account and you can log in to the Red Hat container registry at `registry.redhat.io`.
For information about logging in to `registry.redhat.io`, see
xref:devtools-setup-registry-redhat-io_installing-devtools[Authenticating with the Red Hat container registry].
// * Considerations about environments / isolation (ADE / devcontainer files)


Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
= Prerequisites

* You have installed {VSCode} and the Ansible extension.
* You have installed the Microsoft Dev Containers extension in {{VSCode}.
* You have installed the Microsoft Dev Containers extension in {VSCode}.
* You have installed {ToolsName}.
* You have installed a containerization platform, for example Podman, Podman Desktop, Docker, or Docker Desktop.
* You have a Red Hat account and you can log in to the Red Hat container registry at `registry.redhat.io`.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
:_mod-docs-content-type: PROCEDURE

[id="devtools-scaffold-plugins-collection_{context}"]
= Scaffolding a collection for your plug-ins and modules

You can scaffold a collection for plug-ins and modules from the Ansible extension in {VSCode}.

.Procedure

. Open {VSCode}.
. Navigate to the directory where you want to create your collection.
. Click the Ansible icon in the {VSCode} activity bar to open the Ansible extension.
. Select *Get started* in the *Ansible content creator* section.
+
The *Ansible content creator* tab opens.
. In the *Create* section, click *Ansible collection project*.
+
The *Create new Ansible project* tab opens.
. In the form in the *Create Ansible project* tab, enter the following:
** *Namespace*: Enter a name for your namespace, for example `company_namespace`.
** *Collection*: Enter a name for your collection, for example, `myapp_network`.
** *Init path*: Enter the path to the directory where you want to scaffold your new collection.
+
If you enter an existing directory name, the scaffolding process overwrites the contents of that directory.
The scaffold process only allows you to use an existing directory if you enable the Force option.

*** If you are using the containerized version of Ansible development tools,
the destination directory path is relative to the container, not a path in your local system.
To discover the current directory name in the container, run the pwd command in a terminal in {VSCode}.
If the current directory in the container is `workspaces`, enter `workspaces/<current_project>/collections`.
*** If you are using a locally installed version of Ansible Dev tools,
enter the full path to the directory, for example `/user/<username>/path/to/<collection_directory>`.
. Click btn:[Create].

.Verification

The following message appears in the *Logs* pane of the *Create Ansible collection* tab.
// In this example, the destination directory name is

----
--------------------- ansible-creator logs ---------------------
Note: collection company_namespace.myapp_network created at /path/to/collections/directory
----

The following directories and files are created in your `collections/` directory:

----
├── .devcontainer
├── .github
├── .gitignore
├── .isort.cfg
├── .pre-commit-config.yaml
├── .prettierignore
├── .vscode
├── CHANGELOG.rst
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING
├── LICENSE
├── MAINTAINERS
├── README.md
├── changelogs
├── devfile.yaml
├── docs
├── extensions
├── galaxy.yml
├── meta
├── plugins
├── pyproject.toml
├── requirements.txt
├── roles
├── test-requirements.txt
├── tests
└── tox-ansible.ini
----


14 changes: 14 additions & 0 deletions downstream/titles/develop-automation-content/master.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,18 @@ include::devtools/assembly-publishing-playbook-collection-aap.adoc[leveloffset=+

include::devtools/assembly-devtools-develop-collections.adoc[leveloffset=+1]
include::devtools/assembly-devtools-create-roles-collection.adoc[leveloffset=+1]
include::devtools/assembly-devtools-create-plugins-collection.adoc[leveloffset=+1]

// Components


include::devtools/assembly-devtools-navigator.adoc[leveloffset=+1]
include::devtools/assembly-devtools-builder.adoc[leveloffset=+1]

include::devtools/assembly-devtools-lint.adoc[leveloffset=+1]
include::devtools/assembly-devtools-molecule.adoc[leveloffset=+1]

include::devtools/assembly-devtools-tox-ansible.adoc[leveloffset=+1]
include::devtools/assembly-devtools-pytest-ansible.adoc[leveloffset=+1]
include::devtools/assembly-devtools-ansible-sign.adoc[leveloffset=+1]

0 comments on commit 4a56bad

Please sign in to comment.