| 1 |
--- |
| 2 |
- name: Test podman rootful pod play |
| 3 |
block: |
| 4 |
|
| 5 |
- name: Create networks |
| 6 |
containers.podman.podman_network: |
| 7 |
executable: "{{ test_executable | default('podman') }}" |
| 8 |
name: "{{ item }}" |
| 9 |
state: present |
| 10 |
loop: |
| 11 |
- testnet1 |
| 12 |
- testnet2 |
| 13 |
|
| 14 |
- name: Create container with parameters |
| 15 |
register: continfo |
| 16 |
containers.podman.podman_containers: |
| 17 |
containers: |
| 18 |
- name: cont1 |
| 19 |
executable: "{{ test_executable | default('podman') }}" |
| 20 |
image: docker.io/alpine:3.7 |
| 21 |
state: started |
| 22 |
command: sleep 1d |
| 23 |
debug: true |
| 24 |
network: testnet1 |
| 25 |
add_hosts: |
| 26 |
host1: 127.0.0.1 |
| 27 |
host2: 127.0.0.1 |
| 28 |
annotation: |
| 29 |
this: "annotation_value" |
| 30 |
dns_servers: |
| 31 |
- 1.1.1.1 |
| 32 |
- 8.8.4.4 |
| 33 |
dns_search_domains: example.com |
| 34 |
capabilities: |
| 35 |
- SYS_TIME |
| 36 |
- NET_ADMIN |
| 37 |
ports: |
| 38 |
- "9000:80" |
| 39 |
- "9001:8000" |
| 40 |
workdir: "/bin" |
| 41 |
env: |
| 42 |
FOO: bar=1 |
| 43 |
BAR: foo |
| 44 |
TEST: 1 |
| 45 |
BOOL: false |
| 46 |
label: |
| 47 |
somelabel: labelvalue |
| 48 |
otheralbe: othervalue |
| 49 |
volumes: |
| 50 |
- /tmp:/data |
| 51 |
interactive: true |
| 52 |
- name: cont2 |
| 53 |
executable: "{{ test_executable | default('podman') }}" |
| 54 |
image: docker.io/alpine:3.7 |
| 55 |
state: started |
| 56 |
command: sleep 1d |
| 57 |
recreate: true |
| 58 |
network: |
| 59 |
- testnet2 |
| 60 |
- testnet1 |
| 61 |
etc_hosts: |
| 62 |
host1: 127.0.0.1 |
| 63 |
host2: 127.0.0.1 |
| 64 |
annotation: |
| 65 |
this: "annotation_value" |
| 66 |
dns_servers: |
| 67 |
- 1.1.1.1 |
| 68 |
- 8.8.4.4 |
| 69 |
dns_search_domains: example.com |
| 70 |
capabilities: |
| 71 |
- SYS_TIME |
| 72 |
- NET_ADMIN |
| 73 |
ports: |
| 74 |
- "9002:80" |
| 75 |
- "9003:8000" |
| 76 |
workdir: "/bin" |
| 77 |
env: |
| 78 |
FOO: bar=1 |
| 79 |
BAR: foo |
| 80 |
TEST: 1 |
| 81 |
BOOL: false |
| 82 |
label: |
| 83 |
somelabel: labelvalue |
| 84 |
otheralbe: othervalue |
| 85 |
volumes: |
| 86 |
- /tmp:/data |
| 87 |
interactive: false |
| 88 |
|
| 89 |
- name: Check multiple root containers |
| 90 |
assert: |
| 91 |
that: |
| 92 |
- continfo.containers[0]['NetworkSettings']['Networks'].keys() | list == ['testnet1'] |
| 93 |
- continfo.containers[1]['NetworkSettings']['Networks'].keys() | list == ['testnet1', 'testnet2'] or |
| 94 |
continfo.containers[1]['NetworkSettings']['Networks'].keys() | list == ['testnet2', 'testnet1'] |
| 95 |
|
| 96 |
always: |
| 97 |
|
| 98 |
- name: Delete all containers leftovers from tests |
| 99 |
containers.podman.podman_container: |
| 100 |
executable: "{{ test_executable | default('podman') }}" |
| 101 |
name: "{{ item }}" |
| 102 |
state: absent |
| 103 |
loop: |
| 104 |
- cont1 |
| 105 |
- cont2 |
| 106 |
- cont3 |
| 107 |
|
| 108 |
- name: Delete all networks leftovers from tests |
| 109 |
containers.podman.podman_network: |
| 110 |
executable: "{{ test_executable | default('podman') }}" |
| 111 |
name: "{{ item }}" |
| 112 |
state: absent |
| 113 |
loop: |
| 114 |
- testnet1 |
| 115 |
- testnet2 |