diff --git a/molecule/docker/create.yml b/molecule/docker/create.yml index 18adf023bb..1b028745fd 100644 --- a/molecule/docker/create.yml +++ b/molecule/docker/create.yml @@ -52,7 +52,7 @@ content: | {{ molecule_inventory | to_yaml }} dest: "{{ molecule_ephemeral_directory }}/inventory/molecule_inventory.yml" - mode: 0600 + mode: "0600" - name: Force inventory refresh ansible.builtin.meta: refresh_inventory diff --git a/molecule/kubevirt/create.yml b/molecule/kubevirt/create.yml index f53c389db3..3f92133d6d 100644 --- a/molecule/kubevirt/create.yml +++ b/molecule/kubevirt/create.yml @@ -6,7 +6,7 @@ temporary_ssh_key_size: 2048 # Variable for the size of the SSH key tasks: - name: Set default SSH key path # Sets the path of the SSH key - set_fact: + ansible.builtin.set_fact: tempoary_ssh_key_path: "{{ molecule_ephemeral_directory }}/identity_file" - name: Generate SSH key pair # Generates a new SSH key pair @@ -16,16 +16,17 @@ register: temporary_ssh_keypair # Stores the output of this task in a variable - name: Set SSH public key # Sets the SSH public key from the key pair - set_fact: + ansible.builtin.set_fact: temporary_ssh_public_key: "{{ temporary_ssh_keypair.public_key }}" - name: Create VM in KubeVirt # Calls another file to create the VM in KubeVirt - include_tasks: tasks/create_vm.yml + ansible.builtin.include_tasks: tasks/create_vm.yml loop: "{{ molecule_yml.platforms }}" # Loops over all platforms defined in molecule_yml loop_control: loop_var: vm # Sets the variable for the current item in the loop - name: Create Nodeport service if ssh_type is set to NodePort # Conditional block, executes if vm.ssh_service.type is NodePort + when: "vm.ssh_service.type == 'NodePort'" # The block is executed when this condition is met block: - name: Create ssh NodePort Kubernetes Services # Creates a new NodePort service in Kubernetes kubernetes.core.k8s: @@ -58,10 +59,9 @@ loop_control: loop_var: vm # Sets the variable for the current item in the loop register: node_port_services # Stores the output of this task in a variable - when: "vm.ssh_service.type == 'NodePort'" # The block is executed when this condition is met - name: Create VM dictionary # Calls another file to create a dictionary with information about the VM - include_tasks: tasks/create_vm_dictionary.yml + ansible.builtin.include_tasks: tasks/create_vm_dictionary.yml loop: "{{ molecule_yml.platforms }}" # Loops over all platforms defined in molecule_yml loop_control: loop_var: vm # Sets the variable for the current item in the loop @@ -76,7 +76,7 @@ ansible.builtin.copy: content: "{{ molecule_inventory | to_nice_yaml }}" dest: "{{ molecule_ephemeral_directory }}/inventory/molecule_inventory.yml" - mode: 0600 # Sets the permissions of the file to -rw------- + mode: "0600" # Sets the permissions of the file to -rw------- - name: Refresh inventory # Refreshes the inventory ansible.builtin.meta: refresh_inventory diff --git a/molecule/kubevirt/tasks/create_vm_dictionary.yml b/molecule/kubevirt/tasks/create_vm_dictionary.yml index fd7dddf51d..d4b4a1b0d8 100644 --- a/molecule/kubevirt/tasks/create_vm_dictionary.yml +++ b/molecule/kubevirt/tasks/create_vm_dictionary.yml @@ -7,9 +7,9 @@ ssh_service_address: >- {%- set svc_type = vm.ssh_service.type | default(None) -%} {%- if svc_type == 'NodePort' -%} - {{(node_port_services.results | selectattr('vm.name','==',vm.name) | first)['resources'][0]['spec']['ports'][0]['nodePort'] }} + {{ (node_port_services.results | selectattr('vm.name', '==', vm.name) | first)['resources'][0]['spec']['ports'][0]['nodePort'] }} {%- endif -%} - set_fact: + ansible.builtin.set_fact: # Here, the task is updating the `molecule_systems` dictionary with new VM information. # If `molecule_systems` doesn't exist, it is created as an empty dictionary. # Then it is combined with a new dictionary for the current VM, containing ansible connection details. diff --git a/molecule/podman/create.yml b/molecule/podman/create.yml index fba7aa3b09..9241a08dce 100644 --- a/molecule/podman/create.yml +++ b/molecule/podman/create.yml @@ -53,7 +53,7 @@ content: | {{ molecule_inventory | to_yaml }} dest: "{{ molecule_ephemeral_directory }}/inventory/molecule_inventory.yml" - mode: 0600 + mode: "0600" - name: Force inventory refresh ansible.builtin.meta: refresh_inventory diff --git a/playbooks/snap-pre-run.yaml b/playbooks/snap-pre-run.yaml index 5df174aea9..c34b17affa 100644 --- a/playbooks/snap-pre-run.yaml +++ b/playbooks/snap-pre-run.yaml @@ -1,4 +1,5 @@ -- hosts: all +- name: Snap-pre-run + hosts: all become: true tasks: - name: Install snapd @@ -11,13 +12,14 @@ name: snapd.socket state: started - - when: ansible_os_family == 'Debian' - name: Install snapcraft (debian) + - name: Install snapcraft (debian) + when: ansible_os_family == 'Debian' ansible.builtin.package: name: snapcraft state: present - - when: ansible_os_family == 'RedHat' + - name: Install snapcraft (RedHat) + when: ansible_os_family == 'RedHat' block: - name: Activate snapd ansible.builtin.shell: |