diff --git a/tests/test_playbooks/inventory_plugin.yml b/tests/test_playbooks/inventory_plugin.yml index 506d92b5d3..6fe1ed0ef1 100644 --- a/tests/test_playbooks/inventory_plugin.yml +++ b/tests/test_playbooks/inventory_plugin.yml @@ -10,25 +10,30 @@ foreman_hosts: testhost1.example.com: group_a testhost2.example.com: group_b/group_c - foreman_version: '2.1-stable' + _foreman_container: "{{ foreman_container | default('quay.io/foreman/foreman') }}" + _foreman_version: "{{ foreman_version | default('2.1-stable') }}" + _foreman_host: "{{ foreman_host | default('foreman') }}" + _foreman_port: "{{ foreman_port | default('3000') }}" + _postgres_version: "{{ postgres_version | default('12') }}" + _postgres_host: "{{ postgres_host | default('postgres') }}" collections: - community.general - theforeman.foreman tasks: - name: fetch PostgreSQL container docker_image: - name: postgres:12 + name: postgres:{{ _postgres_version }} source: pull - name: fetch Foreman container docker_image: - name: quay.io/foreman/foreman:{{ foreman_version }} + name: "{{ _foreman_container }}:{{ _foreman_version }}" source: pull - name: start PostgreSQL container docker_container: - name: postgres - image: postgres:12 + name: "{{ _postgres_host }}" + image: postgres:{{ _postgres_version }} env: POSTGRES_USER: foreman POSTGRES_PASSWORD: foreman @@ -39,23 +44,23 @@ - name: start Foreman container docker_container: - name: foreman - image: quay.io/foreman/foreman:{{ foreman_version }} + 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" env: SEED_ADMIN_PASSWORD: changeme RAILS_ENV: production - DATABASE_URL: postgres://foreman:foreman@postgres/foreman?pool=5 + DATABASE_URL: postgres://foreman:foreman@{{ _postgres_host }}/foreman?pool=5 links: - - postgres:postgres + - "{{ _postgres_host }}:{{ _postgres_host }}" published_ports: - - "0.0.0.0:3000:3000" + - "0.0.0.0:{{ _foreman_port }}:3000" - name: wait for foreman to start status_info: username: admin password: changeme - server_url: http://127.0.0.1:3000/ + server_url: http://127.0.0.1:{{ _foreman_port }}/ register: result until: - result is success @@ -67,7 +72,7 @@ hostgroup: username: admin password: changeme - server_url: http://127.0.0.1:3000/ + server_url: http://127.0.0.1:{{ _foreman_port }}/ name: "{{ item.name }}" parent: "{{ item.parent | default(omit) }}" organizations: @@ -80,7 +85,7 @@ host: username: admin password: changeme - server_url: http://127.0.0.1:3000/ + server_url: http://127.0.0.1:{{ _foreman_port }}/ name: "{{ item.key }}" hostgroup: "{{ item.value }}" build: false @@ -96,7 +101,7 @@ - name: submit facts for hosts uri: - url: http://127.0.0.1:3000/api/hosts/facts + url: http://127.0.0.1:{{ _foreman_port }}/api/hosts/facts url_username: admin url_password: changeme validate_certs: false @@ -162,5 +167,5 @@ - name: remove Foreman container docker_container: - name: foreman + name: "{{ _foreman_host }}" state: absent