Skip to content

Conversation

@mscherer
Copy link
Contributor

SUMMARY

Add os-release file parsing, partially fix #25897
/etc/os_release is documented on https://www.freedesktop.org/software/systemd/man/os-release.html

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

setup

ANSIBLE VERSION
$ ansible --version
ansible 2.5.0 (add_fact_os_release 1b2081dfbb) last updated 2017/12/12 15:56:51 (GMT +200)
  config file = /home/misc/.ansible.cfg
  configured module search path = [u'/home/misc/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/misc/checkout/git/ansible/lib/ansible
  executable location = /home/misc/checkout/git/ansible/bin/ansible
  python version = 2.7.5 (default, May  3 2017, 07:55:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-14)]

@mscherer
Copy link
Contributor Author

I didn't took a look at testing that yet, but plan to add it to the unit tests.

@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 feature_pull_request needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Dec 12, 2017
@mscherer mscherer force-pushed the add_fact_os_release branch from 1b2081d to d474693 Compare December 12, 2017 15:11
@ansibot ansibot added the test This PR relates to tests. label Dec 12, 2017
@mscherer mscherer force-pushed the add_fact_os_release branch 5 times, most recently from 401b9b0 to 0263852 Compare December 12, 2017 17:31
@ansibot
Copy link
Contributor

ansibot commented Dec 12, 2017

The test ansible-test sanity --test pep8 [?] failed with the following errors:

lib/ansible/module_utils/facts/system/os_release.py:37:19: E231 missing whitespace after ','
lib/ansible/module_utils/facts/system/os_release.py:51:1: W391 blank line at end of file

The test ansible-test sanity --test pylint [?] failed with the following error:

lib/ansible/module_utils/facts/system/os_release.py:51:0: trailing-newlines Trailing newlines

click here for bot help

@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Dec 12, 2017
@mscherer mscherer force-pushed the add_fact_os_release branch from 0263852 to 1a2d90f Compare December 12, 2017 22:18
@ansibot
Copy link
Contributor

ansibot commented Dec 12, 2017

The test ansible-test sanity --test pep8 [?] failed with the following errors:

lib/ansible/module_utils/facts/system/os_release.py:37:19: E231 missing whitespace after ','
lib/ansible/module_utils/facts/system/os_release.py:51:1: W391 blank line at end of file

The test ansible-test sanity --test pylint [?] failed with the following error:

lib/ansible/module_utils/facts/system/os_release.py:51:0: trailing-newlines Trailing newlines

click here for bot help

@mscherer mscherer force-pushed the add_fact_os_release branch 3 times, most recently from f33b63e to de2c4d5 Compare December 13, 2017 10:36
@ansibot ansibot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Dec 13, 2017
@mscherer mscherer force-pushed the add_fact_os_release branch from de2c4d5 to 3ea96d4 Compare December 13, 2017 12:43
@pilou-
Copy link
Contributor

pilou- commented Dec 13, 2017

Although it doesn't count: shipit .

@samdoran samdoran self-assigned this Dec 13, 2017
@gundalow gundalow requested a review from samdoran December 13, 2017 16:20
@gundalow gundalow removed the needs_triage Needs a first human triage before being processed. label Dec 13, 2017
Copy link
Contributor

@alikins alikins left a comment

Choose a reason for hiding this comment

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

I'd like to see the parse function be pulled out of the class. And for it to take a string for input and tests updated to use it.

@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Dec 13, 2017
@alikins
Copy link
Contributor

alikins commented Dec 13, 2017

@mscherer #25725 and #31143 are the issue/pr related to the quoting in /etc/os-release I mentioned

@ansibot ansibot added the stale_review Updates were made after the last review and the last review is more than 7 days old. label Jul 6, 2019
@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. stale_review Updates were made after the last review and the last review is more than 7 days old. labels Mar 3, 2020
@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. stale_review Updates were made after the last review and the last review is more than 7 days old. and removed core_review In order to be merged, this PR must follow the core review workflow. labels Mar 28, 2020
@ansibot ansibot added pre_azp This PR was last tested before migration to Azure Pipelines. and removed stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. stale_review Updates were made after the last review and the last review is more than 7 days old. labels Dec 6, 2020
@samdoran samdoran removed their assignment Jan 7, 2021
@ansibot ansibot added the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Mar 10, 2022
@ansibot ansibot added the stale_review Updates were made after the last review and the last review is more than 7 days old. label Jul 12, 2023
@ansibot ansibot added needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html and removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Oct 24, 2023
@ansibot ansibot added the stale_pr This PR has not been pushed to for more than one year. label Jan 28, 2025
@bcoca bcoca dismissed alikins’s stale review July 3, 2025 15:36

moved on

@ansibot ansibot removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html stale_review Updates were made after the last review and the last review is more than 7 days old. pre_azp This PR was last tested before migration to Azure Pipelines. stale_pr This PR has not been pushed to for more than one year. labels Jul 3, 2025
@bcoca
Copy link
Member

bcoca commented Jul 3, 2025

Sorry we kept you hanging this long.

We are going to close this as os-release parsing was included in the vendored/updated distribution detection and for the few extra fields we don't return a simple custom inventory plugin can now be added to the default gather_facts action to get the same result.

However, we're always up for discussion.

Because this project is very active, we're unlikely to see comments made on closed tickets and we lock them after some time.
If you or anyone else has any further questions, please let us know by using any of the communication methods listed on the page below:

In the future, sometimes starting a discussion on the Ansible Forum before implementing
a feature can make getting things included a little easier, but it's not always necessary.

Thank you once again for this and your interest in Ansible!

@bcoca bcoca closed this Jul 3, 2025
@septatrix
Copy link

We are going to close this as os-release parsing was included in the vendored/updated distribution detection and for the few extra fields we don't return a simple custom inventory plugin can now be added to the default gather_facts action to get the same result.

Is there any documentation/guide on writing custom gather_facts modules?

@bcoca
Copy link
Member

bcoca commented Jul 16, 2025

it is just a facts_module, that you can reference via configuration to have the gather_facts option use automatically.

https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_general.html#creating-an-info-or-a-facts-module

TLDR: retun the info under ansible_facts dictionary.

@sivel sivel removed the needs_verified This issue needs to be verified/reproduced by maintainer label Jul 29, 2025
@ansible ansible locked and limited conversation to collaborators Jul 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

affects_2.5 This issue/PR affects Ansible v2.5 feature This issue/PR relates to a feature request. has_issue needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. P3 Priority 3 - Approved, No Time Limitation support:core This issue/PR relates to code supported by the Ansible Engineering Team. test This PR relates to tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Atomic OS detection in Ansible Facts

10 participants