Debian Codegraph @

ansible_collections/containers/podman/tests/integration/targets/podman_export/tasks/main.yml

raw
1 ---
2 - name: Test podman container export
3 block:
4 - name: Start container
5 containers.podman.podman_container:
6 executable: "{{ test_executable | default('podman') }}"
7 name: container
8 image: alpine:3.7
9 state: started
10 command: sleep 1d
11
12 - name: Export container
13 containers.podman.podman_export:
14 executable: "{{ test_executable | default('podman') }}"
15 container: container
16 dest: /tmp/container
17
18 - name: Check file
19 stat:
20 path: /tmp/container
21 register: img
22
23 - name: Check it's exported
24 assert:
25 that:
26 - img.stat.exists
27
28 - name: Import container
29 containers.podman.podman_import:
30 executable: "{{ test_executable | default('podman') }}"
31 src: /tmp/container
32 register: image
33
34 - name: Check it's imported
35 assert:
36 that:
37 - image is success
38
39 - name: Export container without force
40 containers.podman.podman_export:
41 executable: "{{ test_executable | default('podman') }}"
42 container: container
43 dest: /tmp/container
44 force: false
45 register: image2
46
47 - name: Check it's exported
48 assert:
49 that:
50 - image2 is success
51 - image2 is not changed
52
53 - name: Export container with force
54 containers.podman.podman_export:
55 executable: "{{ test_executable | default('podman') }}"
56 container: container
57 dest: /tmp/container
58 force: true
59 register: image3
60
61 - name: Check it's not exported
62 assert:
63 that:
64 - image3 is changed
65
66 always:
67 - name: Remove container
68 containers.podman.podman_container:
69 executable: "{{ test_executable | default('podman') }}"
70 name: container
71 state: absent
72
73 - name: Test podman volume export
74 block:
75 - name: Start container
76 containers.podman.podman_container:
77 executable: "{{ test_executable | default('podman') }}"
78 name: container
79 image: alpine:3.7
80 state: started
81 volume:
82 - "volume:/test"
83 command: sleep 1d
84
85 - name: Export volume
86 containers.podman.podman_export:
87 executable: "{{ test_executable | default('podman') }}"
88 volume: volume
89 dest: /tmp/volume
90
91 - name: Check file
92 stat:
93 path: /tmp/volume
94 register: vlm
95
96 - name: Check it's exported
97 assert:
98 that:
99 - vlm.stat.exists
100
101 - name: Import volume
102 containers.podman.podman_import:
103 executable: "{{ test_executable | default('podman') }}"
104 src: /tmp/volume
105 volume: "volume"
106 register: volume
107
108 - name: Check it's imported
109 assert:
110 that:
111 - volume is success
112
113 - name: Export volume without force
114 containers.podman.podman_export:
115 executable: "{{ test_executable | default('podman') }}"
116 volume: volume
117 dest: /tmp/volume
118 force: false
119 register: volume2
120
121 - name: Check it's exported
122 assert:
123 that:
124 - volume2 is success
125 - volume2 is not changed
126
127 - name: Export volume with force
128 containers.podman.podman_export:
129 executable: "{{ test_executable | default('podman') }}"
130 volume: volume
131 dest: /tmp/volume
132 force: true
133 register: volume3
134
135 - name: Check it's not exported
136 assert:
137 that:
138 - volume3 is changed
139
140 always:
141 - name: Remove container
142 containers.podman.podman_container:
143 executable: "{{ test_executable | default('podman') }}"
144 name: container
145 state: absent
146
147 - name: Remove volume
148 containers.podman.podman_volume:
149 executable: "{{ test_executable | default('podman') }}"
150 name: test_volume
151 state: absent