2

I am trying to get Ansible + Test Kitchen to work and my code is available at Github.

When running kitchen test it errors out with:

   ERROR! the role 'geerlingguy.java' was not found in /tmp/kitchen/roles:/tmp/kitchen:/tmp/kitchen/roles:/tmp/kitchen/roles

   The error appears to have been in '/tmp/kitchen/roles/ansible-nexus/meta/main.yml': line 3, column 5, but may
   be elsewhere in the file depending on the exact syntax problem.

   The offending line appears to be:

   dependencies:
     - { role: geerlingguy.java }

Is there a way to tell Test Kitchen to firstly pull in dependencies from Ansible Galaxy?

Alex Harvey
  • 14,494
  • 5
  • 61
  • 97

2 Answers2

2

You should include following changes: .kitchen.yml

provisioner:
  hosts: test-kitchen
  name: ansible_playbook
  #require_chef_for_busser: false
  #require_ruby_for_busser: true
  ansible_verbosity: 2
  ansible_verbose: true
  require_ansible_repo: false
  require_ansible_omnibus: true
  requirements_path: requirements-test.txt
  #
  # When testing with Test Kitchen, run the Docker client with
  # "--insecure-registry registry.yourdomain.local" so that we can test pushing
  # to our test private registry.
  #
  #extra_vars:
  #  docker_opts: "--insecure-registry registry.yourdomain.local"

requirements-test.txt

geerlingguy.java
Valeriy Solovyov
  • 5,384
  • 3
  • 27
  • 45
0

I also found another way of doing this: create an Ansiblefile based on doco here, add gem 'librarian-ansible' to Gemfile, and specify the the role in test/integration/default/default.yml. I suspect, however, that @Valeriy Solovyov's answer is more correct.

Alex Harvey
  • 14,494
  • 5
  • 61
  • 97