diff --git a/.ansible-lint b/.ansible-lint index d48c511c..77d362f2 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -2,11 +2,13 @@ exclude_paths: - .cache/ # implicit unless exclude_paths is defined in config - .github/ + - requirements.yml - src/**/cookiecutter/{{* # - src/molecule_gce/cookiecutter/{{cookiecutter.molecule_directory}} skip_list: # Temporary skips made during migration + - args[module] - fqcn-builtins - yaml[line-length] - var-spacing diff --git a/molecule/test-podman/verify.yml b/molecule/test-podman/verify.yml index 86afba4f..6e148b14 100644 --- a/molecule/test-podman/verify.yml +++ b/molecule/test-podman/verify.yml @@ -4,6 +4,6 @@ - name: Verify hosts: all tasks: - - name: Example assertion - ansible.builtin.assert: - that: true + - name: Example assertion + ansible.builtin.assert: + that: true diff --git a/src/molecule_plugins/docker/playbooks/validate-dockerfile.yml b/src/molecule_plugins/docker/playbooks/validate-dockerfile.yml index 639eb7cc..fc89decd 100644 --- a/src/molecule_plugins/docker/playbooks/validate-dockerfile.yml +++ b/src/molecule_plugins/docker/playbooks/validate-dockerfile.yml @@ -31,7 +31,7 @@ ansible.builtin.template: src: Dockerfile.j2 dest: "{{ temp_dockerfiles.results[index].path }}" - mode: 0600 + mode: "0600" register: result with_items: "{{ platforms }}" loop_control: @@ -59,7 +59,7 @@ ansible.builtin.file: path: "{{ item }}" state: absent - mode: 0600 + mode: "0600" loop: "{{ temp_dockerfiles.results | map(attribute='path') | list }}" - name: Display results diff --git a/src/molecule_plugins/gce/playbooks/tasks/create_linux_instance.yml b/src/molecule_plugins/gce/playbooks/tasks/create_linux_instance.yml index f6ae0f2c..439102a3 100644 --- a/src/molecule_plugins/gce/playbooks/tasks/create_linux_instance.yml +++ b/src/molecule_plugins/gce/playbooks/tasks/create_linux_instance.yml @@ -1,11 +1,11 @@ --- -- name: create ssh keypair +- name: Create ssh keypair community.crypto.openssh_keypair: comment: "{{ lookup('env','USER') }} user for Molecule" path: "{{ ssh_identity_file }}" register: keypair -- name: create molecule Linux instance(s) +- name: Create molecule Linux instance(s) google.cloud.gcp_compute_instance: state: present name: "{{ item.name }}" diff --git a/src/molecule_plugins/gce/playbooks/tasks/create_windows_instance.yml b/src/molecule_plugins/gce/playbooks/tasks/create_windows_instance.yml index c3193f40..ed7dec73 100644 --- a/src/molecule_plugins/gce/playbooks/tasks/create_windows_instance.yml +++ b/src/molecule_plugins/gce/playbooks/tasks/create_windows_instance.yml @@ -1,5 +1,5 @@ --- -- name: create molecule Windows instance(s) +- name: Create molecule Windows instance(s) google.cloud.gcp_compute_instance: state: present name: "{{ item.name }}" diff --git a/src/molecule_plugins/podman/driver.py b/src/molecule_plugins/podman/driver.py index 84ea464a..2f9f8360 100644 --- a/src/molecule_plugins/podman/driver.py +++ b/src/molecule_plugins/podman/driver.py @@ -224,7 +224,6 @@ def sanity_checks(self): # fully adopts ansible-compat runtime = Runtime() if runtime.version < Version("2.10.0"): - if runtime.config.ansible_pipelining: sysexit_with_message( "Podman connections do not work with Ansible " diff --git a/src/molecule_plugins/podman/playbooks/create.yml b/src/molecule_plugins/podman/playbooks/create.yml index 4a76d91e..d69f5796 100644 --- a/src/molecule_plugins/podman/playbooks/create.yml +++ b/src/molecule_plugins/podman/playbooks/create.yml @@ -39,6 +39,7 @@ - item.registry is defined - item.registry.credentials is defined - item.registry.credentials.username is defined + changed_when: false - name: Check presence of custom Dockerfiles ansible.builtin.stat: @@ -97,6 +98,7 @@ retries: 3 delay: 30 no_log: false + changed_when: false - name: Determine the CMD directives ansible.builtin.set_fact: diff --git a/src/molecule_plugins/podman/playbooks/validate-dockerfile.yml b/src/molecule_plugins/podman/playbooks/validate-dockerfile.yml index f1086c51..c25ea66d 100644 --- a/src/molecule_plugins/podman/playbooks/validate-dockerfile.yml +++ b/src/molecule_plugins/podman/playbooks/validate-dockerfile.yml @@ -4,8 +4,6 @@ hosts: localhost connection: local gather_facts: false - collections: - - containers.podman vars: platforms: # platforms supported as being managed by molecule/ansible, this does @@ -30,7 +28,7 @@ ansible.builtin.template: src: Dockerfile.j2 dest: "{{ temp_image_dirs.results[index].path }}/Dockerfile" - mode: 0600 + mode: "0600" register: result with_items: "{{ platforms }}" loop_control: diff --git a/src/molecule_plugins/vagrant/modules/vagrant.py b/src/molecule_plugins/vagrant/modules/vagrant.py index 860a4fc2..5e0fa930 100644 --- a/src/molecule_plugins/vagrant/modules/vagrant.py +++ b/src/molecule_plugins/vagrant/modules/vagrant.py @@ -586,7 +586,6 @@ def _get_vagrant(self): return v def _get_instance_vagrant_config_dict(self, instance): - checksum = instance.get("box_download_checksum") checksum_type = instance.get("box_download_checksum_type") if bool(checksum) ^ bool(checksum_type): diff --git a/src/molecule_plugins/vagrant/playbooks/create.yml b/src/molecule_plugins/vagrant/playbooks/create.yml index 7b3a2e79..fb44b762 100644 --- a/src/molecule_plugins/vagrant/playbooks/create.yml +++ b/src/molecule_plugins/vagrant/playbooks/create.yml @@ -45,4 +45,4 @@ ansible.builtin.copy: content: "{{ instance_conf | to_json | from_json | to_yaml }}" dest: "{{ molecule_instance_config }}" - mode: 0600 + mode: "0600" diff --git a/src/molecule_plugins/vagrant/playbooks/destroy.yml b/src/molecule_plugins/vagrant/playbooks/destroy.yml index 9745a0fb..b1c4c9d6 100644 --- a/src/molecule_plugins/vagrant/playbooks/destroy.yml +++ b/src/molecule_plugins/vagrant/playbooks/destroy.yml @@ -31,5 +31,5 @@ # Molecule managed {{ instance_conf | to_json | from_json | to_yaml }} dest: "{{ molecule_instance_config }}" - mode: 0600 + mode: "0600" when: server.changed | bool diff --git a/test/docker/test_func.py b/test/docker/test_func.py index ce940096..2210d567 100644 --- a/test/docker/test_func.py +++ b/test/docker/test_func.py @@ -30,7 +30,6 @@ def test_command_init_and_test_scenario(tmp_path: pathlib.Path, DRIVER: str) -> scenario_name = "default" with change_dir_to(tmp_path): - scenario_directory = tmp_path / "molecule" / scenario_name cmd = [ "molecule", diff --git a/test/gce/scenarios/linux/create.yml b/test/gce/scenarios/linux/create.yml index 1b525f9b..05fa52c4 100644 --- a/test/gce/scenarios/linux/create.yml +++ b/test/gce/scenarios/linux/create.yml @@ -16,7 +16,7 @@ molecule_yml.driver.instance_os_type | lower == "windows" fail_msg: "instance_os_type is possible only to specify linux or windows either" - - name: get network info + - name: Get network info google.cloud.gcp_compute_network_info: filters: - name = "{{ molecule_yml.driver.network_name | default('default') }}" @@ -26,7 +26,7 @@ auth_kind: "{{ molecule_yml.driver.auth_kind | default(omit, true) }}" register: my_network - - name: get subnetwork info + - name: Get subnetwork info google.cloud.gcp_compute_subnetwork_info: filters: - name = "{{ molecule_yml.driver.subnetwork_name | default('default') }}" @@ -37,7 +37,7 @@ auth_kind: "{{ molecule_yml.driver.auth_kind | default(omit, true) }}" register: my_subnetwork - - name: set external access config + - name: Set external access config set_fact: external_access_config: - access_configs: diff --git a/test/gce/scenarios/linux/requirements.yml b/test/gce/scenarios/linux/requirements.yml index 808bcd77..f98215b1 100644 --- a/test/gce/scenarios/linux/requirements.yml +++ b/test/gce/scenarios/linux/requirements.yml @@ -1,3 +1,3 @@ collections: - name: google.cloud - source: https://galaxy.ansible.com + source: https://github.com/ansible-collections/google.cloud diff --git a/test/gce/scenarios/linux/tasks/create_linux_instance.yml b/test/gce/scenarios/linux/tasks/create_linux_instance.yml index bb4f6889..050e7575 100644 --- a/test/gce/scenarios/linux/tasks/create_linux_instance.yml +++ b/test/gce/scenarios/linux/tasks/create_linux_instance.yml @@ -1,11 +1,11 @@ --- -- name: create ssh keypair - openssh_keypair: +- name: Create ssh keypair + community.crypto.openssh_keypair: comment: "{{ lookup('env','USER') }} user for Molecule" path: "{{ ssh_identity_file }}" register: keypair -- name: create molecule Linux instance(s) +- name: Create molecule Linux instance(s) google.cloud.gcp_compute_instance: state: present name: "{{ item.name }}" diff --git a/test/gce/scenarios/linux/tasks/create_windows_instance.yml b/test/gce/scenarios/linux/tasks/create_windows_instance.yml index 9c0fe090..79dc0c13 100644 --- a/test/gce/scenarios/linux/tasks/create_windows_instance.yml +++ b/test/gce/scenarios/linux/tasks/create_windows_instance.yml @@ -1,5 +1,5 @@ --- -- name: create molecule Windows instance(s) +- name: Create molecule Windows instance(s) google.cloud.gcp_compute_instance: state: present name: "{{ item.name }}" diff --git a/test/gce/scenarios/linux/verify.yml b/test/gce/scenarios/linux/verify.yml index 79044cd0..d836443f 100644 --- a/test/gce/scenarios/linux/verify.yml +++ b/test/gce/scenarios/linux/verify.yml @@ -5,6 +5,6 @@ hosts: all gather_facts: false tasks: - - name: Example assertion - assert: - that: true + - name: Example assertion + assert: + that: true diff --git a/test/gce/scenarios/windows/create.yml b/test/gce/scenarios/windows/create.yml index 1b525f9b..05fa52c4 100644 --- a/test/gce/scenarios/windows/create.yml +++ b/test/gce/scenarios/windows/create.yml @@ -16,7 +16,7 @@ molecule_yml.driver.instance_os_type | lower == "windows" fail_msg: "instance_os_type is possible only to specify linux or windows either" - - name: get network info + - name: Get network info google.cloud.gcp_compute_network_info: filters: - name = "{{ molecule_yml.driver.network_name | default('default') }}" @@ -26,7 +26,7 @@ auth_kind: "{{ molecule_yml.driver.auth_kind | default(omit, true) }}" register: my_network - - name: get subnetwork info + - name: Get subnetwork info google.cloud.gcp_compute_subnetwork_info: filters: - name = "{{ molecule_yml.driver.subnetwork_name | default('default') }}" @@ -37,7 +37,7 @@ auth_kind: "{{ molecule_yml.driver.auth_kind | default(omit, true) }}" register: my_subnetwork - - name: set external access config + - name: Set external access config set_fact: external_access_config: - access_configs: diff --git a/test/gce/scenarios/windows/tasks/create_linux_instance.yml b/test/gce/scenarios/windows/tasks/create_linux_instance.yml index bb4f6889..050e7575 100644 --- a/test/gce/scenarios/windows/tasks/create_linux_instance.yml +++ b/test/gce/scenarios/windows/tasks/create_linux_instance.yml @@ -1,11 +1,11 @@ --- -- name: create ssh keypair - openssh_keypair: +- name: Create ssh keypair + community.crypto.openssh_keypair: comment: "{{ lookup('env','USER') }} user for Molecule" path: "{{ ssh_identity_file }}" register: keypair -- name: create molecule Linux instance(s) +- name: Create molecule Linux instance(s) google.cloud.gcp_compute_instance: state: present name: "{{ item.name }}" diff --git a/test/gce/scenarios/windows/tasks/create_windows_instance.yml b/test/gce/scenarios/windows/tasks/create_windows_instance.yml index 9c0fe090..79dc0c13 100644 --- a/test/gce/scenarios/windows/tasks/create_windows_instance.yml +++ b/test/gce/scenarios/windows/tasks/create_windows_instance.yml @@ -1,5 +1,5 @@ --- -- name: create molecule Windows instance(s) +- name: Create molecule Windows instance(s) google.cloud.gcp_compute_instance: state: present name: "{{ item.name }}" diff --git a/test/gce/scenarios/windows/verify.yml b/test/gce/scenarios/windows/verify.yml index 79044cd0..d836443f 100644 --- a/test/gce/scenarios/windows/verify.yml +++ b/test/gce/scenarios/windows/verify.yml @@ -5,6 +5,6 @@ hosts: all gather_facts: false tasks: - - name: Example assertion - assert: - that: true + - name: Example assertion + assert: + that: true diff --git a/test/vagrant/functional/test_func.py b/test/vagrant/functional/test_func.py index ee2748ef..5a67639d 100644 --- a/test/vagrant/functional/test_func.py +++ b/test/vagrant/functional/test_func.py @@ -82,7 +82,6 @@ def test_command_init_scenario(temp_dir): not is_vagrant_supported(), reason="vagrant not supported on this machine" ) def test_invalid_settings(temp_dir): - scenario_directory = os.path.join( os.path.dirname(util.abs_path(__file__)), os.path.pardir, "scenarios" ) @@ -111,7 +110,6 @@ def test_invalid_settings(temp_dir): ], ) def test_vagrant_root(temp_dir, scenario): - scenario_directory = os.path.join( os.path.dirname(util.abs_path(__file__)), os.path.pardir, "scenarios" ) @@ -126,7 +124,6 @@ def test_vagrant_root(temp_dir, scenario): not is_vagrant_supported(), reason="vagrant not supported on this machine" ) def test_multi_node(temp_dir): - scenario_directory = os.path.join( os.path.dirname(util.abs_path(__file__)), os.path.pardir, "scenarios" ) diff --git a/test/vagrant/scenarios/molecule/default-compat/create.yml b/test/vagrant/scenarios/molecule/default-compat/create.yml index a835c938..64c98757 100644 --- a/test/vagrant/scenarios/molecule/default-compat/create.yml +++ b/test/vagrant/scenarios/molecule/default-compat/create.yml @@ -61,4 +61,4 @@ ansible.builtin.copy: content: "{{ instance_conf | to_json | from_json | to_yaml }}" dest: "{{ molecule_instance_config }}" - mode: 0600 + mode: "0600" diff --git a/test/vagrant/scenarios/molecule/default-compat/destroy.yml b/test/vagrant/scenarios/molecule/default-compat/destroy.yml index b4718b23..3a5f313f 100644 --- a/test/vagrant/scenarios/molecule/default-compat/destroy.yml +++ b/test/vagrant/scenarios/molecule/default-compat/destroy.yml @@ -36,5 +36,5 @@ # Molecule managed {{ instance_conf | to_json | from_json | to_yaml }} dest: "{{ molecule_instance_config }}" - mode: 0600 + mode: ":0600" when: server.changed | bool diff --git a/tox.ini b/tox.ini index de8d2d69..44b608ac 100644 --- a/tox.ini +++ b/tox.ini @@ -30,6 +30,7 @@ extras = deps = py-{devel}: git+https://github.com/ansible-community/molecule.git@main#egg=molecule[test] commands = + ansible-galaxy install -r requirements.yml pytest --collect-only pytest --color=yes {tty:-s} setenv =