{"id":19687225,"url":"https://github.com/trinitronx/ansible-tdd","last_synced_at":"2025-04-29T07:34:18.825Z","repository":{"id":20171094,"uuid":"23441891","full_name":"trinitronx/ansible-tdd","owner":"trinitronx","description":"Ansible TDD examples","archived":false,"fork":false,"pushed_at":"2018-02-01T22:23:49.000Z","size":27,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-05T14:01:58.815Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/trinitronx.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}},"created_at":"2014-08-28T20:28:03.000Z","updated_at":"2020-06-23T20:23:49.000Z","dependencies_parsed_at":"2022-08-31T00:11:51.717Z","dependency_job_id":null,"html_url":"https://github.com/trinitronx/ansible-tdd","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/trinitronx%2Fansible-tdd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trinitronx%2Fansible-tdd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trinitronx%2Fansible-tdd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trinitronx%2Fansible-tdd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trinitronx","download_url":"https://codeload.github.com/trinitronx/ansible-tdd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251456073,"owners_count":21592290,"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-11-11T18:33:25.487Z","updated_at":"2025-04-29T07:34:13.817Z","avatar_url":"https://github.com/trinitronx.png","language":"Ruby","funding_links":["https://liberapay.com/trinitronx/donate"],"categories":[],"sub_categories":[],"readme":"Ansible TDD Research\n====================\n\u003cnoscript\u003e\u003ca href=\"https://liberapay.com/trinitronx/donate\"\u003e\u003cimg alt=\"Donate using Liberapay\" src=\"https://liberapay.com/assets/widgets/donate.svg\"\u003e\u003c/a\u003e\u003c/noscript\u003e\n\nThis repo contains some submodule repos \u0026 resources for Ansible TDD, BDD, XDD, and such.\nIt includes many examples given and sourced from these sources:\n\n - [Tighten Your Quality Feedback Loop][1]\n - [Infrastructure Testing with Ansible and Serverspec][2]\n - [kitchen-ansible Test Kitchen Provisioner][4]\n\nIf you are not familiar with [Test Kitchen][5], I suggest you view the quick [test-kitchen demo slideshow here][8].\nIf you have more time, you might want to also check out Fletcher Nichol's full [DevOps Days Presentation here][9].\n\nInstalling TDD Tools\n====================\n\n 1. Install [ChefDK][3] (Current version: 2.4.17)\n   - [Mac][chefdk-mac]\n   - [Ubuntu][chefdk-ubuntu]\n   - [Windows][chefdk-win]\n 2. Install [kitchen-ansible gem][4]\n   - If you have `rvm` installed, first: `rvm use system`\n   - With ChefDK \u003c 0.3.1:\n     - install to `/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/` with: `$(/opt/chefdk/bin/chef shell-init $(basename $SHELL)); sudo /opt/chefdk/embedded/bin/gem install kitchen-ansible`\n   - *OR* With ChefDK \u003e= 0.3.1:\n     - Install to `~/.chefdk/gem/ruby/2.1.0/gems/` with: `chef exec gem install kitchen-ansible`  (**Recommended**)\n     - Install to `/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/` with: `sudo chef gem install kitchen-ansible`  (**NOTE**: This will install to system ChefDK location!)\n 3. Install [VirtualBox][6] (Current version: 5.2.6)\n   - [Mac][vbox-mac]  (Install via `.dmg` or via [brew-cask][homebrew-cask]: `brew cask install virtualbox`)\n   - [Linux][vbox-lin]\n     - [Ubuntu x86_64 (14.04 Trusty LTS)][vbox-ubuntu-trusty]\n     - [Ubuntu x86_64 (16.04 Xenial LTS)][vbox-ubuntu-xenial]\n   - [Windows][vbox-win]\n 4. Install [Vagrant][7] (Current version: 2.0.2)\n   - [Mac][vagrant-mac]  (Install via `.dmg` or via [brew-cask][homebrew-cask]: `brew cask install vagrant`)\n   - [Ubuntu][vagrant-ubuntu]\n   - [Windows][vagrant-win]\n\nNow you're ready to use test-kitchen along with the [`kitchen-ansible`][4] Provisioner.\n\nRunning Test Kitchen \u0026 Serverspec Example\n=========================================\n\nThe ansible-examples repo contains a demo of using [`test-kitchen`][5] with ansible and the [`kitchen-ansible`][4] Provisioner.  To try it out:\n\n 1. Checkout submodule repos: `git submodule update --init`\n 2. `cd ansible-examples/tomcat-standalone`\n 3. Run Test Kitchen: `kitchen test`\n\nAnsible Guard Syntax Check Example\n==================================\n\nWhen developing playbooks and roles, it's helpful to have YAML syntax check (and of course `ansible-playbook --syntax-check`).  In this repo is an example `Guardfile` for using the [Guard Ruby gem][guard-gem] to do this automatically for you each time you edit a file!  Plus, it notifies you of results via a \"growl\" style notification (on Mac).  This should also work on Windows or Linux with the alternate gems listed in `Gemfile`, but this has not been tested for a while!.\n\nTo use this example, you first need Ruby \u003e= 2.3 or \u003e= 2.2.6.  I used Ruby 2.2.5 via [RVM][rvm].  You also need to install [`bundler`][bundler] (`gem install bundler`).\n\nOnce you have Ruby and `bundler`, all you need is:\n\n```\n# Make sure you are in this repo's directory!\n# cd path/to/ansible-tdd/\nbundle install\nbundle exec guard\n```\n\nNow, try editing a file to introduce a syntax error and Guard will notify you! (It also shows if syntax check result was success)\n\nFor example, this repo contains some roles under `roles/`.  Edit one of the tasks files to introduce an error.\n\nIf you are using an older version of Ansible, you may run into errors with playbooks that include encrypted Ansible Vault vars files!  The example `Guardfile` handles this gracefully, as long as you use a vault password file and follow the naming convention.\n\nIf you are using playbooks with Ansible Vault vars files, you need to place your Vault password files (just a text file containing the Ansible Vault encryption password) into `$HOME/secrets/`.\n\nThis example `Guardfile` has this path hardcoded, and uses a naming convention based on the playbook name!  If you want to modify this location, edit your `Guardfile` appropriately.\n\n## Encrypted Vars file Examples:\n\nFor a playbook with encrypted vars file, it might be using task: `- include_vars: path/to/your/encrypted-vars.yml`\n\nIf the playbook directory was named `foo-playbook`, place the Ansible Vault password file in this location:  `$HOME/secrets/ansible-vault-foo-playbook`\n\nThe reason this is necessary is because in older versions of Ansible, `ansible-playbook --syntax-check` will throw an error if the playbook cannot decrypt the Ansible vault vars file, and also if you try to use an undefined variable. To work around this, the example `Guardfile` checks for existence of a Vault password file in `~/secrets` that matches the playbook name.  If found, it passes this in to `ansible-playbook --syntax-check` via  `--vault-password-file=$HOME/secrets/ansible-vault-\u003cPLAYBOOK_NAME\u003e`.\n\nNew versions of Ansible will not have this problem in `--syntax-check` mode!\n\nThis repo contains an example playbook under `playbooks/wemux-vault/example.yml` that uses an encypted vars file.  The password to decrypt this is included in `playbooks/wemux-vault/ansible-vault-wemux-vault`.  Place this file at `$HOME/secrets/ansible-vault-wemux-vault` to fix any Guard errors.  The included `Guardfile` will see you have placed the password file there and now syntax check should work!\n\n\n[1]: https://mestachs.wordpress.com/tag/server-spec/\n[2]: http://sharknet.us/2014/02/06/infrastructure-testing-with-ansible-and-serverspec-part-2/\n[3]: http://downloads.getchef.com/chef-dk/\n[4]: https://github.com/neillturner/kitchen-ansible\n[5]: http://kitchen.ci\n[6]: https://www.virtualbox.org/\n[7]: http://www.vagrantup.com/downloads.html\n[8]: http://www.slideshare.net/tomduffield/test-kitchen-demo\n[9]: http://www.slideshare.net/devopsdays/test-kitchen-10-fletcher-nichol\n\n[chefdk-mac]: https://downloads.chef.io/chefdk#mac_os_x\n[chefdk-ubuntu]: https://downloads.chef.io/chefdk#ubuntu\n[chefdk-win]: https://downloads.chef.io/chefdk#windows\n[vbox-mac]: https://download.virtualbox.org/virtualbox/5.2.6/VirtualBox-5.2.6-120293-OSX.dmg\n[vbox-win]: https://download.virtualbox.org/virtualbox/5.2.6/VirtualBox-5.2.6-120293-Win.exe\n[vbox-lin]: https://www.virtualbox.org/wiki/Linux_Downloads\n[vbox-ubuntu-trusty]: https://download.virtualbox.org/virtualbox/5.2.6/virtualbox-5.2_5.2.6-120293~Ubuntu~trusty_amd64.deb\n[vbox-ubuntu-xenial]: https://download.virtualbox.org/virtualbox/5.2.6/virtualbox-5.2_5.2.6-120293~Ubuntu~xenial_amd64.deb\n\n[vagrant-mac]: https://releases.hashicorp.com/vagrant/2.0.2/vagrant_2.0.2_x86_64.dmg\n[vagrant-ubuntu]: https://releases.hashicorp.com/vagrant/2.0.2/vagrant_2.0.2_x86_64.deb\n[vagrant-win]: https://releases.hashicorp.com/vagrant/2.0.2/vagrant_2.0.2_x86_64.msi\n[homebrew-cask]: http://caskroom.io/\n\n[guard-gem]: http://guardgem.org/\n[bundler]: http://bundler.io/\n[rvm]: https://rvm.io/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrinitronx%2Fansible-tdd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrinitronx%2Fansible-tdd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrinitronx%2Fansible-tdd/lists"}