Skip to content
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

Creates install info file #281

Merged
merged 2 commits into from
May 28, 2020
Merged

Creates install info file #281

merged 2 commits into from
May 28, 2020

Conversation

mx-psi
Copy link
Member

@mx-psi mx-psi commented May 22, 2020

What does this PR do?

Creates install_info file with information about the install method used (overwrites any other existing file).

Additional information

Role versioning is managed by the tags on this repository. Ansible does not provide a straightforward way of accessing that information (I requested the feature on ansible/ansible#69600).

This PR hardcodes the role version on to a variable (role_version) which would need to be updated on each new release. I think this is the most desirable option but two alternatives I considered are described below.

Alternative 1

We could run ansible-galaxy info [role name] --offline, and parse the resulting output, which looks like (abbreviated):

Role: datadog.datadog
        description:
        dependencies: []
        galaxy_info:
                [...]
        install_date: Fri May 22 10:55:03 2020
        installed_version: x.x.x
        path: ('/root/.ansible/roles', '/usr/share/ansible/roles', '/etc/ansible/roles')

this is not valid YAML; we could grep it but I don't think it is a good idea (the format might change).

Alternative 2

The version is stored in a hidden YAML file (see here) so we could retrieve and parse it. It is an internal Ansible file which I don't think we should rely on it.

Describe your test plan

Install this version of the role using

ansible-galaxy install git+https://github.com/DataDog/ansible-datadog.git,mx-psi/ansible-install-info

Run it using the repo's instructions and check that:

  1. the installation succeeded and
  2. the file was created with the correct information.

@mx-psi mx-psi requested a review from a team as a code owner May 22, 2020 11:17
Copy link
Contributor

@KSerrania KSerrania left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@mx-psi mx-psi merged commit 1ca2445 into master May 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants