Skip to content

Commit

Permalink
lint: add yamllint config, update ansible-lint config (#6)
Browse files Browse the repository at this point in the history
* modified:   .ansible-lint
	new file:   .yamllint
	modified:   galaxy.yml
	modified:   meta/runtime.yml
	modified:   playbooks/vars/all.yml
	modified:   roles/applications/meta/main.yml
	modified:   roles/authenticator_maps/meta/main.yml
	modified:   roles/authenticators/meta/main.yml
	modified:   roles/dispatch/meta/main.yml
	modified:   roles/http_ports/meta/main.yml
	modified:   roles/organizations/meta/main.yml
	modified:   roles/role_user_assignments/meta/main.yml
	modified:   roles/routes/meta/main.yml
	modified:   roles/service_clusters/meta/main.yml
	modified:   roles/service_keys/meta/main.yml
	modified:   roles/service_nodes/meta/main.yml
	modified:   roles/services/meta/main.yml
	modified:   roles/settings/meta/main.yml
	modified:   roles/teams/meta/main.yml
	modified:   roles/users/meta/main.yml

* modified:   .ansible-lint
	modified:   .yamllint
	modified:   changelogs/changelog.yml
	modified:   galaxy.yml
	modified:   meta/runtime.yml
	modified:   roles/applications/meta/argument_specs.yml
	modified:   roles/applications/meta/main.yml
	modified:   roles/applications/tasks/main.yml
	modified:   roles/authenticator_maps/defaults/main.yml
	modified:   roles/authenticator_maps/meta/argument_specs.yml
	modified:   roles/authenticator_maps/meta/main.yml
	modified:   roles/authenticator_maps/tasks/main.yml
	modified:   roles/authenticators/defaults/main.yml
	modified:   roles/authenticators/meta/argument_specs.yml
	modified:   roles/authenticators/meta/main.yml
	modified:   roles/authenticators/tasks/main.yml
	modified:   roles/dispatch/meta/argument_specs.yml
	modified:   roles/dispatch/meta/main.yml
	modified:   roles/dispatch/tasks/main.yml
	modified:   roles/http_ports/defaults/main.yml
	modified:   roles/http_ports/meta/main.yml
	modified:   roles/http_ports/tasks/main.yml
	modified:   roles/organizations/defaults/main.yml
	modified:   roles/organizations/meta/argument_specs.yml
	modified:   roles/organizations/meta/main.yml
	modified:   roles/organizations/tasks/main.yml
	modified:   roles/role_user_assignments/defaults/main.yml
	modified:   roles/role_user_assignments/meta/argument_specs.yml
	modified:   roles/role_user_assignments/meta/main.yml
	modified:   roles/role_user_assignments/tasks/main.yml
	modified:   roles/routes/defaults/main.yml
	modified:   roles/routes/meta/argument_specs.yml
	modified:   roles/routes/meta/main.yml
	modified:   roles/routes/tasks/main.yml
	modified:   roles/service_clusters/defaults/main.yml
	modified:   roles/service_clusters/meta/argument_specs.yml
	modified:   roles/service_clusters/meta/main.yml
	modified:   roles/service_clusters/tasks/main.yml
	modified:   roles/service_keys/defaults/main.yml
	modified:   roles/service_keys/meta/argument_specs.yml
	modified:   roles/service_keys/meta/main.yml
	modified:   roles/service_keys/tasks/main.yml
	modified:   roles/service_nodes/defaults/main.yml
	modified:   roles/service_nodes/meta/main.yml
	modified:   roles/service_nodes/tasks/main.yml
	modified:   roles/services/defaults/main.yml
	modified:   roles/services/meta/argument_specs.yml
	modified:   roles/services/meta/main.yml
	modified:   roles/services/tasks/main.yml
	modified:   roles/settings/meta/main.yml
	modified:   roles/teams/defaults/main.yml
	modified:   roles/teams/meta/argument_specs.yml
	modified:   roles/teams/meta/main.yml
	modified:   roles/teams/tasks/main.yml
	modified:   roles/users/defaults/main.yml
	modified:   roles/users/meta/main.yml
	modified:   roles/users/tasks/main.yml
  • Loading branch information
djdanielsson authored Oct 2, 2024
1 parent 895ef3d commit d8c2ea5
Show file tree
Hide file tree
Showing 58 changed files with 292 additions and 290 deletions.
6 changes: 3 additions & 3 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
# exclude_paths:
# - roles/master_role_example/
exclude_paths:
- '.github/'
- 'roles/applications/tests/test.yml'
- .github/
- roles/applications/tests/test.yml
- changelogs/
parseable: true
use_default_rules: true
offline: true
Expand All @@ -25,7 +26,6 @@ mock_modules:
- ansible.platform.role_user_assignment
- ansible.platform.application
- ansible.platform.organization
- ansible.platform.route
- ansible.platform.service
- ansible.platform.authenticator_map
- ansible.platform.service_node
Expand Down
32 changes: 32 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
extends: default

ignore: |
changelogs

rules:
# 80 chars should be enough, but don't fail if a line is longer
line-length: disable
comments:
min-spaces-from-content: 1
comments-indentation: false
braces:
max-spaces-inside: 1
octal-values:
forbid-implicit-octal: true
forbid-explicit-octal: true
colons:
max-spaces-before: 1
max-spaces-after: -1
document-end: { present: true }
indentation:
level: error
# Require indentation https://redhat-cop.github.io/automation-good-practices/#_yaml_and_jinja2_syntax
indent-sequences: true
truthy:
level: error
# Allow only YAML 1.2 booleans https://redhat-cop.github.io/automation-good-practices/#_yaml_and_jinja2_syntax
allowed-values:
- "true"
- "false"
...
1 change: 0 additions & 1 deletion changelogs/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
---
releases: {}
12 changes: 3 additions & 9 deletions galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
### REQUIRED
# The namespace of the collection. This can be a company/brand/organization or product namespace under which all
# content lives. May only contain alphanumeric lowercase characters and underscores. Namespaces cannot start with
Expand Down Expand Up @@ -30,12 +31,11 @@ description: A collection of roles to manage Ansible Automation Platform

# The path to the license file for the collection. This path is relative to the root of the collection. This key is
# mutually exclusive with 'license'
license_file: 'COPYING'
license_file: COPYING

# A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character
# requirements as 'namespace' and 'name'
tags: [infrastructure]

# Collections that this collection requires to be installed for it to be usable. The key of the dict is the
# collection label 'namespace.name'. The value is a version range
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
Expand All @@ -60,10 +60,4 @@ issues: https://github.com/redhat-cop/infra.platform_configuration/issues
# uses 'fnmatch' to match the files or directories. Some directories and files like 'galaxy.yml', '*.pyc', '*.retry',
# and '.git' are always filtered. Mutually exclusive with 'manifest'
build_ignore: []

# A dict controlling use of manifest directives used in building the collection artifact. The key 'directives' is a
# list of MANIFEST.in style
# L(directives,https://packaging.python.org/en/latest/guides/using-manifest-in/#manifest-in-commands). The key
# 'omit_default_directives' is a boolean that controls whether the default directives are used. Mutually exclusive
# with 'build_ignore'
# manifest: null
...
2 changes: 1 addition & 1 deletion meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
requires_ansible: ">=2.16.0"


# Collections must specify a minimum required ansible version to upload
# to galaxy
# requires_ansible: '>=2.9.10'
Expand Down Expand Up @@ -53,3 +52,4 @@ requires_ansible: ">=2.16.0"
# group_name:
# - module1
# - module2
...
2 changes: 2 additions & 0 deletions playbooks/vars/all.yml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
---
platform_configuration_async_dir: null
...
1 change: 0 additions & 1 deletion roles/applications/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ argument_specs:
type: str
description: Desired state of the application.


# Async variables
applications_async_retries:
default: "{{ gateway_configuration_async_retries | default(30) }}"
Expand Down
26 changes: 13 additions & 13 deletions roles/applications/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
---
galaxy_info:
role_name: "applications"
author: "John Westcott IV"
description: "An Ansible Role to create applications in Ansible gateway."
company: "Red Hat"
role_name: applications
author: John Westcott IV
description: An Ansible Role to create applications in Ansible gateway.
company: Red Hat

# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
license: "GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)"
license: GPLv3

min_ansible_version: "2.14"
min_ansible_version: 2.16.0

platforms:
- name: "EL"
- name: EL
versions:
- "all"
- all

galaxy_tags:
- "gateway"
- "aap"
- "configuration"
- "application"
- "applications"
- gateway
- aap
- configuration
- application
- applications

dependencies: []
...
10 changes: 5 additions & 5 deletions roles/applications/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# Create gateway applications
- name: "Managing gateway Applications"
- name: Managing gateway Applications
ansible.platform.application:
name: "{{ __application_item.name | mandatory }}"
new_name: "{{ __application_item.new_name | default(omit, true) }}"
Expand All @@ -25,16 +25,16 @@
gateway_validate_certs: "{{ gateway_validate_certs | default(omit) }}"
loop: "{{ applications if applications is defined else applications_list }}"
loop_control:
loop_var: "__application_item"
loop_var: __application_item
no_log: "{{ applications_secure_logging }}"
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __gateway_applications_job_async
changed_when: not __gateway_applications_job_async.changed
vars:
ansible_async_dir: '{{ platform_configuration_async_dir | default(omit) }}'
ansible_async_dir: "{{ platform_configuration_async_dir | default(omit) }}"

- name: "Applications | Wait for finish the configuration"
- name: Applications | Wait for finish the configuration
ansible.builtin.async_status:
jid: "{{ __gateway_applications_job_async_results_item.ansible_job_id }}"
register: __gateway_applications_job_async_result
Expand All @@ -47,5 +47,5 @@
when: __gateway_applications_job_async_results_item.ansible_job_id is defined
no_log: "{{ applications_secure_logging }}"
vars:
ansible_async_dir: '{{ platform_configuration_async_dir | default(omit) }}'
ansible_async_dir: "{{ platform_configuration_async_dir | default(omit) }}"
...
1 change: 0 additions & 1 deletion roles/authenticator_maps/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

# a list of dictionaries describing the authenticator maps
authenticator_maps_list: []

authenticator_maps_secure_logging: "{{ gateway_configuration_secure_logging | default(false) }}"
authenticator_maps_async_retries: "{{ gateway_configuration_async_retries | default(30) }}"
authenticator_maps_async_delay: "{{ gateway_configuration_async_delay | default(1) }}"
Expand Down
5 changes: 2 additions & 3 deletions roles/authenticator_maps/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ argument_specs:
description: |
What does the map work on, a team, a user flag or is this an allow rule
Defaults to "team" (by API)
choices: ["allow", "is_superuser", "team", "organization", "role"]
choices: [allow, is_superuser, team, organization, role]
team:
type: str
description: |
Expand All @@ -46,8 +46,7 @@ argument_specs:
required if role's content type is either 'organization' or 'team'
role:
type: str
description:
The name of the RBAC Role Definition to be used for this map
description: The name of the RBAC Role Definition to be used for this map
triggers:
type: dict
description: Trigger information for this rule
Expand Down
26 changes: 13 additions & 13 deletions roles/authenticator_maps/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
---
galaxy_info:
role_name: "authenticator_maps"
author: "Martin Slemr"
description: "An Ansible Role to create authenticator maps in automation platform gateway."
company: "Red Hat"
role_name: authenticator_maps
author: Martin Slemr
description: An Ansible Role to create authenticator maps in automation platform gateway.
company: Red Hat

# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
license: "GPLv3"
license: GPLv3

min_ansible_version: "2.14"
min_ansible_version: 2.16.0

platforms:
- name: "EL"
- name: EL
versions:
- "all"
- all

galaxy_tags:
- "gateway"
- "aap"
- "configuration"
- "authenticatormap"
- "authenticatormaps"
- gateway
- aap
- configuration
- authenticatormap
- authenticatormaps

dependencies: []
...
8 changes: 4 additions & 4 deletions roles/authenticator_maps/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: "Authenticator Map | Configuration" # noqa fqcn[action-core]
- name: Authenticator Map | Configuration # noqa fqcn[action-core]
ansible.platform.authenticator_map:
name: "{{ __gateway_authenticator_maps_item.name | mandatory }}"
new_name: "{{ __gateway_authenticator_maps_item.new_name | default(omit) }}"
Expand Down Expand Up @@ -30,9 +30,9 @@
register: __gateway_authenticator_maps_job_async
changed_when: not __gateway_authenticator_maps_job_async.changed
vars:
ansible_async_dir: '{{ platform_configuration_async_dir | default(omit) }}'
ansible_async_dir: "{{ platform_configuration_async_dir | default(omit) }}"

- name: "Authenticator Map | Wait for finish the configuration"
- name: Authenticator Map | Wait for finish the configuration
ansible.builtin.async_status:
jid: "{{ __gateway_authenticator_maps_job_async_results_item.ansible_job_id }}"
register: __gateway_authenticator_maps_job_async_result
Expand All @@ -45,5 +45,5 @@
when: __gateway_authenticator_maps_job_async_results_item.ansible_job_id is defined
no_log: "{{ authenticator_maps_secure_logging }}"
vars:
ansible_async_dir: '{{ platform_configuration_async_dir | default(omit) }}'
ansible_async_dir: "{{ platform_configuration_async_dir | default(omit) }}"
...
1 change: 0 additions & 1 deletion roles/authenticators/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

# a list of dictionaries describing the authenticators
authenticators_list: []

authenticators_secure_logging: "{{ gateway_configuration_secure_logging | default(false) }}"
authenticators_async_retries: "{{ gateway_configuration_async_retries | default(30) }}"
authenticators_async_delay: "{{ gateway_configuration_async_delay | default(1) }}"
Expand Down
5 changes: 1 addition & 4 deletions roles/authenticators/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,13 @@ argument_specs:
description: The type of authentication service this is
order:
type: int
description:
The order in which an authenticator will be tried. This only pertains to username/password authenticators
defaults to 1 (by API)
description: The order in which an authenticator will be tried. This only pertains to username/password authenticators defaults to 1 (by API)
state:
default: "{{ gateway_state | default('present') }}"
required: false
type: str
description: Desired state of the resource.


# Async variables
authenticators_async_retries:
default: "{{ gateway_configuration_async_retries | default(30) }}"
Expand Down
26 changes: 13 additions & 13 deletions roles/authenticators/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
---
galaxy_info:
role_name: "authenticators"
author: "Martin Slemr"
description: "An Ansible Role to create authenticators in Automation Platform Gateway."
company: "Red Hat"
role_name: authenticators
author: Martin Slemr
description: An Ansible Role to create authenticators in Automation Platform Gateway.
company: Red Hat

# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
license: "GPLv3"
license: GPLv3

min_ansible_version: "2.14"
min_ansible_version: 2.16.0

platforms:
- name: "EL"
- name: EL
versions:
- "all"
- all

galaxy_tags:
- "gateway"
- "aap"
- "configuration"
- "authenticator"
- "authenticators"
- gateway
- aap
- configuration
- authenticator
- authenticators

dependencies: []
...
8 changes: 4 additions & 4 deletions roles/authenticators/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: "Authenticators | Configuration" # noqa fqcn[action-core]
- name: Authenticators | Configuration # noqa fqcn[action-core]
ansible.platform.authenticator:
name: "{{ __gateway_authenticators_item.name | mandatory }}"
new_name: "{{ __gateway_authenticators_item.new_name | default(omit) }}"
Expand Down Expand Up @@ -28,9 +28,9 @@
register: __gateway_authenticators_job_async
changed_when: not __gateway_authenticators_job_async.changed
vars:
ansible_async_dir: '{{ platform_configuration_async_dir | default(omit) }}'
ansible_async_dir: "{{ platform_configuration_async_dir | default(omit) }}"

- name: "Authenticators | Wait for finish the configuration"
- name: Authenticators | Wait for finish the configuration
ansible.builtin.async_status:
jid: "{{ __gateway_authenticators_job_async_results_item.ansible_job_id }}"
register: __gateway_authenticators_job_async_result
Expand All @@ -43,5 +43,5 @@
when: __gateway_authenticators_job_async_results_item.ansible_job_id is defined
no_log: "{{ authenticators_secure_logging }}"
vars:
ansible_async_dir: '{{ platform_configuration_async_dir | default(omit) }}'
ansible_async_dir: "{{ platform_configuration_async_dir | default(omit) }}"
...
1 change: 0 additions & 1 deletion roles/dispatch/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ argument_specs:
required: false
description: This variable sets delay between retries across all roles as a default.


# No_log variables
gateway_configuration_secure_logging:
default: false
Expand Down
Loading

0 comments on commit d8c2ea5

Please sign in to comment.