Skip to content

Latest commit

 

History

History
82 lines (65 loc) · 1.53 KB

README.adoc

File metadata and controls

82 lines (65 loc) · 1.53 KB

Overview - resource_hub

A simple flask application offering a static, and dynamic, website and API originally designed for use in Ansible Automation scenarios.

Tested with local sqlite and preferred postgres as backing store

landing page
Figure 1. Screenshot with default data set

Setup

It is strongly recommended to run this in a Python virtual environment and a requirements.txt is supplied.

python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Usage

Preload sample dataset

A simple sample dataset is provided, Ansible related books and resources

  • resources.py - Python dictionary defining resources

  • config.py - Loads resources into database of choice

    python config.py
Launch resource_hub
export FLASK_APP=app
export FLASK_ENV=development    # Turn on debugging (not necessary when app.run(debug=True))

flask run

Testing the API

  • Simple Ping

    curl <host>:<port>/api/v1/ping -s
    "{ ping: \"alive\" }"
  • Call the resources API

    curl localhost:5000/api/v1/resources -s
    [
      {
        "author": "That Jeff Geerlinguy",
        "description": "Classic introduction to Ansible",
        "id": 1,
        "name": "Ansible for DevOps",
        "source": "Book",
        "url": "https://leanpub.com/ansible-for-devops"
      },
      {
        "author": "James Freeman, Jesse Keating",
        "description": "Explores how Ansible works",