diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 42c2cec6..292c9a7a 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -15,11 +15,11 @@ ansible_python_interpreter: "{{ ansible_playbook_python }}" ansible.builtin.wait_for: port: 22 - host: '{{ (ansible_ssh_host|default(ansible_host))|default(inventory_hostname) }}' + host: '{{ (ansible_ssh_host | default(ansible_host)) | default(inventory_hostname) }}' search_regex: OpenSSH delay: 5 - - name: gather facts + - name: Gather facts ansible.builtin.setup: diff --git a/tests/test-connection-plugin.yml b/tests/test-connection-plugin.yml index 7cc82e04..35fb9dde 100644 --- a/tests/test-connection-plugin.yml +++ b/tests/test-connection-plugin.yml @@ -15,11 +15,11 @@ - name: Fail if sshd is running in the containers hosts: all_containers:alt_containers - gather_facts: no - become: True + gather_facts: false + become: true tasks: - name: Ensure sshd is not running - command: pgrep sshd + ansible.builtin.command: pgrep sshd register: sshd_pgrep failed_when: "sshd_pgrep.rc == 0" changed_when: false @@ -27,27 +27,26 @@ # The container3 ping validates I75f9d0f55ecd875caa1bf608a77c92f950b679a1 - name: Test the connection plugin container awareness functions hosts: all_containers:alt_containers - gather_facts: no - become: True + gather_facts: false + become: true tasks: - name: Test container ping - action: - module: ping + ansible.builtin.ping: # Test for I56d8afddbccf01f2944d2fdd505b601a4b048374 - name: Test delegation in the container aware connection plugin hosts: localhost - gather_facts: no - become: True + gather_facts: false + become: true tasks: - name: Test container delegation without templating - command: hostnamectl --transient + ansible.builtin.command: hostnamectl --transient delegate_to: container1 register: delegated failed_when: delegated.stdout != 'container1' changed_when: false - name: Test container delegation using templating - command: hostnamectl --transient + ansible.builtin.command: hostnamectl --transient delegate_to: "{{ groups['all_containers'][1] }}" register: delegated failed_when: delegated.stdout != 'container2' @@ -56,13 +55,13 @@ # Test for conditional delegation Ief2fecbc266adcc816336b601253d3e90c39c32b - name: Test conditional delegation hosts: container1 - gather_facts: no - become: True + gather_facts: false + become: true vars: delegate_control: "target-host" tasks: - name: Test conditional delegation - command: hostnamectl --transient + ansible.builtin.command: hostnamectl --transient register: delegated failed_when: delegated.stdout != 'container1' changed_when: false @@ -71,12 +70,11 @@ # Test for If594914df53efacc6d5bba148f4f46280f5a117d - name: Test delegation between container physical_hosts hosts: fakecontainer - gather_facts: no - become: True + gather_facts: false + become: true tasks: - name: Test delegation between containers on different hosts - action: - module: ping + ansible.builtin.ping: delegate_to: "{{ groups['all_containers'][0] }}" - name: Test container_user attribute @@ -84,14 +82,14 @@ user: root tasks: - name: Ensure container alt user - user: + ansible.builtin.user: name: testing group: users - name: Execute command with container_user set - command: whoami + ansible.builtin.command: whoami vars: container_user: testing - ansible_become: False + ansible_become: false register: whoami_output changed_when: false failed_when: @@ -100,13 +98,13 @@ # Test for I69f2eed35859bdc149e5ed21441eab7c8a8352cf - name: Create SSH certificate keys hosts: localhost - become: True + become: true tags: - always - sshd-ca tasks: - name: "Create ssh certificates to auth with" - include_role: + ansible.builtin.include_role: name: openstack.osa.ssh_keypairs vars: ssh_keypairs_setup_host: localhost @@ -121,29 +119,29 @@ ssh_keypairs_install_keys: keys: - cert: "plugins-{{ inventory_hostname }}" - dest: "{{ lookup('env','HOME') }}/.ssh/id_rsa" - ssh_keypairs_install_authorities: False + dest: "{{ lookup('env', 'HOME') }}/.ssh/id_rsa" + ssh_keypairs_install_authorities: false - name: Reinstall openssh-server for delegation to unknown inventory host hosts: container3 tasks: - name: Uninstall OpenSSH server - package: + ansible.builtin.package: name: "{{ openssh_server_package }}" state: absent - name: Install OpenSSH server - package: + ansible.builtin.package: name: "{{ openssh_server_package }}" state: present - name: Start OpenSSH server - systemd: + ansible.builtin.systemd: name: "{{ openssh_server_service }}" - enabled: yes - masked: no - daemon_reload: yes + enabled: true + masked: false + daemon_reload: true state: restarted - name: Add SSH CA to the container - include_role: + ansible.builtin.include_role: name: openstack.osa.ssh_keypairs vars: ssh_keypairs_setup_host: localhost @@ -161,7 +159,7 @@ remote_user: root tasks: - name: Test container delegation without using inventory name - command: hostnamectl --transient + ansible.builtin.command: hostnamectl --transient delegate_to: 10.100.100.4 register: delegated failed_when: delegated.stdout != 'container3' diff --git a/tests/test-filters.yml b/tests/test-filters.yml index f7121aa7..784d3822 100644 --- a/tests/test-filters.yml +++ b/tests/test-filters.yml @@ -14,34 +14,33 @@ # limitations under the License. - - name: Test filters hosts: localhost connection: local - gather_facts: no + gather_facts: false tasks: - name: Validate string_2_int filter - assert: + ansible.builtin.assert: that: - "{{ 'test' | string_2_int }} == 3752" - name: Set pip package list facts - set_fact: - pip_package_list_1: - - pip==8.1.2 - - setuptools==25.1.0 - - wheel==0.29.0 - pip_package_list_2: - - babel==2.3.4 - - pip==8.1.0 - pip_package_list_merged: - - babel==2.3.4 - - pip==8.1.0 - - setuptools==25.1.0 - - wheel==0.29.0 + ansible.builtin.set_fact: + pip_package_list_1: + - pip==8.1.2 + - setuptools==25.1.0 + - wheel==0.29.0 + pip_package_list_2: + - babel==2.3.4 + - pip==8.1.0 + pip_package_list_merged: + - babel==2.3.4 + - pip==8.1.0 + - setuptools==25.1.0 + - wheel==0.29.0 - name: Set splitlines string facts - set_fact: + ansible.builtin.set_fact: string_with_lines: | this is @@ -53,14 +52,14 @@ - a - test - name: Set splitlines filter fact - set_fact: + ansible.builtin.set_fact: string_split_lines_filtered: "{{ string_with_lines | splitlines }}" - name: Validate splitlines filter - assert: + ansible.builtin.assert: that: "string_split_lines_filtered == string_split_lines" - name: Set git repo facts - set_fact: + ansible.builtin.set_fact: git_repo: "git+https://git.openstack.org/openstack/nova@2bc8128d7793cc72ca2e146de3a092e1fef5033b#egg=nova&gitname=nova" git_repo_name: nova git_repo_link_parts: @@ -71,12 +70,12 @@ original: "git+https://git.openstack.org/openstack/nova@2bc8128d7793cc72ca2e146de3a092e1fef5033b#egg=nova&gitname=nova" - name: Set deprecation variable facts - set_fact: + ansible.builtin.set_fact: new_var: new old_var: old - name: Set deprecated filter fact - set_fact: + ansible.builtin.set_fact: deprecated_value: "{{ new_var | deprecated(old_var, 'old_var', 'new_var', 'Next Release', false) }}" - name: Validate deprecated filter - assert: + ansible.builtin.assert: that: "deprecated_value == old_var" diff --git a/tests/test-modules.yml b/tests/test-modules.yml index fba3fbaa..8357c4d4 100644 --- a/tests/test-modules.yml +++ b/tests/test-modules.yml @@ -13,12 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. - - - name: Test modules hosts: localhost connection: local - gather_facts: no + gather_facts: false tasks: - name: Test network mapping consistent order provider_networks: @@ -30,7 +28,7 @@ loop: "{{ range(10) | list }}" - name: Verify network mappings have a consistent order - assert: + ansible.builtin.assert: that: >- pndata.results | map(attribute='network_mappings') | unique | length == 1 diff --git a/tests/test-strategy-tagfilter.yml b/tests/test-strategy-tagfilter.yml index 35f83662..18b63b66 100644 --- a/tests/test-strategy-tagfilter.yml +++ b/tests/test-strategy-tagfilter.yml @@ -16,14 +16,14 @@ - name: Test the tagfilter execution strategy with a list of skip tags hosts: localhost strategy: tagfilter - gather_facts: no + gather_facts: false vars: skip_tags: - skipit - tagskip tasks: - name: Test skipped task - debug: + ansible.builtin.debug: msg: "This task is skipped" register: skipped_task tags: @@ -37,7 +37,7 @@ - test-tag4 - test-skipit - name: Test unskipped task - command: /bin/true + ansible.builtin.command: /bin/true register: run_task notify: Skipped Handler tags: @@ -45,12 +45,12 @@ - test-runit handlers: - name: Skipped Handler - debug: + ansible.builtin.debug: msg: "This handler is always skipped" register: skipped_handler post_tasks: - name: Check task run states - assert: + ansible.builtin.assert: that: - "skipped_task is not defined" - "run_task is changed" @@ -59,18 +59,18 @@ - name: Test the tagfilter execution strategy with a string skip tag hosts: localhost strategy: tagfilter - gather_facts: no + gather_facts: false vars: skip_tags: skipit tasks: - name: Test skipped task - debug: + ansible.builtin.debug: msg: "This task is skipped" register: skipped_task tags: - test-skipit - name: Test unskipped task - command: /bin/true + ansible.builtin.command: /bin/true register: run_task notify: Skipped Handler tags: @@ -78,12 +78,12 @@ - test-runit handlers: - name: Skipped Handler - debug: + ansible.builtin.debug: msg: "This handler is always skipped" register: skipped_handler post_tasks: - name: Check task run states - assert: + ansible.builtin.assert: that: - "skipped_task is not defined" - "run_task is changed" @@ -92,20 +92,20 @@ - name: Test the tagfilter execution strategy with handlers enabled hosts: localhost strategy: tagfilter - gather_facts: no + gather_facts: false vars: - skip_handlers: False + skip_handlers: false skip_tags: skipit tasks: - name: Test skipped task - command: /bin/true + ansible.builtin.command: /bin/true register: skipped_task notify: Skipped Handler tags: - skip_ansible_lint - test-skipit - name: Test unskipped task - command: /bin/true + ansible.builtin.command: /bin/true register: run_task notify: Run Handler tags: @@ -113,15 +113,15 @@ - test-runit handlers: - name: Skipped Handler - debug: + ansible.builtin.debug: msg: "This handler is always skipped" register: skipped_handler - name: Run Handler - command: /bin/true + ansible.builtin.command: /bin/true register: run_handler post_tasks: - name: Check task run states - assert: + ansible.builtin.assert: that: - "skipped_task is not defined" - "run_task is changed"