-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify role variables by removing one layer (#234)
* simplify role variables by removing one layer previously you could create multiple different objects with the same config: ``` icinga_hostgroups: - hostgroup_object: - "service_abbreviation-environement" - "service_abbreviation-environement-web" state: present ``` However internally I don't see any broad adaption of this and it makes it harder to use (the list after the list next to the key-value pairs is confusing) and it is harder to write and maintain. Compare: ``` - name: icinga_hostgroup icinga_hostgroup: url: "{{ icinga_url }}" @@ -11,15 +9,15 @@ force_basic_auth: "{{ icinga_force_basic_auth | default(omit) }}" client_cert: "{{ icinga_client_cert | default(omit) }}" client_key: "{{ icinga_client_key | default(omit) }}" state: "{{ hostgroup.0.state | default(omit) }}" object_name: "{{ hostgroup.1 }}" display_name: "{{ hostgroup.0.display_name | default(omit) }}" assign_filter: "{{ hostgroup.0.assign_filter | default('host.name=\"' + hostgroup.1 + '-*\"') }}" retries: 3 delay: 3 register: result until: result is succeeded loop: "{{ icinga_hostgroups|subelements('hostgroup_object') }}" loop_control: loop_var: hostgroup tags: hostgroup ``` with: ``` - name: icinga_hostgroup icinga_hostgroup: url: "{{ icinga_url }}" @@ -11,15 +9,15 @@ force_basic_auth: "{{ icinga_force_basic_auth | default(omit) }}" client_cert: "{{ icinga_client_cert | default(omit) }}" client_key: "{{ icinga_client_key | default(omit) }}" state: "{{ hostgroup.state | default(omit) }}" object_name: "{{ hostgroup.name }}" display_name: "{{ hostgroup.display_name | default(omit) }}" assign_filter: "{{ hostgroup.assign_filter | default('host.name=\"' + hostgroup.name + '-*\"') }}" retries: 3 delay: 3 register: result until: result is succeeded loop: "{{ icinga_hostgroups }}" loop_control: loop_var: hostgroup tags: hostgroup ``` Finally it allows us to define a role argument specification. This helps us prevent issues like #34 * add tests for new role * revert tests * roll back automated ansible-lint fixes
- Loading branch information
Showing
25 changed files
with
482 additions
and
368 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.