{"id":13586040,"url":"https://github.com/AlanCoding/Ansible-inventory-file-examples","last_synced_at":"2025-04-07T14:33:13.942Z","repository":{"id":144899233,"uuid":"86067561","full_name":"AlanCoding/Ansible-inventory-file-examples","owner":"AlanCoding","description":"Examples and counter-examples of Ansible inventory files","archived":false,"fork":false,"pushed_at":"2023-10-26T13:05:21.000Z","size":389,"stargazers_count":38,"open_issues_count":0,"forks_count":22,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-29T20:06:36.734Z","etag":null,"topics":["ansible","ansible-inventory","awx","dynamic-inventory"],"latest_commit_sha":null,"homepage":null,"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/AlanCoding.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2017-03-24T12:50:47.000Z","updated_at":"2024-08-28T20:07:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"fb53315b-db28-4426-a9eb-c26f00ff178e","html_url":"https://github.com/AlanCoding/Ansible-inventory-file-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlanCoding%2FAnsible-inventory-file-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlanCoding%2FAnsible-inventory-file-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlanCoding%2FAnsible-inventory-file-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlanCoding%2FAnsible-inventory-file-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlanCoding","download_url":"https://codeload.github.com/AlanCoding/Ansible-inventory-file-examples/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247670328,"owners_count":20976545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-inventory","awx","dynamic-inventory"],"created_at":"2024-08-01T15:05:17.584Z","updated_at":"2025-04-07T14:33:13.582Z","avatar_url":"https://github.com/AlanCoding.png","language":"Python","readme":"# Ansible-inventory-file-examples\nExamples and counter-examples of Ansible inventory files\n\nGoals of these are mostly academic, to demonstrate a syntax, scaling pattern,\nor issue reproducer. None of these are designed to reflect best practices\nfor using Ansible.\n\nREADME files are given in many subdirectories.\n\nTop level is mostly organized by file type, with further subdivisions\nby topic. While this isn't always maintained, an attempt is made.\n\n#### Using these\n\nEverything is designed to be ran from the CLI from the root of the project\nroot. Aside from one folder for playbook, and other testing scripts,\neverything is an inventory file that goes in with the `-i` flag.\nThat means you should see `-i \u003crelative path in project\u003e`. There are\nmultiple testing commands you can use on any given inventory file.\n\n```\n# run the absolute minimal playbook\nansible-playbook -i top_level_file.ini debugging/hello_world.yml\n# print the hostvars for all the hosts\nansible-playbook -i top_level_file.ini debugging/hostvars_print.yml\n# dump standard representation of the inventory contents\nansible-inventory -i top_level_file.ini --list --export\n```\n\n#### Quick and dirty performance profiling\n\nReference for doing the cProfile stuff\n\nhttps://github.com/ansible/ansible/pull/13673\n\n```bash\npip install pyprof2calltree\n```\n\n```bash\npython -m cProfile -o outme $(which ansible-playbook) -i \u003crel_path\u003e debugging/hello_world.yml\npyprof2calltree -i outme\nqcachegrind outme.log\n```\n\n### Commands from the root of project\n\n#### Ansible config file example\n\nInventory plugin path via magic `inventory_plugins` dir:\n\n```\nansible-inventory -i plugins/config_path/same_dir/cow.yaml --playbook-dir=plugins/config_path/same_dir --list\n```\n\nInventory plugin path via child directories:\n\n```\nansible-inventory -i plugins/config_path/sub_dir/cow.yaml --playbook-dir=plugins/config_path/sub_dir --list\n```\n\nInventory plugin path via relative directory and using parent directories:\n\n```\nansible-inventory -i plugins/config_path/inventory_dir/cow.yaml --playbook-dir=plugins/config_path/inventory_dir --list\n```\n\nAll of these work testing locally.\n\nDebugging process for the final example:\n\n```\nansible-inventory -i plugins/config_path/inventory_dir/cow.yaml --playbook-dir=plugins/config_path/other_dir --list\nansible-doc -t inventory -l --playbook-dir=plugins/config_path/inventory_dir\n\n```\n\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAlanCoding%2FAnsible-inventory-file-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAlanCoding%2FAnsible-inventory-file-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAlanCoding%2FAnsible-inventory-file-examples/lists"}