diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 555f71e..d2af97d 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -4,19 +4,18 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -'on': +on: push: pull_request: jobs: - linters: - uses: ansible-network/github_actions/.github/workflows/tox-linters.yml@main ansible-lint: runs-on: ubuntu-latest steps: - - uses: ansible-network/github_actions/.github/actions/checkout_dependency@main + - uses: actions/checkout@v4 - name: Run ansible-lint - uses: ansible/ansible-lint-action@main - with: - action_ref: v6.17.2 + uses: ansible/ansible-lint@v6.22.0 + + tox-linters: + uses: ansible-network/github_actions/.github/workflows/tox-linters.yml@main diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml index 56603d3..c8758ad 100644 --- a/.github/workflows/sanity.yml +++ b/.github/workflows/sanity.yml @@ -14,70 +14,6 @@ on: jobs: sanity: uses: ansible-network/github_actions/.github/workflows/sanity.yml@main - with: - matrix_include: "[]" - matrix_exclude: >- - [ - { - "ansible-version": "stable-2.9" - }, - { - "ansible-version": "stable-2.12", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.12", - "python-version": "3.11" - }, - { - "ansible-version": "stable-2.13", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.13", - "python-version": "3.11" - }, - { - "ansible-version": "stable-2.14", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.14", - "python-version": "3.8" - }, - { - "ansible-version": "stable-2.15", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.15", - "python-version": "3.8" - }, - { - "ansible-version": "milestone", - "python-version": "3.7" - }, - { - "ansible-version": "milestone", - "python-version": "3.8" - }, - { - "ansible-version": "milestone", - "python-version": "3.9" - }, - { - "ansible-version": "devel", - "python-version": "3.7" - }, - { - "ansible-version": "devel", - "python-version": "3.8" - }, - { - "ansible-version": "devel", - "python-version": "3.9" - } - ] all_green: if: ${{ always() }} needs: diff --git a/README.md b/README.md index ef780d1..2562edc 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ The collection includes a variety of Ansible roles and playbook to help automate ## Ansible version compatibility -This collection has been tested against following Ansible versions: **>=2.13.0**. +This collection has been tested against following Ansible versions: **>=2.14.0**. ## Included content diff --git a/changelogs/fragments/202400305-fixes.yml b/changelogs/fragments/202400305-fixes.yml new file mode 100644 index 0000000..ac2c4d1 --- /dev/null +++ b/changelogs/fragments/202400305-fixes.yml @@ -0,0 +1,9 @@ +breaking_changes: + - "Update README.md and meta/runtime.yml to reflect our ansible core testing versions." + +trivial: +- "Increase ansible-lint version to 1.22" + +bugfixes: + - roles/azure_manage_resource_group - Ensure the correct variable name is used for the operation. + - roles/azure_virtual_machine_with_public_ip - Ensure the correct variables names are defined inside defaults. diff --git a/meta/runtime.yml b/meta/runtime.yml index df7e49c..bb3fca1 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1 +1 @@ -requires_ansible: '>=2.13.0' +requires_ansible: '>=2.14.0' diff --git a/roles/azure_manage_resource_group/defaults/main.yml b/roles/azure_manage_resource_group/defaults/main.yml index 25bbb1f..9913e5f 100644 --- a/roles/azure_manage_resource_group/defaults/main.yml +++ b/roles/azure_manage_resource_group/defaults/main.yml @@ -1,3 +1,3 @@ --- # defaults file for resource_group -operation: create +azure_manage_resource_group_operation: create diff --git a/roles/azure_manage_resource_group/tasks/main.yml b/roles/azure_manage_resource_group/tasks/main.yml index 8b99fd3..4e99383 100644 --- a/roles/azure_manage_resource_group/tasks/main.yml +++ b/roles/azure_manage_resource_group/tasks/main.yml @@ -1,7 +1,7 @@ --- -- name: Check operation validation +- name: Check azure_manage_resource_group_operation validation ansible.builtin.fail: - msg: Please provide operation as 'create' or 'delete' + msg: Please provide azure_manage_resource_group_operation as 'create' or 'delete' when: azure_manage_resource_group_operation not in ['create', 'delete'] - name: Check Resource group name diff --git a/roles/azure_virtual_machine_with_public_ip/README.md b/roles/azure_virtual_machine_with_public_ip/README.md index dda6ac9..0fb9f76 100644 --- a/roles/azure_virtual_machine_with_public_ip/README.md +++ b/roles/azure_virtual_machine_with_public_ip/README.md @@ -12,8 +12,8 @@ Role Variables -------------- * **azure_virtual_machine_with_public_ip_operation**: Operation to perform. Valid values are 'create', 'delete', 'power_on', 'power_off', 'deallocate', 'restart'. Default is 'create'. -* **azure_virtual_machine_with_public_ip_remove_on_absent**: Specify which resources to remove when `operation='delete'`. 'all' removes all resources attached to the VM being removed; 'all_autocreated' removes the resources that were automatically created while provisioning the VM (public ip, network interface, security group). To remove only specific resources, use the values 'network_interfaces', 'virtual_storage', or 'public_ips'. The default value is 'all'. -* **azure_virtual_machine_with_public_ip_resource_group**: Resource group on/from which the virtual machine will reside. When `operation='create'`, this resource group will be created if it does not exist. +* **azure_virtual_machine_with_public_ip_remove_on_absent**: Specify which resources to remove when `azure_virtual_machine_with_public_ip_operation='delete'`. 'all' removes all resources attached to the VM being removed; 'all_autocreated' removes the resources that were automatically created while provisioning the VM (public ip, network interface, security group). To remove only specific resources, use the values 'network_interfaces', 'virtual_storage', or 'public_ips'. The default value is 'all'. +* **azure_virtual_machine_with_public_ip_resource_group**: Resource group on/from which the virtual machine will reside. When `azure_virtual_machine_with_public_ip_operation='create'`, this resource group will be created if it does not exist. * **azure_virtual_machine_with_public_ip_region**: An Azure location for the resources. * **azure_virtual_machine_with_public_ip_tags**: Dictionary of string:string pairs to assign as metadata to the resource group. * **azure_virtual_machine_with_public_ip_vm**: Object used to provide details for a virtual machine. Contains the following: diff --git a/roles/azure_virtual_machine_with_public_ip/defaults/main.yml b/roles/azure_virtual_machine_with_public_ip/defaults/main.yml index de4be07..57f1e2a 100644 --- a/roles/azure_virtual_machine_with_public_ip/defaults/main.yml +++ b/roles/azure_virtual_machine_with_public_ip/defaults/main.yml @@ -1,5 +1,5 @@ --- # defaults file for virtual_machine -operation: create -azure_vm: {} -remove_on_absent: all +azure_virtual_machine_with_public_ip_operation: create +azure_virtual_machine_with_public_ip_vm: {} +azure_virtual_machine_with_public_ip_remove_on_absent: all diff --git a/roles/azure_virtual_machine_with_public_ip/tasks/create.yml b/roles/azure_virtual_machine_with_public_ip/tasks/create.yml index 3a83aa9..e02b370 100644 --- a/roles/azure_virtual_machine_with_public_ip/tasks/create.yml +++ b/roles/azure_virtual_machine_with_public_ip/tasks/create.yml @@ -55,7 +55,7 @@ - name: default primary: true public_ip_address_name: "{{ vm_name }}" - load_balancer_backend_address_pools: "{{ azure_vm.load_balancer_backend_address_pools | default(omit) }}" + load_balancer_backend_address_pools: "{{ azure_virtual_machine_with_public_ip_vm.load_balancer_backend_address_pools | default(omit) }}" - name: Tag all autocreated resources for cleanup ansible.builtin.set_fact: diff --git a/roles/azure_virtual_machine_with_public_ip/tasks/delete.yml b/roles/azure_virtual_machine_with_public_ip/tasks/delete.yml index a232b3d..dcb2939 100644 --- a/roles/azure_virtual_machine_with_public_ip/tasks/delete.yml +++ b/roles/azure_virtual_machine_with_public_ip/tasks/delete.yml @@ -1,8 +1,8 @@ --- - name: Fail on invalid delete option ansible.builtin.fail: - msg: Invalid value for remove_on_absent. Valid values include 'all', 'all_autocreated', 'network_interfaces', 'virtual_storage', or 'public_ips' - when: remove_on_absent not in ['all', 'all_autocreated', 'network_interfaces', 'virtual_storage', 'public_ips'] + msg: Invalid value for azure_virtual_machine_with_public_ip_remove_on_absent. Valid values include 'all', 'all_autocreated', 'network_interfaces', 'virtual_storage', or 'public_ips' + when: azure_virtual_machine_with_public_ip_remove_on_absent not in ['all', 'all_autocreated', 'network_interfaces', 'virtual_storage', 'public_ips'] - name: Fail when resource group doesn't exist ansible.builtin.fail: @@ -13,5 +13,5 @@ azure.azcollection.azure_rm_virtualmachine: resource_group: "{{ azure_resource_group }}" name: "{{ vm_name }}" - remove_on_absent: "{{ remove_on_absent | default(omit) }}" + remove_on_absent: "{{ azure_virtual_machine_with_public_ip_remove_on_absent | default(omit) }}" state: absent diff --git a/tox.ini b/tox.ini index 89e81b1..d269368 100644 --- a/tox.ini +++ b/tox.ini @@ -5,7 +5,7 @@ skipsdist = True [testenv:ansible-lint] ; There is currently a bug in ansible-lint 6.8.6: https://github.com/ansible/ansible-lint/issues/2673 deps = - ansible-lint==v6.17.2 + ansible-lint==v6.22.0 commands = ansible-lint --show-relpath [testenv:linters]