How to use the chef-client hook

asked 2017-04-13 11:29:18 -0500

dinamikQQ gravatar image

Hello,

I am trying to use the integration of chef-client hook with openstack from here: githubcom/openstack/heat-templates/blob/master/hot/software-config/example-templates/example-chef-template.yaml

I have the hooks in my image but when i try to run that exact template, I get an error that - "recipe[nginx-pkg]" is not a map. I changed the syntax a bit and made it look like this:

This is the resource used for config.

  structured_config:
    type: OS::Heat::StructuredConfig
    properties:
      group: chef
      inputs:
      - name: cookbook
        type: Json
      config: { "recipe[cookbook]" }
      options:
        kitchen: "cookbook_url"
        kitchen_path: "/opt/heat/chef"

This is the resource used for server:

  deployment:
    type: OS::Heat::StructuredDeployment
    properties:
      config:
        get_resource: structured_config
      server:
        get_resource: server
      input_values:
        cookbook:
          package:
            name: cookbook

When I run this nothing happens in the OS.

There is an empty file created in /var/lib/cloud/instance/scripts/ called userdata.

There are the logs from cloudinit:

Cloud-init v. 0.7.5 running 'init-local' at Thu, 13 Apr 2017 12:04:48 +0000. Up 11.61 seconds.
Cloud-init v. 0.7.5 running 'init' at Thu, 13 Apr 2017 12:04:52 +0000. Up 16.41 seconds.
ci-info: +++++++++++++++++++++++++++Net device info++++++++++++++++++++++++++++
ci-info: +---------+------+---------------+---------------+-------------------+
ci-info: |  Device |  Up  |    Address    |      Mask     |     Hw-Address    |
ci-info: +---------+------+---------------+---------------+-------------------+
ci-info: | ens160: | True | 10.201.47.214 | 255.255.255.0 | fa:16:3e:31:d6:51 |
ci-info: |   lo:   | True |   127.0.0.1   |   255.0.0.0   |         .         |
ci-info: +---------+------+---------------+---------------+-------------------+
ci-info: +++++++++++++++++++++++++++++++++++Route info++++++++++++++++++++++++++++++++++++
ci-info: +-------+-----------------+---------------+-----------------+-----------+-------+
ci-info: | Route |   Destination   |    Gateway    |     Genmask     | Interface | Flags |
ci-info: +-------+-----------------+---------------+-----------------+-----------+-------+
ci-info: |   0   |     0.0.0.0     | 10.201.47.254 |     0.0.0.0     |   ens160  |   UG  |
ci-info: |   1   |   10.201.47.0   |    0.0.0.0    |  255.255.255.0  |   ens160  |   U   |
ci-info: |   2   |   169.254.0.0   |    0.0.0.0    |   255.255.0.0   |   ens160  |   U   |
ci-info: |   3   | 169.254.169.254 |  10.201.47.2  | 255.255.255.255 |   ens160  |  UGH  |
ci-info: +-------+-----------------+---------------+-----------------+-----------+-------+
Cloud-init v. 0.7.5 running 'modules:config' at Thu, 13 Apr 2017 12:04:53 +0000. Up 16.88 seconds.
2017-04-13 13:04:53,508 - util.py[WARNING]: Running locale (<module 'cloudinit.config.cc_locale' from '/usr/lib/python2.7/site-packages/cloudinit/config/cc_locale.pyc'>) failed
2017-04-13 13:04:53,541 - util.py[WARNING]: Restarting of the ssh daemon failed
Cloud-init v. 0.7.5 running 'modules:final' at Thu, 13 Apr 2017 12:04:53 +0000. Up 17.18 seconds.
2017-04-13 13:04:53,803 - util.py[WARNING]: Failed running /var/lib/cloud/instance/scripts/userdata [-]
2017-04-13 13:04:53,803 - cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts)
2017-04-13 13:04:53,804 - util.py[WARNING]: Running scripts-user (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python2.7/site-packages/cloudinit/config/cc_scripts_user.pyc'>) failed
Cloud-init v. 0.7.5 finished at Thu, 13 Apr 2017 12:04:53 +0000. Datasource DataSourceConfigDriveNet [net,ver=2][source=/dev/sr0].  Up 17.30 seconds

I searched for documentation on this but there isn't too much on this. Any help would be appreciated.

edit retag flag offensive close merge delete