forked from ansible/product-demos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
podman.yml
55 lines (48 loc) · 1.29 KB
/
podman.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
- name: Podman
hosts: "{{ _hosts | default(omit) }}"
vars:
volume_path: podman
message: undef
tasks:
- name: Install Podman
ansible.builtin.dnf:
name: podman
state: installed
become: true
- name: Create volume dir
ansible.builtin.file:
path: "{{ volume_path }}"
state: directory
mode: "0775"
- name: Create index.html
ansible.builtin.copy:
dest: "{{ volume_path }}/index.html"
content: "{{ message }}"
mode: "0664"
- name: Run httpd container
containers.podman.podman_container:
name: apache
image: docker.io/httpd
state: started
volume:
- "./{{ volume_path }}/:/usr/local/apache2/htdocs:z"
ports:
- "8081:80"
- name: Check Web Page
ansible.builtin.uri:
url: http://127.0.0.1:8081
return_content: true
register: web_output
changed_when: false
- name: Podman ps
ansible.builtin.command: podman ps
register: podman_output
changed_when: false
- name: Output
ansible.builtin.debug:
msg:
- "Output of podman ps command:"
- "{{ podman_output.stdout_lines }}"
- "Contents of web page:"
- "{{ web_output.content }}"