From 9170f0ca2a50038eef8088695d1ee346ade587fb Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Tue, 31 Oct 2023 13:31:49 +0100 Subject: [PATCH] Fix ansible-lint Signed-off-by: Alina Buzachis --- .config/ansible-lint.yml | 1 + .../move_vm_from_on_prem_to_aws.yml | 28 +++++++++---------- playbooks/webapp/webapp_ha_aurora.yaml | 2 +- roles/clone_on_prem_vm/tasks/main.yml | 12 ++++---- .../tasks/main.yml | 2 +- 5 files changed, 23 insertions(+), 22 deletions(-) diff --git a/.config/ansible-lint.yml b/.config/ansible-lint.yml index ca693a5d..25954e3d 100644 --- a/.config/ansible-lint.yml +++ b/.config/ansible-lint.yml @@ -6,5 +6,6 @@ skip_list: - meta-no-info # meta/main.yml should contain relevant info. - latest[git] # Result of the command may vary on subsequent runs. - no-handler # Tasks that run when changed should likely be handlers. + - no-changed-when # Commands should not change things if nothing needs doing. exclude_paths: - roles/aws_setup_credentials/ # Skip defaults/main.yml file diff --git a/playbooks/move_vm_from_on_prem_to_aws/move_vm_from_on_prem_to_aws.yml b/playbooks/move_vm_from_on_prem_to_aws/move_vm_from_on_prem_to_aws.yml index d14b752e..ebeefe42 100644 --- a/playbooks/move_vm_from_on_prem_to_aws/move_vm_from_on_prem_to_aws.yml +++ b/playbooks/move_vm_from_on_prem_to_aws/move_vm_from_on_prem_to_aws.yml @@ -14,23 +14,23 @@ ansible.builtin.import_role: name: cloud.aws_ops.clone_on_prem_vm vars: - clone_on_prem_vm_source_vm_name: "{{ clone_on_prem_vm_source_vm_name }}" - clone_on_prem_vm_image_name: "{{ clone_on_prem_vm_image_name }}" - clone_on_prem_vm_uri: "{{ clone_on_prem_vm_uri }}" - clone_on_prem_vm_local_image_path: "{{ clone_on_prem_vm_local_image_path }}" - clone_on_prem_vm_overwrite: "{{ clone_on_prem_vm_overwrite }}" + clone_on_prem_vm_source_vm_name: "{{ source_vm_name }}" + clone_on_prem_vm_image_name: "{{ image_name }}" + clone_on_prem_vm_uri: "{{ uri }}" + clone_on_prem_vm_local_image_path: "{{ local_image_path }}" + clone_on_prem_vm_overwrite: "{{ overwrite }}" delegate_to: kvm - name: Import 'cloud.aws_ops.import_image_and_run_aws_instance' role ansible.builtin.import_role: name: cloud.aws_ops.import_image_and_run_aws_instance vars: - import_image_and_run_aws_instance_bucket_name: "{{ import_image_and_run_aws_instance_bucket_name }}" - import_image_and_run_aws_instance_image_path: "{{ clone_on_prem_vm_raw_image_path }}" - import_image_and_run_aws_instance_instance_name: "{{ import_image_and_run_aws_instance_instance_name }}" - import_image_and_run_aws_instance_instance_type: "{{ import_image_and_run_aws_instance_instance_type }}" - import_image_and_run_aws_instance_import_image_task_name: "{{ import_image_and_run_aws_instance_import_image_task_name }}" - import_image_and_run_aws_instances_keypair_name: "{{ import_image_and_run_aws_instances_keypair_name }}" - import_image_and_run_aws_instance_security_groups: "{{ import_image_and_run_aws_instance_security_groups }}" - import_image_and_run_aws_instance_vpc_subnet_id: "{{ import_image_and_run_aws_instance_vpc_subnet_id }}" - import_image_and_run_aws_instance_volumes: "{{ import_image_and_run_aws_instance_volumes }}" + import_image_and_run_aws_instance_bucket_name: "{{ bucket_name }}" + import_image_and_run_aws_instance_image_path: "{{ raw_image_path }}" + import_image_and_run_aws_instance_instance_name: "{{ instance_name }}" + import_image_and_run_aws_instance_instance_type: "{{ instance_type }}" + import_image_and_run_aws_instance_import_image_task_name: "{{ import_image_task_name }}" + import_image_and_run_aws_instance_keypair_name: "{{ keypair_name }}" + import_image_and_run_aws_instance_security_groups: "{{ security_groups }}" + import_image_and_run_aws_instance_vpc_subnet_id: "{{ vpc_subnet_id }}" + import_image_and_run_aws_instance_volumes: "{{ volumes }}" diff --git a/playbooks/webapp/webapp_ha_aurora.yaml b/playbooks/webapp/webapp_ha_aurora.yaml index 3997385a..a16a1ccd 100644 --- a/playbooks/webapp/webapp_ha_aurora.yaml +++ b/playbooks/webapp/webapp_ha_aurora.yaml @@ -1,5 +1,5 @@ --- -- name: webapp HA +- name: Webapp HA hosts: localhost gather_facts: false vars_files: diff --git a/roles/clone_on_prem_vm/tasks/main.yml b/roles/clone_on_prem_vm/tasks/main.yml index 8807f73f..88fed226 100644 --- a/roles/clone_on_prem_vm/tasks/main.yml +++ b/roles/clone_on_prem_vm/tasks/main.yml @@ -9,13 +9,13 @@ manager: auto register: package_facts -- name: qemu is not installed - debug: +- name: Qemu is not installed + ansible.builtin.debug: msg: "qemu is not installed" when: "'qemu' not in package_facts.ansible_facts.packages" -- name: qemu-img is not installed - debug: +- name: Qemu-img is not installed + ansible.builtin.debug: msg: "qemu-img is not installed" when: "'qemu-img' not in package_facts.ansible_facts.packages" @@ -79,7 +79,7 @@ clone_on_prem_vm__clone_path: "{{ clone_on_prem_vm__tmpdir.path }}/{{ clone_on_prem_vm_image_name }}.qcow2" clone_on_prem_vm__raw_image_path: "{{ clone_on_prem_vm__tmpdir.path }}/{{ clone_on_prem_vm_image_name }}.raw" -- name: Cloning {{ clone_on_prem_vm_source_vm_name }} on prem VM +- name: Cloning on prem VM {{ clone_on_prem_vm_source_vm_name }} ansible.builtin.command: | virt-clone --original {{ clone_on_prem_vm_source_vm_name }} \ --name {{ clone_on_prem_vm_image_name }} \ @@ -100,7 +100,7 @@ {{ clone_on_prem_vm__clone_path }} \ {{ clone_on_prem_vm__raw_image_path }} become: true - become_method: sudo + become_method: ansible.builtin.sudo environment: LIBVIRT_DEFAULT_URI: "{{ clone_on_prem_vm_uri }}" when: clone_on_prem_vm__clone_info.stat.exists and clone_on_prem_vm__clone_info.stat.pw_name == "root" diff --git a/roles/import_image_and_run_aws_instance/tasks/main.yml b/roles/import_image_and_run_aws_instance/tasks/main.yml index e691db52..539cb144 100644 --- a/roles/import_image_and_run_aws_instance/tasks/main.yml +++ b/roles/import_image_and_run_aws_instance/tasks/main.yml @@ -25,7 +25,7 @@ when: import_image_and_run_aws_instance_import_image_task_name is undefined - name: Get information about the S3 bucket - community.aws.s3_bucket_info: + amazon.aws.s3_bucket_info: name: "{{ import_image_and_run_aws_instance_bucket_name }}" register: import_image_and_run_aws_instance__bucket_info