From 7f24ae43cecbde94d10a91da7107efe0475a3db0 Mon Sep 17 00:00:00 2001 From: Brant Evans Date: Sat, 25 Jun 2022 17:22:02 -0700 Subject: [PATCH] Update ansible-lint version --- .ansible-lint | 4 +--- .pre-commit-config.yaml | 2 +- galaxy.yml.j2 | 3 ++- roles/aap_backup/meta/main.yml | 4 ++-- roles/aap_backup/tasks/backup.yml | 2 +- roles/aap_certs/handlers/main.yml | 2 +- roles/aap_certs/meta/main.yml | 4 ++-- roles/aap_certs/tasks/autohub.yml | 4 ++-- roles/aap_certs/tasks/controller.yml | 4 ++-- roles/aap_remove/meta/main.yml | 4 ++-- roles/aap_remove/tasks/ah_remove.yml | 12 ++++++------ roles/aap_remove/tasks/controller_remove.yml | 12 ++++++------ roles/aap_restore/meta/main.yml | 4 ++-- roles/aap_restore/tasks/restore.yml | 2 +- roles/aap_setup_download/meta/main.yml | 4 ++-- roles/aap_setup_download/tasks/main.yml | 11 ++++++----- roles/aap_setup_install/meta/main.yml | 4 ++-- roles/aap_setup_install/tasks/main.yml | 13 +++++++------ roles/aap_setup_prepare/meta/main.yml | 4 ++-- roles/aap_setup_prepare/tasks/fixes/aap_1413.yml | 2 +- roles/aap_setup_prepare/tasks/main.yml | 10 +++++----- roles/git_ssh_setup/meta/main.yml | 6 +++--- roles/git_ssh_setup/tasks/git_users.yml | 4 ++-- roles/git_ssh_setup/tasks/main.yml | 16 ++++++++-------- roles/kerberos/meta/main.yml | 2 +- roles/kerberos/tasks/main.yml | 12 ++++++------ 26 files changed, 76 insertions(+), 75 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index 4bb2b80..1a8b555 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -9,9 +9,7 @@ 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: - # Temporarily disabling the ignore-errors check to get CI to pass - - ignore-errors +skip_list: [] # Disabled the the below skip_list as they use the old style rule names. # With the move of the .yamllint.yml to TLD ansible-lint now picks up our config so no need to exclude it. # # [E204]: "Lines should be no longer than 160 chars" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c7adc19..d7f82f6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,7 +13,7 @@ repos: # entry: "yamllint" # types: [yaml] - repo: https://github.com/ansible/ansible-lint.git - rev: v5.3.2 + rev: v6.3.0 hooks: # see discussions here about what arguments are used, and behavior # https://github.com/ansible/ansible-lint/issues/649 diff --git a/galaxy.yml.j2 b/galaxy.yml.j2 index b4c4342..b12b2c2 100644 --- a/galaxy.yml.j2 +++ b/galaxy.yml.j2 @@ -33,4 +33,5 @@ tags: - tower - tower_utilities - tower_utils -dependencies: {} +dependencies: + "ansible.posix": ">=1.0.0" diff --git a/roles/aap_backup/meta/main.yml b/roles/aap_backup/meta/main.yml index 46a69a3..c1b4417 100644 --- a/roles/aap_backup/meta/main.yml +++ b/roles/aap_backup/meta/main.yml @@ -6,12 +6,12 @@ galaxy_info: license: MIT - min_ansible_version: 2.12 + min_ansible_version: "2.12" platforms: - name: EL versions: - - 8 + - "8" galaxy_tags: - linux diff --git a/roles/aap_backup/tasks/backup.yml b/roles/aap_backup/tasks/backup.yml index a9117d4..50d80f6 100644 --- a/roles/aap_backup/tasks/backup.yml +++ b/roles/aap_backup/tasks/backup.yml @@ -2,7 +2,7 @@ # Run the Setup to backup tower - name: "[Tower] Run the Ansible Tower Setup Program with backup option" become: true - command: ./setup.sh -e 'backup_dest={{ aap_backup_dest | quote }}' -b + ansible.builtin.command: ./setup.sh -e 'backup_dest={{ aap_backup_dest | quote }}' -b args: chdir: "{{ aap_setup_prep_setup_dir }}" async: 10000 diff --git a/roles/aap_certs/handlers/main.yml b/roles/aap_certs/handlers/main.yml index ecff8fc..d5d2741 100644 --- a/roles/aap_certs/handlers/main.yml +++ b/roles/aap_certs/handlers/main.yml @@ -1,7 +1,7 @@ --- - name: restart Nginx service become: true - service: + ansible.builtin.service: name: nginx state: restarted listen: restart_aap_service diff --git a/roles/aap_certs/meta/main.yml b/roles/aap_certs/meta/main.yml index 254e70b..0dbfb51 100644 --- a/roles/aap_certs/meta/main.yml +++ b/roles/aap_certs/meta/main.yml @@ -6,12 +6,12 @@ galaxy_info: license: MIT - min_ansible_version: 2.12 + min_ansible_version: "2.12" platforms: - name: EL versions: - - 8 + - "8" galaxy_tags: - linux diff --git a/roles/aap_certs/tasks/autohub.yml b/roles/aap_certs/tasks/autohub.yml index dd18906..23a3d4a 100644 --- a/roles/aap_certs/tasks/autohub.yml +++ b/roles/aap_certs/tasks/autohub.yml @@ -3,7 +3,7 @@ # according to https://access.redhat.com/solutions/5731261 - name: autohub | copy cert into place become: true - copy: + ansible.builtin.copy: src: "{{ aap_certs_autohub_ssl_cert | default(omit) }}" content: "{{ aap_certs_autohub_ssl_cert_content | default(omit) }}" dest: "{{ aap_certs_autohub_cert_dest }}" @@ -15,7 +15,7 @@ - name: autohub | copy key into place become: true - copy: + ansible.builtin.copy: src: "{{ aap_certs_autohub_ssl_key | default(omit) }}" content: "{{ aap_certs_autohub_ssl_key_content | default(omit) }}" dest: "{{ aap_certs_autohub_key_dest }}" diff --git a/roles/aap_certs/tasks/controller.yml b/roles/aap_certs/tasks/controller.yml index 2ac5283..290a42d 100644 --- a/roles/aap_certs/tasks/controller.yml +++ b/roles/aap_certs/tasks/controller.yml @@ -2,7 +2,7 @@ # according to https://access.redhat.com/solutions/3109871 - name: controller | copy cert into place become: true - copy: + ansible.builtin.copy: src: "{{ aap_certs_controller_ssl_cert | default(omit) }}" content: "{{ aap_certs_controller_ssl_cert_content | default(omit) }}" dest: "{{ aap_certs_controller_cert_dest }}" @@ -14,7 +14,7 @@ - name: controller | copy key into place become: true - copy: + ansible.builtin.copy: src: "{{ aap_certs_controller_ssl_key | default(omit) }}" content: "{{ aap_certs_controller_ssl_key_content | default(omit) }}" dest: "{{ aap_certs_controller_key_dest }}" diff --git a/roles/aap_remove/meta/main.yml b/roles/aap_remove/meta/main.yml index 1c821df..91cc9cc 100644 --- a/roles/aap_remove/meta/main.yml +++ b/roles/aap_remove/meta/main.yml @@ -6,12 +6,12 @@ galaxy_info: license: MIT - min_ansible_version: 2.12 + min_ansible_version: "2.12" platforms: - name: EL versions: - - 8 + - "8" galaxy_tags: - linux diff --git a/roles/aap_remove/tasks/ah_remove.yml b/roles/aap_remove/tasks/ah_remove.yml index 1e81e1f..ad07689 100644 --- a/roles/aap_remove/tasks/ah_remove.yml +++ b/roles/aap_remove/tasks/ah_remove.yml @@ -1,10 +1,10 @@ --- - name: Stop and disable services - systemd: + ansible.builtin.systemd: name: "{{ item }}" state: stopped enabled: false - ignore_errors: true + failed_when: false loop: - nginx.service - postgresql.service @@ -16,7 +16,7 @@ become: true - name: Remove software - yum: + ansible.builtin.yum: name: - postgresql - postgresql-server @@ -36,7 +36,7 @@ become: true - name: Remove created directories - file: + ansible.builtin.file: path: "{{ item }}" state: absent loop: @@ -47,7 +47,7 @@ become: true - name: Remove added users - user: + ansible.builtin.user: name: "{{ item }}" state: absent remove: true @@ -59,7 +59,7 @@ become: true - name: Remove added groups - group: + ansible.builtin.group: name: "{{ item }}" state: absent loop: diff --git a/roles/aap_remove/tasks/controller_remove.yml b/roles/aap_remove/tasks/controller_remove.yml index d2fafa5..df9e489 100644 --- a/roles/aap_remove/tasks/controller_remove.yml +++ b/roles/aap_remove/tasks/controller_remove.yml @@ -2,12 +2,12 @@ # Following this article: https://access.redhat.com/solutions/6733721 - name: Stop and disable services - systemd: + ansible.builtin.systemd: name: "{{ item }}" state: stopped enabled: false become: true - ignore_errors: true + failed_when: false loop: - automation-controller.service - postgresql.service @@ -17,7 +17,7 @@ - receptor.service - name: Remove software - yum: + ansible.builtin.yum: name: - postgresql - postgresql-server @@ -31,7 +31,7 @@ become: true - name: Remove created directories - file: + ansible.builtin.file: path: "{{ item }}" state: absent loop: @@ -44,7 +44,7 @@ become: true - name: Remove added users - user: + ansible.builtin.user: name: "{{ item }}" state: absent remove: true @@ -57,7 +57,7 @@ become: true - name: Remove added groups - group: + ansible.builtin.group: name: "{{ item }}" state: absent loop: diff --git a/roles/aap_restore/meta/main.yml b/roles/aap_restore/meta/main.yml index 489ab4e..98911df 100644 --- a/roles/aap_restore/meta/main.yml +++ b/roles/aap_restore/meta/main.yml @@ -6,12 +6,12 @@ galaxy_info: license: MIT - min_ansible_version: 2.12 + min_ansible_version: "2.12" platforms: - name: EL versions: - - 8 + - "8" galaxy_tags: - linux diff --git a/roles/aap_restore/tasks/restore.yml b/roles/aap_restore/tasks/restore.yml index ef5b044..88f3ad7 100644 --- a/roles/aap_restore/tasks/restore.yml +++ b/roles/aap_restore/tasks/restore.yml @@ -2,7 +2,7 @@ # Run the Setup to restore tower - name: "[Tower] Run the Ansible Tower Setup Program with restore option" become: true - command: ./setup.sh -e 'restore_backup_file={{ aap_restore_location | quote }}' -r + ansible.builtin.command: ./setup.sh -e 'restore_backup_file={{ aap_restore_location | quote }}' -r args: chdir: "{{ aap_setup_prep_setup_dir }}" async: 10000 diff --git a/roles/aap_setup_download/meta/main.yml b/roles/aap_setup_download/meta/main.yml index 13c89e6..10e45ec 100644 --- a/roles/aap_setup_download/meta/main.yml +++ b/roles/aap_setup_download/meta/main.yml @@ -6,12 +6,12 @@ galaxy_info: license: MIT - min_ansible_version: 2.9 + min_ansible_version: "2.12" platforms: - name: EL versions: - - 8 + - "8" galaxy_tags: ['aap', 'ansible'] diff --git a/roles/aap_setup_download/tasks/main.yml b/roles/aap_setup_download/tasks/main.yml index 28319cd..0892f05 100644 --- a/roles/aap_setup_download/tasks/main.yml +++ b/roles/aap_setup_download/tasks/main.yml @@ -1,7 +1,7 @@ --- # tasks file for aap_setup_download - name: Login to Red Hat APIs - uri: + ansible.builtin.uri: url: "{{ aap_setup_down_token_url }}" method: POST body_format: form-urlencoded @@ -12,7 +12,7 @@ register: __aap_setup_down_login - name: collecting the available installers - uri: + ansible.builtin.uri: url: "{{ aap_setup_down_images_url }}" method: GET return_content: true @@ -21,13 +21,14 @@ register: __aap_setup_down_output - name: simplify the list of possible downloads - set_fact: + ansible.builtin.set_fact: __aap_setup_down_images: "{{ __aap_setup_down_output.json.body | sort(attribute='datePublished', reverse=True) }}" - name: downloading the latest installer of type {{ aap_setup_down_type }} - get_url: + ansible.builtin.get_url: url: "{{ item.downloadHref }}" dest: "{{ aap_setup_down_dest_dir }}/{{ item.filename }}" + mode: 0644 headers: Authorization: "Bearer {{ __aap_setup_down_login.json.access_token }}" loop: "{{ __aap_setup_down_images[:2] }}" @@ -35,6 +36,6 @@ register: __aap_setup_down_downloads - name: extract the name of the downloaded installer to aap_setup_down_installer_file - set_fact: + ansible.builtin.set_fact: aap_setup_down_installer_file: "{{ (__aap_setup_down_downloads.results | selectattr('dest', 'defined') | map(attribute='dest') | list)[0] }}" ... diff --git a/roles/aap_setup_install/meta/main.yml b/roles/aap_setup_install/meta/main.yml index bf03985..29beeda 100644 --- a/roles/aap_setup_install/meta/main.yml +++ b/roles/aap_setup_install/meta/main.yml @@ -6,13 +6,13 @@ galaxy_info: license: MIT - min_ansible_version: 2.9 + min_ansible_version: "2.12" platforms: - name: Fedora versions: - all - - 25 + - "25" galaxy_tags: ['aap', 'ansible'] diff --git a/roles/aap_setup_install/tasks/main.yml b/roles/aap_setup_install/tasks/main.yml index 21d4e2c..18ea1da 100644 --- a/roles/aap_setup_install/tasks/main.yml +++ b/roles/aap_setup_install/tasks/main.yml @@ -7,7 +7,7 @@ loop: "{{ aap_setup_inst_fixes }}" - name: Check Ansible Tower Running - uri: + ansible.builtin.uri: url: "https://{{ controller_hostname }}/" method: GET user: admin @@ -22,7 +22,7 @@ - not aap_setup_inst_force | bool - name: Check Automation Hub Running - uri: + ansible.builtin.uri: url: "https://{{ ah_hostname }}/api/galaxy/" method: GET user: admin @@ -36,9 +36,10 @@ - "'automationhub' in aap_setup_prep_inv_nodes" - not aap_setup_inst_force | bool -- block: +- name: Install AAP + block: - name: run the Ansible Automation Platform setup program - command: "{{ lookup('template', 'setup_sh.j2') }}" + ansible.builtin.command: "{{ lookup('template', 'setup_sh.j2') }}" args: chdir: "{{ aap_setup_inst_setup_dir }}" async: 10000 @@ -47,7 +48,7 @@ # these will always run and will always report “changed” otherwise - name: wait for automation controller to be running - uri: # use the first host from the list if no hostname is defined + ansible.builtin.uri: # use the first host from the list if no hostname is defined url: "https://{{ controller_hostname }}/" status_code: 200 validate_certs: "{{ controller_validate_certs | default(omit) }}" @@ -58,7 +59,7 @@ when: "'automationcontroller' in aap_setup_prep_inv_nodes" - name: wait for automation hub to be running - uri: # use the first host from the list if no hostname is defined + ansible.builtin.uri: # use the first host from the list if no hostname is defined url: "https://{{ ah_hostname }}/api/galaxy/" status_code: 200 validate_certs: "{{ ah_validate_certs | default(omit) }}" diff --git a/roles/aap_setup_prepare/meta/main.yml b/roles/aap_setup_prepare/meta/main.yml index 3c327f9..ba77419 100644 --- a/roles/aap_setup_prepare/meta/main.yml +++ b/roles/aap_setup_prepare/meta/main.yml @@ -6,13 +6,13 @@ galaxy_info: license: MIT - min_ansible_version: 2.9 + min_ansible_version: "2.12" platforms: - name: Fedora versions: - all - - 25 + - "25" galaxy_tags: ['aap', 'ansible'] diff --git a/roles/aap_setup_prepare/tasks/fixes/aap_1413.yml b/roles/aap_setup_prepare/tasks/fixes/aap_1413.yml index 5740902..352d944 100644 --- a/roles/aap_setup_prepare/tasks/fixes/aap_1413.yml +++ b/roles/aap_setup_prepare/tasks/fixes/aap_1413.yml @@ -4,7 +4,7 @@ # `pulp.pulp_installer.pulp_webserver : Symlink nginx snippets`. - name: AAP-1413 | fix pulp/pulp_installer/roles/pulp_webserver/tasks/nginx.yml - lineinfile: + ansible.builtin.lineinfile: path: "{{ aap_setup_prep_setup_dir }}/collections/ansible_collections/pulp/pulp_installer/roles/pulp_webserver/tasks/nginx.yml" line: ' src: "{{ __aap_setup_prep_snippet_fix }}"' regex: '^ *src: ".. __pulp_webserver_snippet.stdout' diff --git a/roles/aap_setup_prepare/tasks/main.yml b/roles/aap_setup_prepare/tasks/main.yml index c711c6b..fce043c 100644 --- a/roles/aap_setup_prepare/tasks/main.yml +++ b/roles/aap_setup_prepare/tasks/main.yml @@ -3,21 +3,21 @@ # we check first so that the installation can happen without root access - name: check if the absolutely necessary packages are installed - command: "rpm -q {{ __aap_setup_prep_required_packages | join(' ') }}" # noqa command-instead-of-module + ansible.builtin.command: "rpm -q {{ __aap_setup_prep_required_packages | join(' ') }}" # noqa command-instead-of-module register: __aap_setup_prep_packages_result ignore_errors: true changed_when: false check_mode: false # run this command even in check mode - name: install absolutely necessary packages - yum: + ansible.builtin.yum: name: "{{ __aap_setup_prep_required_packages }}" state: present become: true when: "'is not installed' in __aap_setup_prep_packages_result.stdout" - name: extract the given installer tarball - unarchive: + ansible.builtin.unarchive: src: "{{ aap_setup_prep_installer_file }}" dest: "{{ aap_setup_prep_working_dir }}" list_files: true @@ -26,11 +26,11 @@ register: __aap_setup_prep_extract - name: Set tower_setup_dir - set_fact: + ansible.builtin.set_fact: aap_setup_prep_setup_dir: "{{ aap_setup_prep_working_dir }}/{{ __aap_setup_prep_extract.files[0] }}" - name: populate AAP setup.sh inventory file from template - template: + ansible.builtin.template: src: inventory.j2 dest: "{{ aap_setup_prep_setup_dir }}/inventory" mode: "ug=rw,o=r" diff --git a/roles/git_ssh_setup/meta/main.yml b/roles/git_ssh_setup/meta/main.yml index eb2fe0b..766f6e7 100644 --- a/roles/git_ssh_setup/meta/main.yml +++ b/roles/git_ssh_setup/meta/main.yml @@ -6,13 +6,13 @@ galaxy_info: license: MIT - min_ansible_version: 2.9 + min_ansible_version: "2.12" platforms: - name: EL versions: - - 7 - - 8 + - "7" + - "8" galaxy_tags: - linux diff --git a/roles/git_ssh_setup/tasks/git_users.yml b/roles/git_ssh_setup/tasks/git_users.yml index d23ee7e..fb7e893 100644 --- a/roles/git_ssh_setup/tasks/git_users.yml +++ b/roles/git_ssh_setup/tasks/git_users.yml @@ -2,7 +2,7 @@ # tasks file for git_ssh_setup - name: git_users | add client user to {{ git_server_user }} group - user: + ansible.builtin.user: name: "{{ client_item.name }}" groups: "{{ git_server_user }}" # group has been created with the user of same name append: true @@ -11,7 +11,7 @@ register: user_result - name: git_users | add the public keys to the git user authorized keys - authorized_key: + ansible.posix.authorized_key: user: "{{ git_server_user }}" state: present key: "{{ user_result.ssh_public_key }}" diff --git a/roles/git_ssh_setup/tasks/main.yml b/roles/git_ssh_setup/tasks/main.yml index 11e2f77..b6f304e 100644 --- a/roles/git_ssh_setup/tasks/main.yml +++ b/roles/git_ssh_setup/tasks/main.yml @@ -2,27 +2,27 @@ # tasks file for git_ssh_setup - name: install some additional convenience software on the control node - package: + ansible.builtin.package: name: "{{ git_needed_software }}" state: present - name: make sure git-shell is in /etc/shells - lineinfile: + ansible.builtin.lineinfile: dest: /etc/shells line: /usr/bin/git-shell - name: git user '{{ git_server_user }}' exists and uses git-shell - user: + ansible.builtin.user: name: "{{ git_server_user }}" comment: "Git server user" shell: /usr/bin/git-shell - name: define projects directory variable - set_fact: + ansible.builtin.set_fact: full_projects_dir: "/home/{{ git_server_user }}/{{ git_projects_dir }}" - name: Ensure home directory exists and has the correct access rights - file: + ansible.builtin.file: path: "/home/{{ git_server_user }}" owner: "{{ git_server_user }}" group: "{{ git_server_user }}" @@ -30,7 +30,7 @@ state: directory - name: Ensure projects directory exists and has the correct access rights - file: + ansible.builtin.file: path: "{{ full_projects_dir }}" owner: "{{ git_server_user }}" group: "{{ git_server_user }}" @@ -38,7 +38,7 @@ state: directory - name: Create empty bare repositories if missing - command: git init --bare --shared=group {{ full_projects_dir }}/{{ item }}.git # noqa 303 + ansible.builtin.command: git init --bare --shared=group {{ full_projects_dir }}/{{ item }}.git # noqa 303 args: creates: "{{ full_projects_dir }}/{{ item }}.git" become: true @@ -53,7 +53,7 @@ loop_var: client_item - name: Debug - debug: + ansible.builtin.debug: msg: > Git repos can be used with e.g. 'git clone {{ git_client_users[0].name }}@{{ ansible_host }}:{{ full_projects_dir }}/{{ git_projects[0] }}.git' diff --git a/roles/kerberos/meta/main.yml b/roles/kerberos/meta/main.yml index 5ed643c..1bf79bc 100644 --- a/roles/kerberos/meta/main.yml +++ b/roles/kerberos/meta/main.yml @@ -17,7 +17,7 @@ galaxy_info: # - CC-BY license: "MIT" - min_ansible_version: "2.9" + min_ansible_version: "2.12" # Optionally specify the branch Galaxy will use when accessing the GitHub # repo for this role. During role install, if no tags are available, diff --git a/roles/kerberos/tasks/main.yml b/roles/kerberos/tasks/main.yml index 16894c1..f47b2e7 100644 --- a/roles/kerberos/tasks/main.yml +++ b/roles/kerberos/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Install required kerberos packages - package: + ansible.builtin.package: name: "{{ item }}" state: "present" with_items: "{{ krb_req_pkgs }}" @@ -8,7 +8,7 @@ # EPEL required for python-pip install - name: Ensure EPEL repository is installed | EL7 - package: + ansible.builtin.package: name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm" state: "installed" when: @@ -18,7 +18,7 @@ tags: prerequisites - name: Ensure pip is installed - package: + ansible.builtin.package: name: "python-pip" state: "present" when: (ansible_os_family == "RedHat" and ansible_distribution_major_version == "7") or @@ -27,7 +27,7 @@ tags: prerequisites - name: Ensure Python libraries are installed - pip: + ansible.builtin.pip: name: "{{ item }}" umask: "0022" state: "present" @@ -35,7 +35,7 @@ become: true - name: Configure kerberos - template: + ansible.builtin.template: src: krb5.conf.j2 dest: /etc/krb5.conf owner: root @@ -43,7 +43,7 @@ mode: 0644 - name: Debug - debug: + ansible.builtin.debug: msg: - "To enable communication with your Windows nodes, add the following variables to your Windows group_vars:" - " ansible_connection: 'winrm'"