From 5e74593f9f0f79c5597884d6a1a589da9a9a5e0b Mon Sep 17 00:00:00 2001 From: willtome Date: Fri, 11 Feb 2022 15:48:41 -0500 Subject: [PATCH] add podman --- collections/requirements.yml | 3 ++- linux/podman.yml | 50 ++++++++++++++++++++++++++++++++++++ linux/setup.yml | 21 +++++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 linux/podman.yml diff --git a/collections/requirements.yml b/collections/requirements.yml index e7ba2af..2a024e9 100644 --- a/collections/requirements.yml +++ b/collections/requirements.yml @@ -4,4 +4,5 @@ collections: - redhat_cop.controller_configuration #linux - redhat.insights - - community.general \ No newline at end of file + - community.general + - containers.podman \ No newline at end of file diff --git a/linux/podman.yml b/linux/podman.yml new file mode 100644 index 0000000..0464b01 --- /dev/null +++ b/linux/podman.yml @@ -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 }}" \ No newline at end of file diff --git a/linux/setup.yml b/linux/setup.yml index e36a60f..7ef7928 100644 --- a/linux/setup.yml +++ b/linux/setup.yml @@ -207,3 +207,24 @@ controller_templates: use_fact_cache: true credentials: - 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 \ No newline at end of file