add podman

This commit is contained in:
willtome
2022-02-11 15:48:41 -05:00
parent aa0938b7ae
commit 5e74593f9f
3 changed files with 73 additions and 1 deletions

View File

@@ -4,4 +4,5 @@ collections:
- redhat_cop.controller_configuration - redhat_cop.controller_configuration
#linux #linux
- redhat.insights - redhat.insights
- community.general - community.general
- containers.podman

50
linux/podman.yml Normal file
View File

@@ -0,0 +1,50 @@
- name: Podman
hosts: "{{ HOSTS }}"
vars:
volume_path: /var/podman
message: undef
tasks:
- name: Install Podman
ansible.builtin.dnf:
name: podman
state: latest
become: true
- name: Create volume dir
ansible.builtin.file:
path: "{{ volume_path }}"
state: directory
- name: Create index.html
ansible.builtin.copy:
dest: "{{ volume_path }}/index.html"
content: "{{ message }}"
- name: Run httpd container
containers.podman.podman_container:
name: apache
image: docker.io/httpd
state: started
volume:
- "{{ volume_path }}:/usr/local/apache2/htdocs"
ports:
- "8080:80"
- name: Check Web Page
ansible.builtin.uri:
url: 127.0.0.1:8080
retun_content: yes
register: web_output
changed_when: false
- name: podman ps
shell: podman ps
register: podman_output
changed_when: false
- name: Output
ansible.builtin.debug:
msg:
- "{{ podman_output.stdout_lines }}"
- "{{ web_output.content }}"

View File

@@ -207,3 +207,24 @@ controller_templates:
use_fact_cache: true use_fact_cache: true
credentials: credentials:
- Workshop Credential - Workshop Credential
- name: "LINUX / Podman Webserver"
job_type: run
inventory: "Workshop Inventory"
project: "Ansible official demo project"
playbook: "linux/podman.yml"
execution_environment: Default execution environment
credentials:
- "Workshop Credential"
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: Server Name or Pattern
type: text
variable: HOSTS
required: true
- question_name: Web Page Message
type: textarea
variable: message
required: true