diff --git a/tests/test_playbooks/inventory_plugin.yml b/tests/test_playbooks/inventory_plugin.yml index 2446d7f12..10bf520ca 100644 --- a/tests/test_playbooks/inventory_plugin.yml +++ b/tests/test_playbooks/inventory_plugin.yml @@ -22,7 +22,6 @@ postgres_host: "postgres" postgres_port: 5432 collections: - - community.docker - theforeman.foreman tasks: - name: test inventory diff --git a/tests/test_playbooks/inventory_plugin_ansible.yml b/tests/test_playbooks/inventory_plugin_ansible.yml index 639bbfcb1..8a43f7ae8 100644 --- a/tests/test_playbooks/inventory_plugin_ansible.yml +++ b/tests/test_playbooks/inventory_plugin_ansible.yml @@ -22,7 +22,6 @@ postgres_host: "postgresansible" postgres_port: 5433 collections: - - community.docker - theforeman.foreman tasks: - name: test inventory diff --git a/tests/test_playbooks/tasks/inventory_plugin.yml b/tests/test_playbooks/tasks/inventory_plugin.yml index d667da95f..fff954c9b 100644 --- a/tests/test_playbooks/tasks/inventory_plugin.yml +++ b/tests/test_playbooks/tasks/inventory_plugin.yml @@ -16,12 +16,6 @@ include_tasks: inventory_plugin_tests.yml always: - name: remove containers - docker_container: - name: "{{ item }}" - state: absent - loop: - - "{{ foreman_host }}" - - "{{ foreman_host }}dynflow" - - "{{ postgres_host }}" + include_tasks: inventory_plugin_teardown_container.yml when: - inventory_use_container | bool diff --git a/tests/test_playbooks/tasks/inventory_plugin_setup_container.yml b/tests/test_playbooks/tasks/inventory_plugin_setup_container.yml index 20e1a26da..51b16ef08 100644 --- a/tests/test_playbooks/tasks/inventory_plugin_setup_container.yml +++ b/tests/test_playbooks/tasks/inventory_plugin_setup_container.yml @@ -1,16 +1,16 @@ --- - name: fetch PostgreSQL container - docker_image: + community.docker.docker_image: name: docker.io/library/postgres:{{ postgres_version }} source: pull - name: fetch Foreman container - docker_image: + community.docker.docker_image: name: "{{ foreman_container }}:{{ foreman_version }}" source: pull - name: start PostgreSQL container - docker_container: + community.docker.docker_container: name: "{{ postgres_host }}" image: docker.io/library/postgres:{{ postgres_version }} env: @@ -22,7 +22,7 @@ - "0.0.0.0:{{ postgres_port }}:5432" - name: start Foreman container - docker_container: + community.docker.docker_container: name: "{{ foreman_host }}" image: "{{ foreman_container }}:{{ foreman_version }}" command: bash -c "bundle exec bin/rails db:create db:migrate && bundle exec bin/rails db:seed && bundle exec bin/rails server -b 0.0.0.0" @@ -46,7 +46,7 @@ delay: 10 - name: start dynflow container - docker_container: + community.docker.docker_container: name: "{{ foreman_host }}dynflow" image: "{{ foreman_container }}:{{ foreman_version }}" command: bash -c "bundle exec rake dynflow:executor" diff --git a/tests/test_playbooks/tasks/inventory_plugin_teardown_container.yml b/tests/test_playbooks/tasks/inventory_plugin_teardown_container.yml new file mode 100644 index 000000000..1ca5b0a99 --- /dev/null +++ b/tests/test_playbooks/tasks/inventory_plugin_teardown_container.yml @@ -0,0 +1,9 @@ +--- +- name: remove containers + community.docker.docker_container: + name: "{{ item }}" + state: absent + loop: + - "{{ foreman_host }}" + - "{{ foreman_host }}dynflow" + - "{{ postgres_host }}"