Playbook #1

/root/kubeinit/ci/builds/6mbKNrxD/0/kubeinit/kubeinit/kubeinit-aux/kubeinit/playbook.yml

Report Status CLI Date Duration Controller User Versions Hosts Plays Tasks Results Files Records
27 Oct 2023 17:25:14 +0000 00:14:23.04 nyctea root Ansible 2.15.2 ara 1.6.1 (client), 1.6.1 (server) Python 3.11.4 5 9 708 708 43 1

File: /root/.ansible/collections/ansible_collections/kubeinit/kubeinit/roles/kubeinit_apache/tasks/main.yml

---
# Copyright kubeinit contributors
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

- name: Install buildah if required
  ansible.builtin.package:
    state: present
    name: "buildah"

- name: Create a new working container image
  ansible.builtin.command: buildah from --name {{ kubeinit_cluster_name }}-apache quay.io/kubeinit/httpd:2.4
  register: _result
  changed_when: "_result.rc == 0"

- name: Update the container
  ansible.builtin.command: buildah run {{ kubeinit_cluster_name }}-apache -- apt-get -y update
  register: _result
  changed_when: "_result.rc == 0"

- name: Replace port 80 with 8080
  ansible.builtin.command: buildah run {{ kubeinit_cluster_name }}-apache -- sed -i -e 's/^Listen 80$/Listen 8080/' /usr/local/apache2/conf/httpd.conf
  register: _result
  changed_when: "_result.rc == 0"

- name: Create link to kubeinit folder
  ansible.builtin.command: buildah run {{ kubeinit_cluster_name }}-apache -- ln -s /var/kubeinit/html/ /usr/local/apache2/htdocs/kubeinit
  register: _result
  changed_when: "_result.rc == 0"

- name: Set kubeinit-cluster-name label
  ansible.builtin.command: buildah config --label kubeinit-cluster-name={{ kubeinit_cluster_name }} {{ kubeinit_cluster_name }}-apache
  register: _result
  changed_when: "_result.rc == 0"

- name: Commit the container image
  ansible.builtin.command: buildah commit {{ kubeinit_cluster_name }}-apache kubeinit/{{ kubeinit_cluster_name }}-apache:latest
  register: _result
  changed_when: "_result.rc == 0"

- name: Remove the buildah container
  ansible.builtin.command: buildah rm {{ kubeinit_cluster_name }}-apache
  register: _result
  changed_when: "_result.rc == 0"

- name: Create a podman container to serve the Apache server
  containers.podman.podman_container:
    name: "{{ kubeinit_apache_service_name }}"
    image: kubeinit/{{ kubeinit_cluster_name }}-apache:latest
    state: stopped
    pod: "{{ kubeinit_deployment_pod_name }}"
    volumes:
      - "{{ kubeinit_services_data_volume }}:/var/kubeinit/:Z"
  register: _result_container_info

- name: Create systemd service for podman container
  ansible.builtin.include_role:
    name: kubeinit.kubeinit.kubeinit_services
    tasks_from: create_managed_service.yml
    public: true
  vars:
    _param_service_user_dir: "{{ kubeinit_service_user_dir }}"
    _param_service_user: "{{ kubeinit_service_user }}"
    _param_systemd_service_name: "{{ kubeinit_apache_service_name }}"
    _param_podman_container_name: "{{ _result_container_info.container.Name }}"
    _param_podman_container_pidfile: "{{ _result_container_info.container.ConmonPidFile }}"

- name: Clear temp facts
  ansible.builtin.set_fact:
    _result_container_info: null