0
votes

Beginning with chef and have difficulty in getting roles/environment setup going. Unable to figure out what I am missing.

     Cookbooks: nginx_webserver
          recipes: default.rb, config_test, config_dev

     Roles: 
          webserver
     Environment:
          dev, qa 

Here is my role file:

     chef_type:           role
     default_attributes:
     description:         Nginx webserver
     env_run_lists:
         dev: recipe[nginx_webserver::config_dev]
         qa:  recipe[nginx_webserver::config_qa]
         json_class:          Chef::Role
         name:                webserver
         override_attributes:
         run_list:            recipe[nginx_webserver]

Here is my env list

        chef_type:           environment
        cookbook_versions:
           nginx_webserver: = 0.1.2
        default_attributes:
        description:         development environment
        json_class:          Chef::Environment
        name:                dev
        override_attributes:
              nginx:
        site_dir: dev.mysite.com # This value changes between envs

Here is my node_list:

        {
          "name": "chef-node1",
          "chef_environment": "dev",
          "normal": {
            "tags": [

                 ]
          },
          "policy_name": null,
          "policy_group": null,
          "run_list": [
            "role[webserver]"
           ]

         }

My chef-client output/error:

        54.149.131.42 Recipe Compile Error
        54.149.131.42   

        ====================================================================
        54.149.131.42
        54.149.131.42 Chef::Exceptions::RecipeNotFound
        54.149.131.42 --------------------------------
        54.149.131.42 could not find recipe config_dev for cookbook    
        nginx_webserver
        54.149.131.42

I am not sure how to get my config_dev and config_qa recipes in place on the chef server. I have included both to my default.rb recipe but i still keep getting this error. My aim is to call confg_dev recipe when its dev environment and config_qa when its qa. Any pointers please

Edit : 1

Ouput from cookbook show command

name: nginx_webserver-0.1.2 providers: recipes: checksum: 23978bdef70ea9a852e27d9489acdda1 name: default.rb path: recipes/default.rb specificity: default url: https://s3-external-1.amazonaws.com:443/opscode-platform-production-data/organization-0ffe55465085b0ed5ec6cc4dc383888e/checksum-23978bdef70ea9a852e27d9489acdda1?AWSAccessKeyId=AKIAIQKPG2CTSTRVDO4Q&Expires=1477168767&Signature=8EUWtT1RJq1S6/N0nF00XV879fg%3D resources: root_files: checksum: d5324dd6a872900fd6ee12c9628d9595 name: README.md path: README.md specificity: default url: https://s3-external-1.amazonaws.com:443/opscode-platform-production-data/organization-0ffe55465085b0ed5ec6cc4dc383888e/checksum-d5324dd6a872900fd6ee12c9628d9595?AWSAccessKeyId=AKIAIQKPG2CTSTRVDO4Q&Expires=1477168767&Signature=KuzF07t3/Xnw3BA30PkcNbsnQf0%3D

checksum: d14d45c195dccbfe56b358b71d2a6a6b name: chefignore path: chefignore specificity: default url: https://s3-external-1.amazonaws.com:443/opscode-platform-production-data/organization-0ffe55465085b0ed5ec6cc4dc383888e/checksum-d14d45c195dccbfe56b358b71d2a6a6b?AWSAccessKeyId=AKIAIQKPG2CTSTRVDO4Q&Expires=1477168767&Signature=8nlPR7LBWOQbn6C7CfCaNTieaqM%3D

checksum: 6528f8499102744b7616913a6cb225de name: Berksfile path: Berksfile specificity: default url: https://s3-external-1.amazonaws.com:443/opscode-platform-production-data/organization-0ffe55465085b0ed5ec6cc4dc383888e/checksum-6528f8499102744b7616913a6cb225de?AWSAccessKeyId=AKIAIQKPG2CTSTRVDO4Q&Expires=1477168767&Signature=0KRkWnrxasYQFhKaM0Kdqh79ltk%3D


EDIT - 2:

Cookbook/default.rb

     include_recipe 'selinux::permissive'
     include_recipe 'nginx_webserver::config_dev'
     include_recipe 'nginx_webserver::config_qa'

Updated metadata.rb to = 0.1.3

 knife cookbook upload nginx_webserver
 Uploading nginx_webserver [0.1.3]
 Uploaded 1 cookbook.

Getting same error. Also, do i really need to include my config_dev and config_qa in my default.rb? Shouldn't chef pick up these recipes automatically based on env_run_lists?

1
What does knife cookbook show nginx_webserver 0.1.2 display for you? - Ivan
shows a lot of stuff. Mainly about my two recipes - selinux and nginx. Is there any thing specific you are looking for - f-z-N
ideally the whole output so we all here can understand what's happening here, minimally if the config_dev recipe is visible in that version - Ivan
I added some part. But it does not show any info about my config_dev recipe - f-z-N
please add four spaces to the left of each code line to make it code formatting - Ivan

1 Answers

0
votes

Your environment uses the version which does not have the recipes (given you've uploaded them in 0.1.3 as per your log):

    chef_type:           environment
    cookbook_versions:
       nginx_webserver: = 0.1.2

Please use knife environment edit, put 0.1.3 there and try converging the node again.