{"id":28920133,"url":"https://github.com/x86-39/ansible-http-server","last_synced_at":"2026-05-18T04:42:21.159Z","repository":{"id":238195148,"uuid":"796068441","full_name":"x86-39/ansible-http-server","owner":"x86-39","description":"This is a web server written in Ansible. Yes, WRITTEN IN Ansible. Not using an external web server.","archived":false,"fork":false,"pushed_at":"2024-05-06T15:03:23.000Z","size":3420,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-17T22:47:21.909Z","etag":null,"topics":["ansible","ansible-eda","ansible-playbook","eda","event-driven-ansible","http"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/x86-39.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-04T20:56:28.000Z","updated_at":"2025-06-05T08:05:14.000Z","dependencies_parsed_at":"2024-05-06T16:25:36.380Z","dependency_job_id":"d1ce419f-7a11-4bf3-bd13-7d38602663a1","html_url":"https://github.com/x86-39/ansible-http-server","commit_stats":null,"previous_names":["diademiemi/ansible_collection_diademiemi.http_server","diademiemi/ansible-http-server","x86-39/ansible-http-server","39services/ansible-http-server"],"tags_count":1,"template":false,"template_full_name":"x86-39/ansible_collection_x86_39.template","purl":"pkg:github/x86-39/ansible-http-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x86-39%2Fansible-http-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x86-39%2Fansible-http-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x86-39%2Fansible-http-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x86-39%2Fansible-http-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/x86-39","download_url":"https://codeload.github.com/x86-39/ansible-http-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x86-39%2Fansible-http-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32448883,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"ssl_error","status_checked_at":"2026-04-29T22:10:49.234Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-eda","ansible-playbook","eda","event-driven-ansible","http"],"created_at":"2025-06-22T04:12:10.111Z","updated_at":"2026-04-30T00:02:44.230Z","avatar_url":"https://github.com/x86-39.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ANSIBLE HTTP SERVER\nI LOVE Ansible. A little too much? A little too much.\nI wanted to see if I could serve HTTP requests with the new Event Driven Ansible.\nIs this a good idea? Hell no. But I did it anyway.\n\n![Ansible HTTP Server](./img/demo.gif)\n###### Ignore the error, that's that it can't find the favicon.ico file.\n\nThis is stupid... but it works-ish, kinda.\n\n## How to use\nThis definitely only works on Unix systems, not tested on Windows. Probably works in WSL. Why would you want to use this anyway? It's just a quirky experiment. Why are you seriously reading how to use this? You're never going to use this.\n\nSince it serves files from the current working directory, you should clone this repo and run it from there.\nIt also needs an inventory, which I've provided in this repository, but you can bring your own, only needs to have a `localhost` host. (I've only tested it with localhost, and if you're running this against a production host, you're doing it wrong)\n\nInstall the Galaxy requirements\n```bash\nansible-galaxy collection install .  # Or diademiemi.http_server if you're not in the repo\n```\n\nInstall Ansible Rulebook\n```bash\npip3 install ansible-rulebook\n\n# OR\npip3 install -r requirements.txt\n```\n\nRun the Rulebook\n```bash\nansible-rulebook -i inventories/local/hosts.yml -r diademiemi.http_server.http_server\n```\n\nYou've now got a web server running on port 8080. Go to `http://localhost:8080` to see it in action! It serves the `index.html` file (or any requested file) in the `files` directory of your current working directory.\n\n## How it works\n\nThis uses [Event Driven Ansible](https://www.ansible.com/blog/getting-started-with-event-driven-ansible/) to run a simple TCP socket server with a custom `event_source` plugin ([extensions/eda/plugins/event_source/tcp_server.py](extensions/eda/plugins/event_source/tcp_server.py)).This is called in the Rulebook ([extensions/eda/rulebooks/http_server.yml](extensions/eda/rulebooks/http_server.yml)). This plugin gets started through the Rulebook. When the Rulebook receives an event (A TCP connection from the plugin) it runs an Ansible Playbook.\n\nThe Ansible Playbook ([playbooks/response.yml](playbooks/response.yml)) receives the request and parses it, finds a file in the `files` directory, calls a Module ([plugins/modules/http_response.py](plugins/modules/http_response.py)) which receives a file descriptor over a Unix socket (`/tmp/ansible_http.sock`) (basically, gets the TCP socket to the client in place of the original process) and sends a response as defined in the Ansible Playbook.\n\nKeep in mind, this barely works and is held together with hopes and prayers. It was a fun experiment though.\n\n## Why this is funny\nIf you don't know Ansible, Ansible is a Configuration Management tool. You might think, that doesn't sound like a web server. You're right, it's not. But I made it one. Why? Because I can. And because I'm a little too obsessed with Ansible. Ansible is meant to configure remote hosts, and this new Event Driven Ansible framework is meant to react to outages and events in your infrastructure. But I made it serve HTTP requests. This is stupid.\nAnsible has an extensive plugin system, and I wanted to see how far I could push it. This is the result. Using the new event framework I could make a TCP server, and with a little bit of duct tape and a lot of hope, I made it serve HTTP requests.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx86-39%2Fansible-http-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fx86-39%2Fansible-http-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx86-39%2Fansible-http-server/lists"}