Create beautiful status pages directly from Ansible
First, create your ansible project folder
$ mkdir ~/my-status-page
$ cd ~/my-status-page
$ python3 -m venv venv
$ source venv/bin/activate
Install Ansible >= 3.0 and Flightdek
(venv)$ pip install ansible
(venv)$ ansible-galaxy collection install https://github.com/navad/flightdek
For example, using the following hosts file:
localhost ansible_connection=local
# playbook.yml
- name: Check machines
hosts: all
gather_facts: no
ignore_unreachable: yes
tasks:
- name: Ping machines
ansible.builtin.ping:
register: ping_res
- name: Add to dek
flightdek.core.add_item:
name: '{{ inventory_hostname }}'
group: Hosts
warn_when: '{{ ping_res.failed }}'
- name: Wrap up
hosts: localhost
post_tasks:
- name: Generate Report
run_once: yes
flightdek.core.render:
filename: status.html
title: My Status Page
register: report_output
- name: Open page
ansible.builtin.command: 'open {{ report_output.status_page_file }}'
(venv)$ ansible-playbook -i hosts playbook.yml
After the playbook finishes running, Flightdek's status page will be opened by the browser