DevOps Classroom notes 13/Jun/2026

game website playbook for ubuntu:

---
- name: demo
  become: yes
  hosts: localhost
  tasks:
    - name: Install apache httpd (state=present is optional)
      ansible.builtin.apt:
        name: apache2
        update_cache: yes
        state: present

    - name: restart service apcahe
      ansible.builtin.systemd_service:
        name: apache2
        enabled: yes
        state: restarted

    - name: Install unzip
      ansible.builtin.apt:
        name: unzip
        state: present

    - name: Download gaming html
      ansible.builtin.get_url:
        url: https://templatemo.com/tm-zip-files-2020/templatemo_589_lugx_gaming.zip
        dest: /tmp/templatemo_589_lugx_gaming.zip
        mode: '0755'

    - name: unzip templated in apache2 html
      ansible.builtin.unarchive:
        src: /tmp/templatemo_589_lugx_gaming.zip
        dest: /tmp/
        remote_src: yes

    - name: copy files
      ansible.builtin.copy:
        src: /tmp/templatemo_589_lugx_gaming/
        dest: /var/www/html/
        remote_src: yes
        owner: www-data
        group: www-data
        mode: '0755'

    - name: restart service apcahe
      ansible.builtin.systemd_service:
        name: apache2
        enabled: yes
        state: restarted

Game website playbook fro Redhat server:

---
- name: demo
  become: yes
  hosts: all
  tasks:
    - name: Install the latest version of Apache
      ansible.builtin.dnf:
        name: httpd
        state: latest

    - name: restart service apcahe
      ansible.builtin.systemd_service:
        name: httpd
        enabled: yes
        state: restarted
    
    - name: Install unzip
      ansible.builtin.dnf:
        name: unzip
        state: present

    - name: Download gaming html
      ansible.builtin.get_url:
        url: https://templatemo.com/tm-zip-files-2020/templatemo_589_lugx_gaming.zip
        dest: /tmp/templatemo_589_lugx_gaming.zip
        mode: '0755'

    - name: unzip templated in apache2 html
      ansible.builtin.unarchive:
        src: /tmp/templatemo_589_lugx_gaming.zip
        dest: /tmp/
        remote_src: yes

    - name: copy files
      ansible.builtin.copy:
        src: /tmp/templatemo_589_lugx_gaming/
        dest: /var/www/html/
        remote_src: yes
        owner: apache
        group: apache
        mode: '0755'

    - name: restart service apcahe
      ansible.builtin.systemd_service:
        name: httpd
        enabled: yes
        state: restarted

Running the Playbook

ansible-playbook -i hosts apache.yaml

Leave a comment

Turn on JavaScript to leave a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company
Exit mobile version
%%footer%%