codec
codec

Reputation: 8836

Can we add a role in kitchen.yml?

Here is my kitchen.yml

---
driver:
  name: vagrant
  network:
    - ["private_network", {ip: "192.168.35.35"}]

provisioner:
  name: chef_zero
  # You may wish to disable always updating cookbooks in CI or other testing environments.
  # For example:
  #   always_update_cookbooks: <%= !ENV['CI'] %>
  always_update_cookbooks: true
  roles_path: test/integration/roles/

verifier:
  name: inspec

platforms:
  - name: ubuntu-14.04

suites:
  - name: default
    run_list:
      - role[tomcat_role]
    verifier:
      inspec_tests:
        - test/smoke/default
    attributes:

and I keep getting the following error

    [2017-04-24T10:39:02+00:00] ERROR: Role tomcat_role (included by 'top lev
el') is in the runlist but does not exist. Skipping expand.

       =========================================================================
=======
       Error expanding the run_list:
       =========================================================================
=======

       Missing Role(s) in Run List:
       ----------------------------
       * tomcat_role included by 'top level'

role is definitely there on chef server but still I am getting this error. Are we not allowed to use role in kitchen.yml's run list attribute?

Upvotes: 0

Views: 1822

Answers (2)

codec
codec

Reputation: 8836

Ok so the issue was with roles_paths . I changed it to role_path and everything worked.

Upvotes: 1

coderanger
coderanger

Reputation: 54249

As mentioned in the comments, the filename of the role must match its name field and that must match the role[name] string in the run list. Make sure all three of those align and you should be all set.

Upvotes: 2

Related Questions