{"id":15673692,"url":"https://github.com/alancoding/ansible-locate","last_synced_at":"2025-03-30T05:44:09.033Z","repository":{"id":144899237,"uuid":"261862435","full_name":"AlanCoding/ansible-locate","owner":"AlanCoding","description":"Quickly slapped together script to help you migrate your Ansible content","archived":false,"fork":false,"pushed_at":"2020-05-28T15:11:33.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-05T08:09:02.572Z","etag":null,"topics":["ansible","ansible-collection","ansible-collections","ansible-role"],"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/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":"2020-05-06T19:44:07.000Z","updated_at":"2021-03-18T18:30:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"026d9439-28e2-4fdc-ac37-1cdd89677969","html_url":"https://github.com/AlanCoding/ansible-locate","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-locate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlanCoding%2Fansible-locate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlanCoding%2Fansible-locate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlanCoding%2Fansible-locate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlanCoding","download_url":"https://codeload.github.com/AlanCoding/ansible-locate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246281216,"owners_count":20752207,"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-collection","ansible-collections","ansible-role"],"created_at":"2024-10-03T15:41:46.981Z","updated_at":"2025-03-30T05:44:09.014Z","avatar_url":"https://github.com/AlanCoding.png","language":"Python","readme":"# Ansible Locate (for Collection Content)\n\nThis is a tool which will walk around the YAML files in your playbook project\nand then suggest where to get that content from collections.\n\n```\nansible-locate install.yml\n```\n\nWill just print stuff. This may give you enough information to\n`ansible-galaxy collection install` the collections needed for the `install.yml`\nplaybook to run. That comes with a few qualifiers about pathing issues.\n\nHaving the collections alone is not enough, you also need to change the\ntask names. In the narrow case of roles, there is another option to add\na meta/routing.yml file to point to the new location.\n\nThis tool will fill those in by doing:\n\n```\nansible-locate install.yml --write-meta\n```\n\nAdding routing stuff will become a little obsolete if the general\ntombstoning and routing pull request is merged. However, it _can_ still\nhelp to have so that Ansible 2.9 will pull content from your collections.\nAlso, there is still the problem of knowing _what_ to install for\nlegacy Ansible stuff, which this can still be useful for.\n\n#### Demo\n\nThis is not a great example, but it's a public repo...\n\n```\n$ ansible-locate ~/Documents/repos/jlaska-ansible-playbooks/\nLocked and loaded with 3752 module redirects\n\nInspecting playbooks\n skipping playbook /Users/alancoding/Documents/repos/jlaska-ansible-playbooks/custom_json_vars.yml\n skipping playbook /Users/alancoding/Documents/repos/jlaska-ansible-playbooks/vaulted_debug_hostvars.yml\n  playbook /Users/alancoding/Documents/repos/jlaska-ansible-playbooks/async_tasks.yml\n    async_status --\u003e ansible.windows.async_status\n skipping playbook /Users/alancoding/Documents/repos/jlaska-ansible-playbooks/vault.yml\n skipping playbook /Users/alancoding/Documents/repos/jlaska-ansible-playbooks/vaulted_ansible_env.yml\n  playbook /Users/alancoding/Documents/repos/jlaska-ansible-playbooks/tower_collection_smoke.yml\n    tower_job_launch --\u003e awx.awx.tower_job_launch\n    tower_job_list --\u003e awx.awx.tower_job_list\n\nInspecting role directories\n\nOverall routing:\n---\nasync_status: ansible.windows.async_status\ntower_job_launch: awx.awx.tower_job_launch\ntower_job_list: awx.awx.tower_job_list\n\n\nThe collections/requirements.yml file you would need:\n---\ncollections:\n  - awx.awx\n  - ansible.windows\n```\n\nAnother public example:\n\n```\n$ ansible-locate ~/Documents/repos/utility-playbooks/\nLocked and loaded with 3752 module redirects\n\nInspecting playbooks\n  playbook /Users/alancoding/Documents/repos/utility-playbooks/tower_module.yml\n    tower_organization --\u003e awx.awx.tower_organization\n skipping playbook /Users/alancoding/Documents/repos/utility-playbooks/contradict.yaml\n  playbook /Users/alancoding/Documents/repos/utility-playbooks/cloud_module_testing.yml\n    ec2 --\u003e amazon.aws.ec2\n    os_server --\u003e openstack.cloud.os_server\n    vmware_guest --\u003e community.vmware.vmware_guest\n    ovirt_auth --\u003e ovirt.ovirt.ovirt_auth\n    tower_inventory --\u003e awx.awx.tower_inventory\n  playbook /Users/alancoding/Documents/repos/utility-playbooks/gce_lookup.yaml\n    gcp_compute_disk --\u003e google.cloud.gcp_compute_disk\n  playbook /Users/alancoding/Documents/repos/utility-playbooks/tower_module_chris.yml\n    tower_organization --\u003e awx.awx.tower_organization\n  playbook /Users/alancoding/Documents/repos/utility-playbooks/tower_module_ct.yml\n    tower_credential_type --\u003e awx.awx.tower_credential_type\n\nInspecting role directories\n  roles/awx-collection-publisher/tasks/main.yml\n    tower_organization --\u003e awx.awx.tower_organization\n    tower_project --\u003e awx.awx.tower_project\n    tower_inventory --\u003e awx.awx.tower_inventory\n    tower_host --\u003e awx.awx.tower_host\n    tower_credential_type --\u003e awx.awx.tower_credential_type\n    tower_job_template --\u003e awx.awx.tower_job_template\n\nOverall routing:\n---\nec2: amazon.aws.ec2\ngcp_compute_disk: google.cloud.gcp_compute_disk\nos_server: openstack.cloud.os_server\novirt_auth: ovirt.ovirt.ovirt_auth\ntower_credential_type: awx.awx.tower_credential_type\ntower_host: awx.awx.tower_host\ntower_inventory: awx.awx.tower_inventory\ntower_job_template: awx.awx.tower_job_template\ntower_organization: awx.awx.tower_organization\ntower_project: awx.awx.tower_project\nvmware_guest: community.vmware.vmware_guest\n\n\nThe collections/requirements.yml file you would need:\n---\ncollections:\n  - openstack.cloud\n  - awx.awx\n  - community.vmware\n  - ovirt.ovirt\n  - amazon.aws\n  - google.cloud\n```\n\n#### Pathing Behavior\n\nThis is intended to be _project based_ not _runtime based_.\n\nYou might put roles into all kinds of places on your computer, and then\nadd them to search paths by `ansible.cfg`, environment variables, or heck,\neven collections.\n\nThis tool will not follow those. It just looks in the `roles` directory\nrelative to the location it was given.\n\n#### Known Issues\n\nIf you use the `slurp` module, this tool will think it belongs in the\nwindows collection. It does not. From IRC:\n\n\u003e slurp is 'special case' and probably should be removed from routing,\n\u003e some windows modules are 'attached' to their posix counterparts, slurp, fetch, setup ...\n\nSo this is left broken for now, anticipating further churn.\nYou may need to manually remove these entries.\n\n### Similar things\n\nLookup FQCN of plugins from Playbooks or task files, and print their FQCN from routing.yml\nhttps://gist.github.com/sivel/73a071faa7b37a851437a026aa94f7da\n\nScript to rewrite an Ansible playbook or tasks file to use plugin FQCN\nhttps://gist.github.com/sivel/1f850b7f577b9dc9466293034c82b19d\n\nMake a disposition CSV for ansible content\nhttps://gist.github.com/cidrblock/40a540c54abb6f8767f7da7a85c84a94\n\nhttps://github.com/ansible-network/collection_prep\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falancoding%2Fansible-locate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falancoding%2Fansible-locate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falancoding%2Fansible-locate/lists"}