{"id":16780315,"url":"https://github.com/ahelal/kitchen-ansiblepush","last_synced_at":"2025-04-07T12:10:20.857Z","repository":{"id":31970320,"uuid":"35540430","full_name":"ahelal/kitchen-ansiblepush","owner":"ahelal","description":"test-kitchen plugin to use ansible in push mode ","archived":false,"fork":false,"pushed_at":"2024-05-16T18:58:19.000Z","size":144,"stargazers_count":41,"open_issues_count":9,"forks_count":22,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-10-14T07:34:39.596Z","etag":null,"topics":["ansible","idempotency-test","infrastructure-as-code","infrastructure-testing","kitchen","testing"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ahelal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2015-05-13T09:35:33.000Z","updated_at":"2023-03-23T20:26:53.000Z","dependencies_parsed_at":"2024-06-19T13:20:35.560Z","dependency_job_id":"4381fa01-ca94-46e3-a754-6424b4c02c48","html_url":"https://github.com/ahelal/kitchen-ansiblepush","commit_stats":{"total_commits":187,"total_committers":17,"mean_commits":11.0,"dds":0.5935828877005347,"last_synced_commit":"3edd24fe762cc6c41a8c55ab7d668cd8cd901c5c"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahelal%2Fkitchen-ansiblepush","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahelal%2Fkitchen-ansiblepush/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahelal%2Fkitchen-ansiblepush/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahelal%2Fkitchen-ansiblepush/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahelal","download_url":"https://codeload.github.com/ahelal/kitchen-ansiblepush/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247648977,"owners_count":20972945,"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","idempotency-test","infrastructure-as-code","infrastructure-testing","kitchen","testing"],"created_at":"2024-10-13T07:34:46.074Z","updated_at":"2025-04-07T12:10:20.835Z","avatar_url":"https://github.com/ahelal.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kitchen-ansiblepush\n[![Gem Version](https://badge.fury.io/rb/kitchen-ansiblepush.svg)](https://badge.fury.io/rb/kitchen-ansiblepush)\n[![Gem Downloads](http://ruby-gem-downloads-badge.herokuapp.com/kitchen-ansiblepush?type=total\u0026color=brightgreen)](https://rubygems.org/gems/kitchen-ansiblepush)\n![Ruby](https://github.com/ahelal/kitchen-ansiblepush/workflows/Ruby/badge.svg?branch=master)\n\nA test-kitchen plugin that adds the support for ansible in push mode i.e. normal mode :)\n\n## Intro\nThis kitchen plugin adds ansible as a provisioner in push mode. Ansible will run from your host rather than run from guest instance(s). That also means your code will not be copied to guest.\n\nIt is designed to just simply work with minimum configuration. Just run as you would normaly do.\n\n## How to install\n\n### (1) Use Bundler\nMy preferred method is use Gemfile\n\n```ruby\nsource \"https://rubygems.org\"\ngroup :development do\n  gem 'test-kitchen'\n  gem 'kitchen-vagrant' # for example\n  gem 'kitchen-ansiblepush'\nend\n```\n\n### (2) Ruby gem\n```bash\ngem install kitchen-ansiblepush\n```\n\n### (3) Install from code\n```bash\ngit clone git@github.com:ahelal/kitchen-ansiblepush.git\ncd kitchen-ansiblepush\ngem build kitchen-ansiblepush.gemspec\ngem install kitchen-ansiblepush-\u003cversion\u003e.gem\n```\n\n## kitchen.yml Options\n```yaml\nprovisioner         :\n    ## required options\n    name                : ansible_push\n    playbook            : \"../../plays/web.yml\"     # Path to Play yaml\n    ##\n    ## Optional  argument\n    ansible_config      : \"/path/to/ansible/ansible.cfg\" # path to ansible config file\n    verbose             : \"vvvv\" # verbose level v, vv, vvv, vvvv\n    diff                : true  # print file diff\n    mygroup             : \"web\" # ansible group, or list of groups\n    raw_arguments       : \"--timeout=200\"\n    extra_vars          : \"@vars.yml\"\n    tags                : [ \"that\", \"this\" ]\n    skip_tags           : [ \"notme\", \"orme\" ]\n    start_at_task       : [ \"five\" ]\n    # Hash of other groups\n    groups              :\n         db             :\n            - db01\n    sudo                : true\n    sudo_user           : root\n    remote_user         : ubuntu\n    private_key         : \"/path..../id_rsa\"\n    ask_vault_pass      : true\n    vault_password_file : \"/..../file\"\n    host_key_checking   : false\n    generate_inv        : true\n    use_instance_name   : false  # use short (platform) instead of instance name by default\n    idempotency_test    : false\n\n    ## When running on EC2 with Windows and using get-password pass the password as ansible_password variable\n    pass_transport_password: false\n    ## (optional), if you want to set specific environment variables when running ansible\n    environment_vars:\n    \tPROXMOX_URL: https://example.com:8006\n```\n## Idempotency test\nIf you want to check your code is idempotent you can use the idempotency_test. Essentially, this will run Ansible twice and check nothing changed in the second run. If something changed it will list the tasks. Note: If your using Ansible callback in your config this might conflict.\n\n```yaml\n    idempotency_test: true\n    fail_non_idempotent: true\n```\n\nIf your running ansible V2 you need to white list the callback ```callback_whitelist = changes``` in **ansible.cfg**\nYou can also choose to not to fail if idempotency test fails.\n\n## Ansible version\n\nSince ansiblepush uses the host to run Ansible. you can simply specify the path of your ansible-playbook executable in your .kitchen.yml\n\n```yaml\nansible_playbook_bin : /path/to/ansible-playbook\n```\n\nIf you want any easy way to manage ansible version [AVM](https://github.com/ahelal/avm)\nFor further example you can check a matrix test [ansible-usermanage](https://github.com/AutomationWithAnsible/ansible-usermanage/blob/master/.kitchen.yml)\n\n## Disable chef installation\n\nBy default chef is installed and serverspec stuff. if you don't want to install\n\n```yaml\nchef_bootstrap_url: nil\n```\n\n## Instance name\n\nAnsible push generates inventory dynamically you have multiple options to name your instance\n\n* *use_instance_name* = false (default): \u003cplatform\u003e\n* *use_instance_name* = true: \u003cinstance_name\u003e-\u003cplatform\u003e\n* *custom_instance_name*: \u003ccustom_instance_name\u003e\n\n## Windows support\n\nKitchen ansiblepush has experimental support.\nto enable windows support you need to add the following to your *.kitchen.yml*\n\n```yaml\n...\ntransport:\n     name: winrm\n     winrm_transport: negotiate\nprovisioner:\n    name                  : ansible_push\n    chef_bootstrap_url    : nil\n    ansible_port          : 5586\n    ansible_connection    : \"winrm\"\n...\n```\n\n### Windows AWS EC2 support\n\nWhen running EC2 instance without password set via _get_password_ password can be passed from transport to Ansible command line as varaible:\n\n```yaml\nprovisioner:\n    name:                       ansible_push\n    pass_transport_password:    true\n```\n\n## Pattern of usage\n\nYou can use ansible push  with different pattern. I will list some of the ways that I use it, But by no means they are the only patterns.\n\n### Roles\n\nI define my Gemfile in the role. I then run ```bundle install``` and commit my *Gemfile.lock* I also ignore ```.kitchen```\n\nA typical structure of an ansible role\n\n```yaml\ndefaults\nhandlers\nmeta\ntasks\ntemplates\nvars\nGemfile\nGemfile.lock\n.gitingore\ntest\n    \\_ ansible.cfg\n    \\_ integration\n            \\_ server\n                \\_ server.yml   # my play that will test something\n                \\_ serverspec\n            \\_ worker\n                \\_ worker.yml # my play that will test something\n                \\_ serverspec\n\n```\n\n## Real example usages\n\n- https://github.com/ahelal/ansible-concourse\n- https://github.com/hellofresh/ansible-deployment\n- https://github.com/AutomationWithAnsible/ansible-usermanage\n- https://github.com/danrue/ansible-variables\n- https://github.com/knakayama/kitchen-ansiblepush-demo\n\n## TODO\n\n* Enable environment var ANSIBLE_CALLBACK_WHITELIST=\"changes\" before call\n* Tests (PRs for tests is highlight appreciated)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahelal%2Fkitchen-ansiblepush","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahelal%2Fkitchen-ansiblepush","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahelal%2Fkitchen-ansiblepush/lists"}