57 lines
1.3 KiB
YAML
57 lines
1.3 KiB
YAML
---
|
|
# tasks file for web-browser
|
|
|
|
# Check if browser is installed
|
|
|
|
- name: Install browser
|
|
become: true
|
|
ansible.builtin.package:
|
|
name: firefox-esr
|
|
state: present # also we can use 'latest' to also update package
|
|
|
|
# Write it version in terminal during run of Ansible
|
|
|
|
- name: Gather the package facts
|
|
ansible.builtin.package_facts:
|
|
manager: auto
|
|
|
|
- name: Write browser version in terminal during run of Ansible
|
|
ansible.builtin.debug:
|
|
msg: "Firefox {{ ansible_facts.packages['firefox-esr'][0].version }} is installed!"
|
|
when: "'firefox-esr' in ansible_facts.packages"
|
|
|
|
|
|
# Install Caddy webserver (need to upload static file)
|
|
|
|
- name: Install Caddy
|
|
ansible.builtin.package:
|
|
name: caddy
|
|
state: latest
|
|
|
|
- name: Create Caddyfile
|
|
ansible.builtin.copy:
|
|
src: Caddyfile
|
|
dest: /etc/caddy/Caddyfile
|
|
owner: caddy
|
|
group: caddy
|
|
mode: '0644'
|
|
notify: restart Caddy service
|
|
|
|
# Generate webpage for Caddy based on a template and info from PC
|
|
|
|
- name: Create web directory
|
|
ansible.builtin.file:
|
|
path: /var/www/html
|
|
state: directory
|
|
|
|
|
|
- name: write index webpage using jinja2
|
|
ansible.builtin.template:
|
|
src: index.html.j2
|
|
dest: /var/www/html/index.html
|
|
owner: caddy
|
|
group: caddy
|
|
mode: '0644'
|
|
notify: restart Caddy service
|
|
# Restart Caddy webserver if we made any changes
|