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

Infra Host and Service Support for Ansible V2 #53

Merged
merged 20 commits into from
Jan 30, 2025

Conversation

unasra
Copy link
Collaborator

@unasra unasra commented Dec 11, 2024

This PR contains :

  • Support for Infra Host.
  • Support for Infra Service.
  • Support for Retry and Timeout for Host Info
  • Support for Wait For State and Timeout for Service
  • Gitignore update to ignore dest files generated from Anstibull docs

Comment on lines 3 to 6
#TODO: add tests
# The following require additional plugins to be supported.
# - internal_secondaries
# - nsgs
Copy link
Collaborator

Choose a reason for hiding this comment

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

incorrect comment?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

pass # Handled by BloxoneAnsibleModule


class HostsModule(BloxoneAnsibleModule):
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: should be HostModule? Also, i am thinking if it should be InfraHostModule, since we also have dns host, dhcp host, etc.

Suggested change
class HostsModule(BloxoneAnsibleModule):
class HostModule(BloxoneAnsibleModule):

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

tags: run
# Create an Ip Space
- name: "Create an IP space"
tags: run
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is this tag required?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

used for testing , now removed.

csp_url: "{{ csp_url }}"
api_key: "{{ api_key }}"
block:
# Create a random View name to avoid conflicts
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
# Create a random View name to avoid conflicts
# Create a random IP Space name to avoid conflicts

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This file is no longer being modified in this PR

@unasra unasra changed the title Infra Host Support for Ansible V2 Infra Host and Service Support for Ansible V2 Jan 20, 2025
filters:
display_name: "{{ display_name }}+incorrect_name"
retry_if_not_found: true
timeout: "15s" # Timeout is set to 15 seconds
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think, ansible has support for timeout, and maybe that can be used as well.

Copy link
Collaborator

@mathewab mathewab Jan 20, 2025

Choose a reason for hiding this comment

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

There is even support for retries and until. Maybe we should use that instead of retry_if_not_found.

https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For Host info , examples for retries and until have been added.

For Service , as discussed , in future we can implement a module particularly for Service's state !

@unasra unasra added the donotmerge Do not Merge this Pull request label Jan 20, 2025
Comment on lines +334 to +336
# If no results, set results to empty list
if not resp.results:
resp.results = []
Copy link
Collaborator

Choose a reason for hiding this comment

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

This check is needed for the other endpoints too? Maybe have this in the generator atleast for new code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For DDI objects , no it's not required as an empty results list is returned when no object is found , hence this issue hasn't come up until now.

Added to the generator

tag_filters:
location: "site-1"

- name: Get Information after Host is ready using retries and timeout
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit:

Suggested change
- name: Get Information after Host is ready using retries and timeout
- name: Get Host Information with retries

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

@mathewab mathewab removed the donotmerge Do not Merge this Pull request label Jan 30, 2025
@mathewab mathewab merged commit ddcd140 into infobloxopen:v2 Jan 30, 2025
16 checks passed
unasra added a commit to unasra/bloxone-ansible that referenced this pull request Feb 4, 2025
* Initial Commit

* added new lines

* Resolved Linter issues

* fixed examples

* added support for infra service

* added examples

* fixed linter errors

* Added Retry and Timeouts to host

* Fixed sanity tests

* Fixed Lint issues

* added wait for state and timeout for service

* Updated descriptions

* modified infra_host

* Updated Descriptions

* Removed wait for state and timeouts from service

* resolved linter issues

* Resolved sanity errors

* Addressed review comments
unasra added a commit to unasra/bloxone-ansible that referenced this pull request Feb 4, 2025
* Initial Commit

* added new lines

* Resolved Linter issues

* fixed examples

* added support for infra service

* added examples

* fixed linter errors

* Added Retry and Timeouts to host

* Fixed sanity tests

* Fixed Lint issues

* added wait for state and timeout for service

* Updated descriptions

* modified infra_host

* Updated Descriptions

* Removed wait for state and timeouts from service

* resolved linter issues

* Resolved sanity errors

* Addressed review comments
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