alikins / static_galaxy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to host an ansible galaxy server as static content

Quickstart

git clone this repo somewhere, say /www/data/static_galaxy

$ cd /www/data
$ git clone git@github.com:alikins/static_galaxy.git

Point a web server to serve static content from /www/data/static_galaxy

For ex, for nginx, use conf/nginx/defaults.d/static_galaxy.conf, update the 'root' for location / ('/home/adrian/src/static_galaxy' by default, but for this example, change it to /var/www/static_galaxy/)

Cp that static_galaxy.conf to /etc/nginx/default.d/static_galaxy.conf

(Or wherever your nginx config lives...)

Restart nginx

$ sudo systemctl restart nginx   # or whatever your favorite boutique tool is

Configure ansible to point to the server (assuming localhost:80 here) and url prefix /api/automation-hub

ie, and ansible.cfg like:

[galaxy]
server_list = static

[galaxy_server.static]
url=http://localhost/api/automation-hub/

Then use ansible-galaxy to install stuff from this example static repo.

$ ansible-galaxy collection install alikins.collection_inspect

Ansible config

See conf/ansible.cfg for an example ansible.cfg.

nginx config

See conf/nginx/defaults/static_galaxy.conf for an example of a nginx config that turns a local dir /home/adrian/src/static_galaxy/ into a "server" usable by ansible-galaxy.

The only unusual part is making 'index.json' the default index file to search for.

Example nginx config:

location / {
    root   /www/data/static_galaxy/;
    index  index.json index.html;
}

error_page 404 /errors/404.json;
    location = /errors/40x.json {
}

error_page 500 502 503 504 /errors/50x.json;
    location = /errors/50x.json {
}

test / example script

See tests/test-ansible-galaxy.sh

File system layout

static_galaxy/
├── api
│   └── automation-hub
│       ├── index.json
│       └── v3
│           ├── artifacts
│           │   └── collections
│           │       ├── automation-hub
│           │       │   ├── alikins-collection_inspect-0.0.182.tar.gz
│           │       │   ├── alikins-collection_inspect-0.0.213.tar.gz
│           │       │   ├── alikins-collection_inspect-0.0.217.tar.gz
│           │       │   └── alikins-collection_ntp-0.1.182.tar.gz
│           │       └── staging
│           ├── collections
│           │   └── alikins
│           │       ├── collection_inspect
│           │       │   └── versions
│           │       │       ├── 0.0.213
│           │       │       │   └── index.json
│           │       │       ├── 0.0.217
│           │       │       │   └── index.json
│           │       │       └── index.json
│           │       └── collection_ntp
│           │           └── versions
│           │               ├── 0.1.182
│           │               │   └── index.json
│           │               └── index.json
│           └── index.json
├── content
│   ├── automation-hub
│   │   └── collections -> ../../api/automation-hub/v3/collections
│   ├── big_partner
│   └── staging
├── errors
│   ├── 404.json
│   └── 500.json

About


Languages

Language:Shell 100.0%