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

Allow dry-run with our role #128

Merged
merged 4 commits into from
May 14, 2018
Merged

Allow dry-run with our role #128

merged 4 commits into from
May 14, 2018

Conversation

hush-hush
Copy link
Member

@hush-hush hush-hush commented Apr 25, 2018

  • Fix the role to be compatible with ansible dry-run
  • Fix downgrading from agent 5 to 6 on centos
  • Improve our travis tests

@chaosoldier
Copy link

@hush-hush
Thanks for fixing my issue.
When is this PR merged?

@hush-hush
Copy link
Member Author

@chaosoldier I'm waiting for a review from @olivielpeau. We're currently focusing on releasing the next version of the agent (6.2.0). We will merge and release the ansible role as soon as possible,

@chaosoldier
Copy link

@hush-hush
Thank you for replying.

We will merge and release the ansible role as soon as possible,

I understood!

Copy link
Member

@olivielpeau olivielpeau left a comment

Choose a reason for hiding this comment

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

One general comment: according to https://docs.ansible.com/ansible/devel/user_guide/playbooks_checkmode.html#information-about-check-mode-in-variables, the variable ansible_check_mode is only available on versions >=2.1 of ansible. What happens on earlier versions of ansible?

Other than that and the inline nits, LGTM! The tests are very nice 👌

README.md Outdated
@@ -41,7 +41,7 @@ To install agent5, you need to:
- either set `datadog_agent_version` to an existing agent5 version
(recommended) or leave it empty to always install the latest version (`5.*`).

To downgrade from agent6 to agent5, you need to:
To downgrade from agent6 to agent5, you need to (**on centos this will only work with ansible 2.4+**):
Copy link
Member

Choose a reason for hiding this comment

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

nit: ansible 2.4 and up?

Copy link
Member

Choose a reason for hiding this comment

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

you should also update the description of the datadog_agent_allow_downgrade variable in the Role Variables section of the readme

@@ -1,6 +1,7 @@
---
- name: Install apt-transport-https
apt: name=apt-transport-https state=present
when: not ansible_check_mode
Copy link
Member

Choose a reason for hiding this comment

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

why is this needed? Shouldn't the package be always in the apt repo?

Copy link
Member Author

Choose a reason for hiding this comment

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

if no ansible job using apt was ever run, --check will fail because python-apt is not install.

fatal: [127.0.0.1]: FAILED! => {"changed": false, "msg": "python-apt must be installed to use check mode. If run normally this module can auto-install it."}

Adding the check allow users to check their playbook without installing python-apt.

@@ -18,18 +19,21 @@
with_items:
- "deb http://apt.datadoghq.com/ stable main"
- "deb http://apt.datadoghq.com/ stable 6"
when: not ansible_check_mode
Copy link
Member

Choose a reason for hiding this comment

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

same question


- name: Ensure Datadog repository is up-to-date
apt_repository:
repo: "{{ datadog_apt_repo }}"
state: "{% if datadog_agent5 %}absent{% else %}present{% endif %}"
update_cache: yes
when: not ansible_check_mode
Copy link
Member

Choose a reason for hiding this comment

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

same question

@hush-hush
Copy link
Member Author

@olivielpeau ansible 2.1 entered end of life last year (2017-06-01). I think we can no longer support it ?

- Testing dry-run
- Testing installing agent 5 and 6
- Testing downgrading to agent 5
- Test the role with ansible 2.2 and 2.4
Copy link
Member

@olivielpeau olivielpeau left a comment

Choose a reason for hiding this comment

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

LGTM!

I'm fine with dropping support of <2.1 ansible versions, but let's not forget to update the declared minimum supported version of ansible here: https://github.com/DataDog/ansible-datadog/blob/2.0.3/meta/main.yml#L6 :)

This allow us to use the latest feature from ansible like dry_run (ie: 'ansible_check_mode').
@hush-hush hush-hush merged commit 21189d8 into master May 14, 2018
@hush-hush hush-hush deleted the maxime/fix-dry-run branch May 14, 2018 17:45
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.

None yet

3 participants