Re: [openstack-dev] [puppet] - No way to pass extra variables from a heat template to a puppet manifest

2017-09-19 Thread James Slagle
On Tue, Sep 19, 2017 at 6:32 AM, Roquesalane, Jean-Pierre <
jeanpierre.roquesal...@dell.com> wrote:

> Dear fellow stackers,
>
>
>
> I’m currently trying to run a manifest from within a heat template. This
> manifest test the hostname and  depending on the value will do different
> things. I need  to pass some extra variables that are set in an
> environment  file to the manifest, and It failed so far. I’m driving nuts
> at this moment and even though all of the things I found on google, there
> is no way to get it work.
>
> RHOSP 10 is driving my overcloud.
>
>
>
> Any help would be much appreciated.
>
>
>
> Below are the files I’m using.
>
>
>
> ·Heat Template
>
>
>
> heat_template_version: 2016-10-14
>
>
>
> description: >
>
>   NFV Feature Hugepages configured by Puppet for computeNfv role.
>
>
>
> parameters:
>
>   servers:
>
> type: json
>
>   HugePageSize:
>
> type: string
>
>   HugePageCount:
>
> type: string
>
>
>
> resources:
>
>
>
>   NovaComputeExtraConfig:
>
> type: OS::Heat::SoftwareConfig
>
> properties:
>
>   group: puppet
>
>   inputs:
>
>   - name: HugePageSize
>
>   - name: HugePageCount
>
>   config:
>
> get_file: ../manifests/hugepages.pp
>
>   options:
>
> enable_hiera: True
>
> enable_facter: False
>
>
>
>
>
>   ExtraPuppetDeployment:
>
> type: OS::Heat::SoftwareDeployments
>
> properties:
>
>   servers: {get_param: servers}
>
>   config: {get_resource: NovaComputeExtraConfig}
>
>   input_values:
>
> HugePageSize: {get_param: HugePageSize}
>
> HugePageCount: {get_param: HugePageCount}
>
>   actions: ['CREATE','UPDATE']
>
>
>
> ·Puppet manifest
>
> if $hostname =~ /compute-nfv/ {
>
>   file { '/tmp/test_puppet':
>
> ensure => 'file',
>
> content  => "This is an NFV node!!! Setting ${HugePageCount} pages of
> ${HugePageSize} each",
>
> owner => 'root',
>
> group => 'root',
>
> mode => 0777,
>
>   }
>
> } else {
>
>   file { '/tmp/test_puppet':
>
> ensure => 'file',
>
> content  => 'This is not an NFV node... Nothing to set',
>
> owner => 'root',
>
> group => 'root',
>
> mode => 0777,
>
>   }
>
> }
>
>
>
> ·Environment  file
>
> resource_registry:
>
>   OS::TripleO::NodeExtraConfigPost: puppet/services/hugepages.yaml
>
> parameter_defaults:
>
>   OvercloudComputeNfvFlavor: baremetal
>
>   ComputeNfvCount: 3
>
>   HugePageSize: 2048
>
>   HugePageCount: 4
>
>
>

​Since you're setting use_hiera:True in the config, there should be a
hieradata file created for the config under /etc/puppet/hieradata on the
node(s) associated with the deployment.

That hiera file should automatically be included whenever you run puppet
due to the ​FACTER_deploy_config_name fact, and the templated use of
deploy_config_name in the hierarchy configured in /etc/puppet/hiera.yaml.

I'd start by checking all that to see if it got configured correctly. You
should be able to see the full puppet command run by the agent in the
os-collect-config log output on each node, and that may help you
troubleshoot as you can copy/paste the command and rerun it.

Also, you may just try setting use_facter:True in the config and see if
that fixes it as well.

-- 
-- James Slagle
--
__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


[openstack-dev] [puppet] - No way to pass extra variables from a heat template to a puppet manifest

2017-09-19 Thread Roquesalane, Jean-Pierre
Dear fellow stackers,

I'm currently trying to run a manifest from within a heat template. This 
manifest test the hostname and  depending on the value will do different 
things. I need  to pass some extra variables that are set in an environment  
file to the manifest, and It failed so far. I'm driving nuts at this moment and 
even though all of the things I found on google, there is no way to get it work.
RHOSP 10 is driving my overcloud.

Any help would be much appreciated.

Below are the files I'm using.


*Heat Template

heat_template_version: 2016-10-14

description: >
  NFV Feature Hugepages configured by Puppet for computeNfv role.

parameters:
  servers:
type: json
  HugePageSize:
type: string
  HugePageCount:
type: string

resources:

  NovaComputeExtraConfig:
type: OS::Heat::SoftwareConfig
properties:
  group: puppet
  inputs:
  - name: HugePageSize
  - name: HugePageCount
  config:
get_file: ../manifests/hugepages.pp
  options:
enable_hiera: True
enable_facter: False


  ExtraPuppetDeployment:
type: OS::Heat::SoftwareDeployments
properties:
  servers: {get_param: servers}
  config: {get_resource: NovaComputeExtraConfig}
  input_values:
HugePageSize: {get_param: HugePageSize}
HugePageCount: {get_param: HugePageCount}
  actions: ['CREATE','UPDATE']


*Puppet manifest
if $hostname =~ /compute-nfv/ {
  file { '/tmp/test_puppet':
ensure => 'file',
content  => "This is an NFV node!!! Setting ${HugePageCount} pages of 
${HugePageSize} each",
owner => 'root',
group => 'root',
mode => 0777,
  }
} else {
  file { '/tmp/test_puppet':
ensure => 'file',
content  => 'This is not an NFV node... Nothing to set',
owner => 'root',
group => 'root',
mode => 0777,
  }
}


*Environment  file
resource_registry:
  OS::TripleO::NodeExtraConfigPost: puppet/services/hugepages.yaml
parameter_defaults:
  OvercloudComputeNfvFlavor: baremetal
  ComputeNfvCount: 3
  HugePageSize: 2048
  HugePageCount: 4

Thanks.
JP

Jean-Pierre Roquesalane
SW System Sr Principal Engineer
Dell | Service Provider Solutions
mobile +33 6 21 86 79 04
jeanpierre.roquesal...@dell.com
[cid:image002.jpg@01D33153.A5CB7F60]

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev