Update role dependencies
This commit is contained in:
@@ -14,7 +14,13 @@
|
||||
# connection: local
|
||||
# delegate_to: localhost
|
||||
vars:
|
||||
|
||||
container_state: running
|
||||
# container_state: absent
|
||||
container_instances:
|
||||
- name: lighthttpd-1
|
||||
port: 8080
|
||||
- name: lighthttpd-2
|
||||
port: 8081
|
||||
tasks:
|
||||
- name: create test dir for www file
|
||||
file:
|
||||
@@ -28,31 +34,34 @@
|
||||
|
||||
- name: tests container
|
||||
vars:
|
||||
container_state: running
|
||||
# container_state: absent
|
||||
container_image_list:
|
||||
- sebp/lighttpd:latest
|
||||
container_name: lighttpd
|
||||
container_name: "{{ outer_item.name }}"
|
||||
container_run_args: >-
|
||||
--rm
|
||||
-v /tmp/podman-container-systemd:/var/www/localhost/htdocs:Z
|
||||
-t
|
||||
-p 8080:80/tcp
|
||||
-p "{{ outer_item.port }}:80/tcp"
|
||||
container_firewall_ports:
|
||||
- 8080/tcp
|
||||
- "{{ outer_item.port }}/tcp"
|
||||
|
||||
import_role:
|
||||
ansible.builtin.include_role:
|
||||
name: podman-container-systemd
|
||||
loop: "{{ container_instances }}"
|
||||
loop_control:
|
||||
loop_var: outer_item
|
||||
|
||||
- name: Wait for lighttpd to come up
|
||||
wait_for:
|
||||
port: 8080
|
||||
port: "{{ item.port }}"
|
||||
loop: "{{ container_instances }}"
|
||||
when: container_state == "running"
|
||||
|
||||
- name: test if container runs
|
||||
get_url:
|
||||
url: http://localhost:8080
|
||||
url: "http://localhost:{{ item.port }}"
|
||||
dest: /tmp/podman-container-systemd/index.return.html
|
||||
loop: "{{ container_instances }}"
|
||||
register: get_url
|
||||
when: container_state == "running"
|
||||
|
||||
@@ -64,6 +73,9 @@
|
||||
- debug:
|
||||
msg:
|
||||
- "Got http://localhost:8080 to test if it worked!"
|
||||
- "This sould state 'file' on success: {{ get_url.state }}"
|
||||
- "This should state 'file' on success: {{ get_url.results[idx].state }}"
|
||||
- "On success, output should say 'Hello world!' here: {{ curl.stdout }}"
|
||||
loop: "{{ container_instances }}"
|
||||
loop_control:
|
||||
index_var: idx
|
||||
when: container_state == "running"
|
||||
|
||||
Reference in New Issue
Block a user