Skip to content

Commit

Permalink
update linting (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-m-sullivan authored Jun 26, 2024
1 parent 713d91f commit c363a74
Show file tree
Hide file tree
Showing 44 changed files with 167 additions and 167 deletions.
7 changes: 2 additions & 5 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
# exclude_paths:
# - roles/master_role_example/
exclude_paths:
- '.github/'
- 'changelogs/'
- .github/
- changelogs/
parseable: true
use_default_rules: true
# https://github.com/ansible/ansible-lint/issues/808
# with verbosity set to 1, its dumping 'unknown file type messages'
# verbosity: 1
skip_list:
- meta-runtime
- var-naming[no-role-prefix]
warn_list:
- jinja[invalid] # Temporarily adding this due to https://github.com/ansible/ansible-lint/issues/3048
...
4 changes: 2 additions & 2 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ default: true
# MD003/heading-style/header-style - Heading style
# This will ensure that the heading format is consistent across all markdown files
MD003:
style: "atx"
style: atx

# MD013/line-length - Line length
# Setting to false to match the yamllint setting
Expand All @@ -17,5 +17,5 @@ MD0046:

MD033:
allowed_elements:
- "br"
- br
...
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ repos:
- id: ansible-lint
pass_filenames: false
always_run: true
entry: "ansible-lint"
entry: ansible-lint
args:
- "--profile=production"
- --profile=production
additional_dependencies:
- "ansible-core>=2.13"
- "yamllint>=1.26,<2.0"
- ansible-core>=2.13
- yamllint>=1.26,<2.0
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.13.0
hooks:
Expand Down
12 changes: 10 additions & 2 deletions .yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ extends: default
rules:
# 80 chars should be enough, but don't fail if a line is longer
line-length: disable
braces:
max-spaces-inside: 1
colons: disable
comments:
min-spaces-from-content: 1
comments-indentation: disable
indentation:
level: warning
# Require indentation https://redhat-cop.github.io/automation-good-practices/#_yaml_and_jinja2_syntax
Expand All @@ -13,8 +18,11 @@ rules:
level: error
# Allow only YAML 1.2 booleans https://redhat-cop.github.io/automation-good-practices/#_yaml_and_jinja2_syntax
allowed-values:
- 'true'
- 'false'
- "true"
- "false"
octal-values:
forbid-implicit-octal: true
forbid-explicit-octal: true
# Enabling yamllint check based on PR #35
document-end: enable
...
60 changes: 30 additions & 30 deletions galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,40 @@ version: 2.5.1-devel
description: A collection of utility roles for usage with Ansible Automation Platform
readme: README.md
authors:
- Adebisi Oyawale @aoyawale
- Kedar Kulkarni @kedark3
- Tom Page @Tompage1994
- Sean Sullivan @sean-m-sullivan
- Eric Lavarde @ericzolf
- Brant Evans @branic
- Christopher Renwick @crenwick93
- Adebisi Oyawale @aoyawale
- Kedar Kulkarni @kedark3
- Tom Page @Tompage1994
- Sean Sullivan @sean-m-sullivan
- Eric Lavarde @ericzolf
- Brant Evans @branic
- Christopher Renwick @crenwick93
repository: https://github.com/redhat-cop/aap_utilities/
issues: https://github.com/redhat-cop/aap_utilities//issues
build_ignore:
- galaxy.yml.j2
- .github
- .markdownlint.yml
- .ansible-lint
- .yamllint.yml
- .pre-commit-config.yaml
- .gitignore
- .gitattributes
- '*.tar.gz'
- galaxy.yml.j2
- .github
- .markdownlint.yml
- .ansible-lint
- .yamllint.yml
- .pre-commit-config.yaml
- .gitignore
- .gitattributes
- "*.tar.gz"
license:
- GPL-3.0-or-later
- GPL-3.0-or-later
tags:
- ansible_automation_platform
- aap
- aap_utils
- aap_utilities
- collection
- utilities
- utils
- tower
- tower_utilities
- tower_utils
- infrastructure
- ansible_automation_platform
- aap
- aap_utils
- aap_utilities
- collection
- utilities
- utils
- tower
- tower_utilities
- tower_utils
- infrastructure
dependencies:
"ansible.posix": ">=1.0.0"
"kubernetes.core": ">=2.2.0"
ansible.posix: ">=1.0.0"
kubernetes.core: ">=2.2.0"
...
2 changes: 1 addition & 1 deletion meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
requires_ansible: '>=2.17.0'
requires_ansible: ">=2.17.0"
...
2 changes: 1 addition & 1 deletion roles/aap_backup/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
############################################################

# Default backup vars, these are default from installer
aap_backup_dest: '/var/tmp'
aap_backup_dest: /var/tmp
...
4 changes: 2 additions & 2 deletions roles/aap_backup/tasks/backup.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
# Run the Setup to backup AAP
- name: "Run the Ansible AAP Setup Program with backup option"
- name: Run the Ansible AAP Setup Program with backup option
become: true
ansible.builtin.command: ./setup.sh -e 'backup_dest={{ aap_backup_dest | quote }}' -b
args:
chdir: "{{ aap_setup_prep_setup_dir }}"
async: 10000
poll: 20
changed_when: false # these will always run and will always report "changed" otherwise
changed_when: false # these will always run and will always report "changed" otherwise
...
1 change: 0 additions & 1 deletion roles/aap_certs/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,4 @@
- __aap_certs_eda_dir.stat.exists
- aap_certs_eda_ssl_cert is defined or aap_certs_eda_ssl_cert_content is defined
- aap_certs_eda_ssl_key is defined or aap_certs_eda_ssl_key_content is defined

...
1 change: 0 additions & 1 deletion roles/aap_ocp_install/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ galaxy_info:
- ansible

dependencies: []

collections:
- redhat.openshift
- community.okd
Expand Down
4 changes: 2 additions & 2 deletions roles/aap_ocp_install/tasks/finalization.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
- name: "If login succeeded revoke OpenShift API token"
- name: If login succeeded revoke OpenShift API token
when: __aap_ocp_install_auth_results['openshift_auth']['api_key'] is defined and aap_ocp_install_connection['api_key'] is not defined
# Disabling check for FQCN on module names as using either community.okd or redhat.openshift collection is able to be used
openshift_auth: # noqa fqcn[action]
openshift_auth: # noqa fqcn[action]
host: "{{ aap_ocp_install_connection['host'] | mandatory }}"
validate_certs: "{{ aap_ocp_install_connection['validate_certs'] | default(omit) }}"
state: absent
Expand Down
2 changes: 1 addition & 1 deletion roles/aap_ocp_install/tasks/initialization.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Get OpenShift API token
# Disabling check for FQCN on module names as using either community.okd or redhat.openshift collection is able to be used
openshift_auth: # noqa fqcn[action]
openshift_auth: # noqa fqcn[action]
host: "{{ aap_ocp_install_connection['host'] | mandatory }}"
username: "{{ aap_ocp_install_connection['username'] | mandatory }}"
password: "{{ aap_ocp_install_connection['password'] | mandatory }}"
Expand Down
6 changes: 3 additions & 3 deletions roles/aap_ocp_install/tasks/install-controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
namespace: "{{ aap_ocp_install_controller['namespace'] | default(aap_ocp_install_namespace) | mandatory }}"
register: __aap_ocp_install_controller_route_result
until: __aap_ocp_install_controller_route_result['resources']
retries: 60 # Wait for 15 minutes (60*15/60)
retries: 60 # Wait for 15 minutes (60*15/60)
delay: 15

- name: Store automation controller route
Expand All @@ -42,14 +42,14 @@

- name: Ensure automation controller login is available
ansible.builtin.uri:
url: "https://{{ __aap_ocp_install_controller_route }}"
url: https://{{ __aap_ocp_install_controller_route }}
validate_certs: "{{ aap_ocp_install_connection['validate_certs'] | default(omit) }}"
method: GET
status_code:
- 200
register: __aap_ocp_install_controller_available
until: (__aap_ocp_install_controller_available['status'] == 200) and ('migrations_notran' not in __aap_ocp_install_controller_available['url'])
retries: 120 # Wait for 30 minutes (120*15/60)
retries: 120 # Wait for 30 minutes (120*15/60)
delay: 15

- name: Create automation controller console link
Expand Down
6 changes: 3 additions & 3 deletions roles/aap_ocp_install/tasks/install-eda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
namespace: "{{ aap_ocp_install_eda['namespace'] | default(aap_ocp_install_namespace) }}"
register: __aap_ocp_install_eda_route_result
until: __aap_ocp_install_eda_route_result['resources']
retries: 60 # Wait for 15 minutes (60*15/60)
retries: 60 # Wait for 15 minutes (60*15/60)
delay: 15

- name: Store EDA route
Expand All @@ -42,14 +42,14 @@

- name: Ensure EDA login is available
ansible.builtin.uri:
url: "https://{{ __aap_ocp_install_eda_route }}"
url: https://{{ __aap_ocp_install_eda_route }}
validate_certs: "{{ aap_ocp_install_connection['validate_certs'] | default(omit) }}"
method: GET
status_code:
- 200
register: __aap_ocp_install_eda_available
until: __aap_ocp_install_eda_available['status'] == 200
retries: 120 # Wait for 30 minutes (120*15/60)
retries: 120 # Wait for 30 minutes (120*15/60)
delay: 15

- name: Create EDA console link
Expand Down
6 changes: 3 additions & 3 deletions roles/aap_ocp_install/tasks/install-hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
namespace: "{{ aap_ocp_install_namespace | mandatory }}"
register: __aap_ocp_install_hub_route_result
until: __aap_ocp_install_hub_route_result['resources']
retries: 60 # Wait for 15 minutes (60*15/60)
retries: 60 # Wait for 15 minutes (60*15/60)
delay: 15

- name: Store automation hub route
Expand All @@ -28,14 +28,14 @@

- name: Ensure automation hub login is available
ansible.builtin.uri:
url: "https://{{ __aap_ocp_install_hub_route }}"
url: https://{{ __aap_ocp_install_hub_route }}
validate_certs: "{{ aap_ocp_install_connection['validate_certs'] | default(omit) }}"
method: GET
status_code:
- 200
register: __aap_ocp_install_hub_available
until: __aap_ocp_install_hub_available['status'] == 200
retries: 120 # Wait for 30 minutes (120*15/60)
retries: 120 # Wait for 30 minutes (120*15/60)
delay: 15

- name: Create automation hub console link
Expand Down
2 changes: 1 addition & 1 deletion roles/aap_ocp_install/tasks/install-operator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
api_version: operators.coreos.com/v1alpha1
namespace: "{{ aap_ocp_install_namespace | mandatory }}"
register: __aap_ocp_install_sub_result
until: "(__aap_ocp_install_sub_result['resources'][0]['status']['state'] is defined) and (__aap_ocp_install_sub_result['resources'][0]['status']['state'] == 'AtLatestKnown')"
until: (__aap_ocp_install_sub_result['resources'][0]['status']['state'] is defined) and (__aap_ocp_install_sub_result['resources'][0]['status']['state'] == 'AtLatestKnown')
retries: 24
delay: 10

Expand Down
5 changes: 1 addition & 4 deletions roles/aap_ocp_install/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
tags:
- always

- name: "Openshift deployment tasks"
- name: Openshift deployment tasks
block:

- name: Include OpenShift initialization tasks
ansible.builtin.include_tasks:
file: initialization.yml
Expand Down Expand Up @@ -61,7 +60,6 @@
- eda

always:

- name: Include OpenShift finalization tasks
ansible.builtin.include_tasks:
file: finalization.yml
Expand All @@ -70,5 +68,4 @@
- always
tags:
- always

...
9 changes: 6 additions & 3 deletions roles/aap_ocp_install/tasks/pre-validate-controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
- name: Update validation errors fact - namespace
ansible.builtin.set_fact:
__aap_ocp_install_prevalidate_errors: >
{{ __aap_ocp_install_prevalidate_errors + ["aap_ocp_install_controller['namespace'] must be a lowercase RFC 1123 label consisting of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc'"] }}
{{ __aap_ocp_install_prevalidate_errors + ["aap_ocp_install_controller['namespace'] must be a lowercase RFC 1123 label consisting of lower case alphanumeric
characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc'"] }}
- name: Ensure controller link text variable is set (block)
when: aap_ocp_install_controller['link_text'] is defined
Expand Down Expand Up @@ -130,12 +131,14 @@
- name: Ensure controller projects storage size is valid
ansible.builtin.assert:
that:
- (aap_ocp_install_controller['projects_storage_size'] | regex_replace('^(?P<size>[0-9]+)(?P<si>Ki|K|Mi|M|Gi|G|Ti|T|Pi|P|Ei|E)$', '\\g<size>') | int) > 0
- (aap_ocp_install_controller['projects_storage_size'] | regex_replace('^(?P<size>[0-9]+)(?P<si>Ki|K|Mi|M|Gi|G|Ti|T|Pi|P|Ei|E)$', '\\g<size>') | int) >
0
- (aap_ocp_install_controller['projects_storage_size'] | regex_replace('^(?P<size>[0-9]+)(?P<si>Ki|K|Mi|M|Gi|G|Ti|T|Pi|P|Ei|E)$', '\\g<si>')) is in ['Ki','K','Mi','M','Gi','G','Ti','T','Pi','P','Ei','E']
quiet: true
rescue:
- name: Update validation errors fact - projects_storage_size replicas
ansible.builtin.set_fact:
__aap_ocp_install_prevalidate_errors: >
{{ __aap_ocp_install_prevalidate_errors + ["aap_ocp_install_controller['projects_storage_size'] must be a number greater than 0 with a size (e.g. 12Gi or 10000M)"] }}
{{ __aap_ocp_install_prevalidate_errors + ["aap_ocp_install_controller['projects_storage_size'] must be a number greater than 0 with a size (e.g. 12Gi or
10000M)"] }}
...
3 changes: 2 additions & 1 deletion roles/aap_ocp_install/tasks/pre-validate-eda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
- name: Update validation errors fact - namespace
ansible.builtin.set_fact:
__aap_ocp_install_prevalidate_errors: >
{{ __aap_ocp_install_prevalidate_errors + ["aap_ocp_install_eda['namespace'] must be a lowercase RFC 1123 label consisting of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc'"] }}
{{ __aap_ocp_install_prevalidate_errors + ["aap_ocp_install_eda['namespace'] must be a lowercase RFC 1123 label consisting of lower case alphanumeric characters
or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc'"] }}
- name: Ensure EDA link text variable is set (block)
when: aap_ocp_install_eda['link_text'] is defined
Expand Down
6 changes: 4 additions & 2 deletions roles/aap_ocp_install/tasks/pre-validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
- name: Update validation errors fact - username
ansible.builtin.set_fact:
__aap_ocp_install_prevalidate_errors: >
{{ __aap_ocp_install_prevalidate_errors + ["aap_ocp_install_connection['username'] or aap_ocp_install_connection['password'] must not be set when aap_ocp_install_connection['api_key'] is set"] }}
{{ __aap_ocp_install_prevalidate_errors + ["aap_ocp_install_connection['username'] or aap_ocp_install_connection['password'] must not be set when aap_ocp_install_connection['api_key']
is set"] }}
- name: Ensure OpenShift API token variable is set (block)
when: aap_ocp_install_connection['api_key'] is defined
Expand Down Expand Up @@ -84,7 +85,8 @@
- name: Update validation errors fact - namespace
ansible.builtin.set_fact:
__aap_ocp_install_prevalidate_errors: >
{{ __aap_ocp_install_prevalidate_errors + ["aap_ocp_install_namespace must be a lowercase RFC 1123 label consisting of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc'"] }}
{{ __aap_ocp_install_prevalidate_errors + ["aap_ocp_install_namespace must be a lowercase RFC 1123 label consisting of lower case alphanumeric characters
or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc'"] }}
- name: Ensure operator variables are set
ansible.builtin.include_tasks:
Expand Down
1 change: 0 additions & 1 deletion roles/aap_remove/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@

aap_remove_controller: false
aap_remove_ah: false

...
2 changes: 1 addition & 1 deletion roles/aap_restore/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
############################################################

# Restore location for AAP restore
aap_restore_file: "automation-platform-backup-latest.tar.gz"
aap_restore_file: automation-platform-backup-latest.tar.gz
aap_restore_location: "{{ aap_setup_working_dir }}/{{ aap_restore_file }}"
...
Loading

0 comments on commit c363a74

Please sign in to comment.