Code Monkey home page Code Monkey logo

ansible-locate's Introduction

Ansible Locate (for Collection Content)

This is a tool which will walk around the YAML files in your playbook project and then suggest where to get that content from collections.

ansible-locate install.yml

Will just print stuff. This may give you enough information to ansible-galaxy collection install the collections needed for the install.yml playbook to run. That comes with a few qualifiers about pathing issues.

Having the collections alone is not enough, you also need to change the task names. In the narrow case of roles, there is another option to add a meta/routing.yml file to point to the new location.

This tool will fill those in by doing:

ansible-locate install.yml --write-meta

Adding routing stuff will become a little obsolete if the general tombstoning and routing pull request is merged. However, it can still help to have so that Ansible 2.9 will pull content from your collections. Also, there is still the problem of knowing what to install for legacy Ansible stuff, which this can still be useful for.

Demo

Some specifics may be removed here, as non-public content

$ ansible-locate ~/Documents/repos/engineering/do_stuff.yml
Locked and loaded with 3752 module redirects

Inspecting playbook /Users/alancoding/Documents/repos/ansible-engineering/build_awx_production_images.yml
   roles/create_ec2_instances/tasks/main.yml: ec2 --> amazon.aws.ec2
   roles/access/tasks/main.yml: authorized_key --> ansible.posix.authorized_key
   roles/build_official_image/tasks/main.yml: docker_login --> community.general.docker_login
   roles/prepare-workspace/tasks/main.yaml: synchronize --> ansible.posix.synchronize

Pathing Behavior

This is intended to be project based not runtime based.

You might put roles into all kinds of places on your computer, and then add them to search paths by ansible.cfg, environment variables, or heck, even collections.

This tool will not follow those. It just looks in the roles directory relative to the location it was given.

Known Issues

If you use the slurp module, this tool will think it belongs in the windows collection. It does not. From IRC:

slurp is 'special case' and probably should be removed from routing, some windows modules are 'attached' to their posix counterparts, slurp, fetch, setup ...

So this is left broken for now, anticipating further churn. You may need to manually remove these entries.

ansible-locate's People

Contributors

alancoding avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.