Skip to content

Added docs Inventory Guide. #10239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 48 commits into
base: main
Choose a base branch
from

Conversation

vbotka
Copy link
Contributor

@vbotka vbotka commented Jun 13, 2025

SUMMARY

Add Inventory (Plugin) Guide

Guides
* community.general Filter Guide
* community.general Inventory (Plugin) Guide
* community.general Test (Plugin) Guide
ISSUE TYPE
  • Docs Pull Request
COMPONENT NAME

NA

ADDITIONAL INFORMATION

NA

@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added ci_verified Push fixes to PR branch to re-run CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Jun 13, 2025
@felixfontein felixfontein added the check-before-release PR will be looked at again shortly before release and merged if possible. label Jun 13, 2025
@ansibullbot ansibullbot removed ci_verified Push fixes to PR branch to re-run CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR docs_only labels Jun 13, 2025
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! I've added some first comments below.


See: `Configuring a Shared IP Jail <https://iocage.readthedocs.io/en/latest/networking.html#configuring-a-shared-ip-jail>`_

* If iocage needs environment variable(s), use the option *env*. For example,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope I updated what you wanted.

@ansibullbot ansibullbot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI labels Jun 13, 2025
@russoz
Copy link
Collaborator

russoz commented Jun 15, 2025

I think @felixfontein 's line of thought makes sense, these guides should be put together as iocage guides, instead of using major categories for the types of the plugins. I am not going through the contents of the texts today, but I trust Felix's sharp eyes must have caught all (or most) of necessary adjustments. And if we pick something else later on we can always adjust later on.

@felixfontein
Copy link
Collaborator

I haven't checked all files in detail yet, I mainly skimmed over it and added comments for some things that seemed to happen more than once / I noticed on the first pass. I'll take a closer look later :)

@russoz
Copy link
Collaborator

russoz commented Jun 15, 2025

Okie, I'll do the same - but not today

@felixfontein felixfontein added the backport-11 Automatically create a backport for the stable-10 branch label Jun 16, 2025
Copy link
Collaborator

@russoz russoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couple of comments

Comment on lines 16 to 26
.. code-block:: bash

shell> cat /zroot/iocage/jails/srv_1/root/etc/dhclient-exit-hooks
case "$reason" in
"BOUND"|"REBIND"|"REBOOT"|"RENEW")
echo $new_ip_address > /var/db/dhclient-hook.address.$interface
;;
esac
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other .rst files, to showcase the contents of yaml files, you created two code-blocks, one "console" with the cat command and the other one with the content. Here it is all in one block. I believe both ways to be OK, but whichever one you want to use, apply it consistently to all cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I consistently apply whatever works. The single bash block works fine here. This is not the case with yaml.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely not a generic "Inventory Guide" but rather an "iocage inventory guide". I think it should be named accordingly. Maybe a new section should be opened, like "Technology Guide" or something similar - I don't think it fits well in any of the existing sections.

I've already told you:

This is up to you. I'm only interested in the "inventory iocage" guide. Feel free to place it wherever you'd like.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I consistently apply whatever works. The single bash block works fine here. This is not the case with yaml.

But the two cases are actually just one case, which is showing content of a file with cat. I reckon they should be formatted the same way. IMHO the current disposition is not a good editorial choice.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely not a generic "Inventory Guide" but rather an "iocage inventory guide". I think it should be named accordingly. Maybe a new section should be opened, like "Technology Guide" or something similar - I don't think it fits well in any of the existing sections.

I've already told you:

This is up to you. I'm only interested in the "inventory iocage" guide. Feel free to place it wherever you'd like.

And as I wrote in that comment, the suggested placement is a bit off. That being said, the second half of that comment was intended to be an invitation to a discussion, to you, to @felixfontein and anyone else in the community who might want to chip in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed problematic pygments to console. I won't use ansible-output because the playbook outputs are YAML. Thank you.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, the ansible-output lexer is in https://github.com/ansible-community/ansible-pygments/blob/main/src/ansible_pygments/lexers.py#L44-L214. If someone wants to create a lexer for Ansible output with YAML, that's the place where it belongs to. Not sure how hard that would be though, since handling mixing YAML, regular Ansible output, and diff output isn't trivial...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... the second half of that comment was intended to be an invitation to a discussion

I created this PR. I don't need an invitation.

I did that out of politeness to you and to others, not out of your necessity.

That being said, please create a new section for your guide - I suggested "Technology Guide" but you may prefer something else. Just keep in mind, as mentioned before, that "Inventory Guide" is misleading because this is not about inventories in general, but rather about one single technology that happens to provide an inventory.

And please mark the command line as console and the output as bash for consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... create a lexer for Ansible output with YAML

JSON is a subset of YAML.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but not the other way around :) The advantage of a JSON object or list is that it's clear when it's done (assuming it doesn't have syntax errors). For YAML that's definitely not the case, which makes an Ansible output parser for YAML output harder than for JSON output.

@ansibullbot ansibullbot added stale_ci CI is older than 7 days, rerun before merging and removed stale_ci CI is older than 7 days, rerun before merging labels Jun 22, 2025
Copy link
Collaborator

@russoz russoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional comments and responses.

Comment on lines 16 to 26
.. code-block:: bash

shell> cat /zroot/iocage/jails/srv_1/root/etc/dhclient-exit-hooks
case "$reason" in
"BOUND"|"REBIND"|"REBOOT"|"RENEW")
echo $new_ip_address > /var/db/dhclient-hook.address.$interface
;;
esac
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... the second half of that comment was intended to be an invitation to a discussion

I created this PR. I don't need an invitation.

I did that out of politeness to you and to others, not out of your necessity.

That being said, please create a new section for your guide - I suggested "Technology Guide" but you may prefer something else. Just keep in mind, as mentioned before, that "Inventory Guide" is misleading because this is not about inventories in general, but rather about one single technology that happens to provide an inventory.

And please mark the command line as console and the output as bash for consistency.

@vbotka
Copy link
Contributor Author

vbotka commented Jun 23, 2025

... mark the command line as console and the output as bash

I changed the pygment to sh. Quoting man dhclient-script:

... check for the existence of /etc/dhclient-exit-hooks. If found, it
will be sourced (see sh(1))

@vbotka
Copy link
Contributor Author

vbotka commented Jun 23, 2025

For the record:

The file inventory_guide.rst serves the purpose of inventory_guide_iocage.rst temporary integration. Please remove the BOTMETA entry after you decide where to place it

docs/docsite/rst/inventory_guide.rst: {}

Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't go through everything, but here's a bunch of more comments:

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please delete this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. After the references are clear.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename this file to iocage_inventory_guide.rst, and rename the other files accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dtto

@vbotka
Copy link
Contributor Author

vbotka commented Jun 23, 2025

For the record:

docs/docsite/rst/inventory_guide_iocage_aliases.rst:117:0: (ERROR/3) Unknown interpreted text role "ansvalue".

@felixfontein
Copy link
Collaborator

Yep, sorry, it's :ansval:, not :ansvalue:...

@ansibullbot ansibullbot added the stale_ci CI is older than 7 days, rerun before merging label Jul 2, 2025
@vbotka vbotka force-pushed the docs-guide-inventory branch from a6e0c00 to 1c91a91 Compare July 11, 2025 06:11
@ansibullbot ansibullbot removed the stale_ci CI is older than 7 days, rerun before merging label Jul 11, 2025
@vbotka
Copy link
Contributor Author

vbotka commented Jul 11, 2025

For the record: ... disallowed language 'sh' found.

@vbotka
Copy link
Contributor Author

vbotka commented Jul 11, 2025

For the record:

An AttributeError error occured. This is most probably due to a code block directive (code/code-block/sourcecode) without a specified language. This may result in a false negative for source: '/home/runner/work/community.general/community.general/.nox/docs-check/tmp/tmp7j736yzg/guide_iocage.rst'. The reason can also be another directive. For more information see the FAQ (https://rstcheck-core.rtfd.io/en/latest/faq) or the corresponding github issue: rstcheck/rstcheck-core#3.
770
docs/docsite/rst/guide_iocage.rst:0:0: Unexpected error while parsing document: 'Values' object has no attribute 'env'

There are only two attribute env nobody complained before:

(env) > find docs/docsite/rst -name "iocage_inventory*" | xargs grep ':env'
docs/docsite/rst/iocage_inventory_guide_basics.rst:If iocage needs environment variable(s), use the option :ansopt:`community.general.iocage#inventory:env`. For example,
docs/docsite/rst/iocage_inventory_guide_dhcp.rst:Note: If the option :ansopt:`community.general.iocage#inventory:env` is used and :ansopt:`community.general.iocage#inventory:sudo` is enabled, enable also :ansopt:`community.general.iocage#inventory:sudo_preserve_env`. For example,

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename this and the other iocage_inventory_guide_* files to guide_iocage_inventory_*?

Copy link
Contributor Author

@vbotka vbotka Jul 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. You already asked me to rename them to iocage_inventory_guide_*

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I forgot about that. I think guide_iocage_inventory_* is better than the current name though; I'll create a PR once this is merged.

@felixfontein
Copy link
Collaborator

For the record: ... disallowed language 'sh' found.

The error message should list the allowed languages. Use shell instead of sh.

Comment on lines +13 to +18
PROPERTIES
...
notes="any string"
Custom notes for miscellaneous tagging.
Default: none
Source: local
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be a code block (with language text)?


We will use the format `notes="tag1=value1 tag2=value2 ..."`.

Note: The iocage tags has nothing to do with the :ref:`tags`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Note: The iocage tags has nothing to do with the :ref:`tags`
.. note::
The iocage tags have nothing to do with the :ref:`tags`.

Comment on lines +36 to +40
:ansopt:`community.general.iocage#inventory:get_properties` must be enabled:

.. code-block:: console

shell> cat hosts/02_iocage.yml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:ansopt:`community.general.iocage#inventory:get_properties` must be enabled:
.. code-block:: console
shell> cat hosts/02_iocage.yml
:ansopt:`community.general.iocage#inventory:get_properties` must be enabled.
For example, ``hosts/02_iocage.yml`` could look like:

Comment on lines +59 to +63
Display tags and groups. Create a playbook:

.. code-block:: console

shell> cat pb-test-groups.yml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Display tags and groups. Create a playbook:
.. code-block:: console
shell> cat pb-test-groups.yml
Display tags and groups. Create a playbook ``pb-test-groups.yml``:

@ansibullbot ansibullbot added needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI and removed needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI labels Jul 12, 2025
@ansibullbot ansibullbot added needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Jul 12, 2025
@ansibullbot ansibullbot removed the needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI label Jul 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-11 Automatically create a backport for the stable-10 branch check-before-release PR will be looked at again shortly before release and merged if possible. docs has_issue needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants