File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ - hosts : localhost
3
+ become : yes
4
+ tasks :
5
+ - name : Install Podman if not present
6
+ apt :
7
+ name : podman
8
+ state : present
9
+ update_cache : yes
10
+
11
+ - name : Pull the latest OpenJDK image using Podman
12
+ ansible.builtin.command :
13
+ cmd : podman pull docker.io/library/openjdk:latest
14
+ register : podman_pull_result
15
+
16
+ - name : Ensure the image is pulled
17
+ debug :
18
+ msg : " Pulled image: {{ podman_pull_result.stdout }}"
19
+
20
+ - name : Run Java container with Podman and mount the test-code directory
21
+ ansible.builtin.command :
22
+ cmd : podman run -d --name java_test_container -v /home/user/test-code:/usr/src/myapp docker.io/library/openjdk:latest sleep infinity
23
+ register : podman_run_result
24
+
25
+ - name : Ensure the container is running
26
+ debug :
27
+ msg : " Container running: {{ podman_run_result.stdout }}"
28
+
29
+ - name : Display running Podman containers
30
+ ansible.builtin.command :
31
+ cmd : podman ps
32
+
You can’t perform that action at this time.
0 commit comments