{"id":24453120,"url":"https://github.com/dignajar/ansible-discovery","last_synced_at":"2026-04-28T14:33:43.100Z","repository":{"id":147570390,"uuid":"59056517","full_name":"dignajar/ansible-discovery","owner":"dignajar","description":"Ansible discovery host and filter by operating system","archived":false,"fork":false,"pushed_at":"2016-05-18T15:41:26.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-01T14:36:56.742Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dignajar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2016-05-17T20:30:46.000Z","updated_at":"2018-09-30T10:11:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"14f3be4e-bc8f-47cb-b22b-1d0628938407","html_url":"https://github.com/dignajar/ansible-discovery","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dignajar/ansible-discovery","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dignajar%2Fansible-discovery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dignajar%2Fansible-discovery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dignajar%2Fansible-discovery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dignajar%2Fansible-discovery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dignajar","download_url":"https://codeload.github.com/dignajar/ansible-discovery/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dignajar%2Fansible-discovery/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32385147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T11:25:28.583Z","status":"ssl_error","status_checked_at":"2026-04-28T11:25:05.435Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":[],"created_at":"2025-01-21T01:18:36.782Z","updated_at":"2026-04-28T14:33:43.095Z","avatar_url":"https://github.com/dignajar.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ansible Discovery\nAnsible hosts discovery and filter by operating system.\n\n## How this works ?\nThe Ansible server has a web server and each client has a curl who make a request to the web server every day.\nThe server generate a JSON file for each request from clients and update the timestamp.\n\nJSON file for the hostname `client01`\n```\n{\n    \"hostname\":\"client01\",\n    \"os\":\"centos\",\n    \"time\":\"2016-05-18 14:30:00\"\n}\n```\n\nJSON file for the hostname `client02`\n```\n{\n    \"hostname\":\"client02\",\n    \"os\":\"ubuntu\",\n    \"time\":\"2016-05-18 15:30:00\"\n}\n```\n\nAfter the clients make the HTTP request, you can execute the `generate-host.py` file on the server and this script generate the host list for Ansible.\n\nAnsible host list `/etc/ansible/hosts`\n```\n[centos]\nclient01\n\n[ubuntu]\nclient02\n```\n\n## Ansible Client\nFor each client should create a cron task with the command curl to annunce to the Ansible web server.\n\nFor example, if your client is an Ubuntu Linux, you can create the next cron task.\n\n```\n* 19 * * * curl --silent http://ansible-server -X POST -d \"hostname=`hostname`\" -d \"os=Ubuntu\"\n```\n\nThis cron execute every day at 19:00hs, this make an HTTP request method POST, with the hostname and os, as variables.\n\n## Ansible Server\n\n### Web server\n- Web server root path: `/www/`\n- Web server root index: `/www/index.php`\n- Web server JSON file list: `/www/hosts/`\n\n### Cron to generate the /etc/ansible/hosts file\nThe script `generate-host.py` generate the file `/etc/ansible/hosts` for Ansible, the list of hosts are obtained from `/www/hosts/`, you can create a cron task to execute this script every day.\n\nFor example, the task for generate the file of host list is executed at 20:00hs, after the clients are announced.\n\n```\n* 20 * * * /usr/bin/python /root/generate-host.py\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdignajar%2Fansible-discovery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdignajar%2Fansible-discovery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdignajar%2Fansible-discovery/lists"}