{"id":16897780,"url":"https://github.com/cevich/crap","last_synced_at":"2026-04-15T13:31:03.585Z","repository":{"id":79003387,"uuid":"103532560","full_name":"cevich/crap","owner":"cevich","description":"Crap is a Really Awesome Playbook","archived":false,"fork":false,"pushed_at":"2018-04-16T16:52:36.000Z","size":3503,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-20T11:21:42.902Z","etag":null,"topics":["amazon-web-services","ansible","bash","cloud","docker","openstack","playbook","python","script"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cevich.png","metadata":{"files":{"readme":"README.rst","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-09-14T12:59:25.000Z","updated_at":"2018-03-21T16:49:13.000Z","dependencies_parsed_at":"2023-03-06T01:30:33.231Z","dependency_job_id":null,"html_url":"https://github.com/cevich/crap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cevich/crap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cevich%2Fcrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cevich%2Fcrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cevich%2Fcrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cevich%2Fcrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cevich","download_url":"https://codeload.github.com/cevich/crap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cevich%2Fcrap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31842825,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T13:28:40.153Z","status":"ssl_error","status_checked_at":"2026-04-15T13:28:29.396Z","response_time":63,"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":["amazon-web-services","ansible","bash","cloud","docker","openstack","playbook","python","script"],"created_at":"2024-10-13T17:39:46.819Z","updated_at":"2026-04-15T13:31:03.551Z","avatar_url":"https://github.com/cevich.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"==========================================\nCRAP: It's crass, ridiculous, and profound\n==========================================\n\nC'mon, it's an open-source project, you weren't looking for documentation were you?\n\nThis repo. contains a starting-point for learning the power of the force^H^H^H^HAnsible.\n\nIt was created for a workshop targed at Red Hat Quality-assurance engineering. `The\nslide-deck \u003chttps://github.com/cevich/crap/raw/master/CRAP.pdf\u003e`_ is intended for\nthose already moderately familiar with Ansible.  Otherwise if you're\na total noob, the following minimum prerequisites are recommended:\n\n*  Watch from 3:24 - 10:33 - https://www.ansible.com/quick-start-video?wvideo=qrqfj371b6\n*  Grok - http://docs.ansible.com/ansible/latest/playbooks_reuse_roles.html\n*  Skim - http://docs.ansible.com/ansible/latest/playbooks_variables.html#variables\n*  Skim - http://docs.ansible.com/ansible/latest/playbooks_templating.html#templating-jinja2\n\nNote:\n    If you wish to actually understand most of the crap here, you'll probably want\n    to grok all of those instead of skim.  Beyond that, playtime will be the best\n    teacher:  Attempt the exercises at the end of\n    `the slides \u003chttps://github.com/cevich/crap/raw/master/CRAP.pdf\u003e`_.\n\n-------------\nOverview\n-------------\n\nWith the above committed to memory, and an understanding that playbooks and\ninventory are the primary *inputs*. You'll understand the included roles and\nexample playbook interactions with inventory state.  These are the most important\nconcepts:\n\n* ``inventory/invcache.py`` - Simple script that manages **a** static inventory state.\n  Does not preclude or assume existence of any other inventory files or scripts.\n  Does not interfere or modify any other inventory state.  Properly handles\n  concurrent access with proper read/write locking.\n\n* ``action_plugins/ic_{add,delete,update,reset}.py`` - Ansible modules that allow safe,\n  **declarative** specification of inventory state (by ``invcache.py``).\n  Usage is optional, but required to support the next two items.\n\n* ``*bin/*`` - Any simple executables/scripts that provision and/or teardown\n  playbook subject hosts.  The only requirement is they emit a ``JSON`` dictionary\n  on stdout, containing Ansible variables for the host (e.g. ``ansible_connection``,\n  ``ansible_host``, etc.).\n\n* ``inventory/*`` - Static inventory entries which specify any of four optional facts\n  (directly, or by group-membership) for a subject host:\n\n    * ``creation_command``: Input parameters to the Ansible ``shell`` module.  Target\n      command is expected to support the ``*bin/*`` interface - item above.\n\n    * ``destruction_command``: Same as the above, opposite in purpose.\n\n    * ``creation_destruction_environment``: Optional map of environment variables to set for\n      the above two items (optional).\n\n    * ``creation_destruction_asserts``: Optional list of Ansible assertion strings, to\n      help verify all the above adhere to explicit expectations.\n\n\n------------------\nFunctional Basics\n------------------\n\nActing on the four variables mentioned above, several roles are needed to support\nthe two most common \"styles\" of subject host management:\n\n* **Singular**:  The simplest, \"run a command, get a host\".  For example, ``qemu-kvm``.\n  This style cooresponds to the ``created`` and ``destroyed`` roles.\n\n* **Plural**: Basically a repeated application of **singular**, \"run a command, get a list of\n  hosts\".  For example ``linchpin up`` (http://linchpin.readthedocs.io/en/develop/index.html).\n  The ``collective_created`` and ``collective_destroyed`` roles support this style.\n\n-----------------\nPlay Requirements\n-----------------\n\nThis one's easy.  Any inventory and host declarations must be separate from other\nsubject plays.  For example, see the two plays in the ``creation.yml`` playbook:\nThe first one establishes the inventory, second one starts managing the hosts.  Do\nnot cross those two streams, don't do it!\n\nExplanation:  It's bad to tangle the two, for (non-obvious) Ansible-implementation,\n\"gotcha\" reasons:\n\n* The ``add_host`` module cannot run in parallel across multiple hosts because of\n  a hack which allows it to behave impericly.  In other words, it's there to support\n  an **anti-pattern** of the normal declarative-style Ansible instructions.  It's evil,\n  don't use it!\n\n* Inventory, facts, and variables, 'conditions' and 'loops' are all tied-at-the-waste\n  to the complete set of a play's tasks.  This means if any of those change (internal)\n  state part-way through a play's tasks, you're likely trying to shoe-horn imperitive-style\n  programming, into Ansible's declarative syntax.  Ansible + Imperitives == Only Pain.\n\n\nCI Status: |ci_status|\n\n.. |ci_status| image:: https://travis-ci.org/cevich/crap.svg?branch=master\n               :target: https://travis-ci.org/cevich/crap\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcevich%2Fcrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcevich%2Fcrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcevich%2Fcrap/lists"}