{"id":13501087,"url":"https://github.com/davidhalter/pysible","last_synced_at":"2025-04-09T11:25:02.278Z","repository":{"id":66038808,"uuid":"80549617","full_name":"davidhalter/pysible","owner":"davidhalter","description":"Beautiful Pythonic Ansible","archived":false,"fork":false,"pushed_at":"2017-01-31T18:40:54.000Z","size":2,"stargazers_count":8,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-15T05:24:55.376Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/davidhalter.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}},"created_at":"2017-01-31T18:37:21.000Z","updated_at":"2023-09-08T17:20:13.000Z","dependencies_parsed_at":"2023-03-18T07:30:33.589Z","dependency_job_id":null,"html_url":"https://github.com/davidhalter/pysible","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/davidhalter%2Fpysible","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidhalter%2Fpysible/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidhalter%2Fpysible/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidhalter%2Fpysible/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidhalter","download_url":"https://codeload.github.com/davidhalter/pysible/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248029118,"owners_count":21035938,"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":[],"created_at":"2024-07-31T22:01:25.152Z","updated_at":"2025-04-09T11:25:02.257Z","avatar_url":"https://github.com/davidhalter.png","language":null,"funding_links":[],"categories":["Others"],"sub_categories":[],"readme":"Beautiful Pythonic Ansible (RFC)\n================================\n\nAnsible's declarative style makes it very easy to do configuration management.\nWhile the idea of ansible is a pretty good one, its YAML playbooks often\nconfuse people. With the addition of blocks in Ansible 5.3, Ansible is looking\nmore and more like a programming language.\n\nHowever, readability is key and Ansible sometimes fails to deliver the user\nexperience you would like to. Imagine a much simpler workflow. Instead of:\n\n.. code-block:: yaml\n\n    - name: Clone git repositories\n      git: repo={{ item.repo }}\n           dest={{ item.path }}\n           clone=yes\n           update=yes\n      register: repository_update\n      with_items:\n        - { repo: \"{{ repo1 }}\", path: \"/foo\" }\n        - { repo: \"{{ repo2 }}\", path: \"/bar\" }\n\n    - name: Next task\n\nyou could just write:\n\n.. code-block:: yaml\n\n    from pysible.modules import git\n\n    # Clone git repositories\n    for repo, dest in [(REPO, '/foo'), (REPO2, '/bar')]:\n        last_update = git(repo=REPO, dest=REPO, clone=True, update=True)\n    \n    # Next task\n\n\nThis allows for a lot more flexibility. Instead of includes you use simple\nfunctions and instead of roles... Well don't even get me started on that. I\nthink that instead of using a pseudo language in YAML, using Python has the\nadvantage of clean proper coding with all the advantages a language like Python\ncomes in. Additionally we don't really have to give up Ansible features. We can\nuse handlers, includes and modules like before. Just with a slightly different\nAPI.\n\nIt would be a brave new world, but finally there would be beautiful deployment\ncode!\n\nRunning would be as simple as running Ansible. A simple command `pysible\n\u003cplaybook\u003e -i \u003chosts-file\u003e` would be enough to trigger execution on a few\nhosts.  This command would ensure that host files could still be used\n(including host/group variables).\n\n\nImplementation\n--------------\n\nAt the moment there is a proof of concept that I won't publish, yet. However if\nyou would like to see this, start a conversation in the issue tracker or star\nthe repository.\n\nThe current implementation is merely 30 lines long, because I'm using ansible's\ninternal APIs. I'm thinking about publishing this tool.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidhalter%2Fpysible","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidhalter%2Fpysible","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidhalter%2Fpysible/lists"}