1

My code is using puppetlabs lvm module. Uses as shown below

Part of code from r10k profile which invokes module.

class profile::streams::messagequeue(
  $mq_install_root         = '/opt/IBM/mqm',
  $mq_install_temp         = '/tmp/mqm',
  $mq_install_temp_suffix  = 'MQServer',
  $mq_archive_source_dir   = 'puppet:///modules/ibm_messagequeue',
  $mq_archive_tar          = 'mqadv_dev80_linux_x86-64.tar.gz',
  $mq_user                 = 'mqm',
  $mq_group                = 'mqm',
  $mq_password             = 'mqm2015',
  $mq_version              = '8.0.0-4',
  $mq_cp_install_temp      = '/tmp/mqm_cp',
  $mq_cp_archive_tar       = '8.0.0-WS-MQ-LinuxX64-FP0004.tar.gz',
  $mq_cp_version           = 'U8004-8.0.0-4',
  $mq_config_queue_manager = 'QMGR_CLAIM',
  $mq_config_default_port  = '5672',
  $mq_config_channel_name  = 'CHNL_CLAIM',
  $mq_config_channel_port  = '5673',
  $mq_data_volume          = '/dev/sdd',
  $mq_data_size            = '10G',
  $mq_log_volume           = '/dev/sdc',
  $mq_log_size             = '40G',
  $mq_root_volume          = '/dev/sde',
  $mq_root_size            = '10G',
)
{

  #install message queue (IBM MQ)
  class {'::ibm_messagequeue':
    install_root         => $mq_install_root,
    install_temp         => $mq_install_temp,
    install_temp_suffix  => $mq_install_temp_suffix,
    archive_source_dir   => $mq_archive_source_dir,
    archive_tar          => $mq_archive_tar,
    user                 => $mq_user,
    group                => $mq_group,
    password             => $mq_password,
    version              => $mq_version,
    cp_install_temp      => $mq_cp_install_temp,
    cp_archive_tar       => $mq_cp_archive_tar,
    cp_version           => $mq_cp_version,
    config_queue_manager => $mq_config_queue_manager,
    config_default_port  => $mq_config_default_port,
    config_channel_name  => $mq_config_channel_name,
    config_channel_port  => $mq_config_channel_port,
    data_volume          => $mq_data_volume,
    data_size            => $mq_data_size,
    log_volume           => $mq_log_volume,
    log_size             => $mq_log_size,
    root_volume          => $mq_root_volume,
    root_size            => $mq_root_size,
  }

}

Main module code which installs ibm mq.

class ibm_messagequeue (
  $install_root = '/opt/IBM/mqm',
  $install_temp = '/tmp/mqm',
  $install_temp_suffix = 'MQServer',
  $archive_source_dir = 'puppet:///modules/ibm_messagequeue',
  $archive_tar = 'mqadv_dev80_linux_x86-64.tar.gz',
  $user = 'mqm',
  $group = 'mqm',
  $password = 'mqm2015',
  $version ='8.0.0-4',
  $cp_install_temp = '/tmp/mqm_cp',
  $cp_archive_tar = '8.0.0-WS-MQ-LinuxX64-FP0004.tar.gz',
  $cp_version = 'U8004-8.0.0-4',
  $config_queue_manager = 'QMGR_CLAIM',
  $config_default_port,
  $config_channel_name = 'CHNL_CLAIM',
  $config_channel_port,
  $data_volume,
  $data_size,
  $log_volume,
  $log_size,
  $root_volume,
  $root_size,
)
{

  $ibmmq_install_root = $install_root ? {
    undef   => '/opt/IBM/mqm',
    default => $install_root,
  }

  $ibmmq_install_temp = $install_temp ? {
    undef   => '/tmp/mqm',
    default => $install_temp,
  }

  $ibmmq_archive_source_dir = $archive_source_dir ? {
    undef   => 'https://repo.com/maven_central/repository/HIT',
    default => $archive_source_dir,
  }

  $ibmmq_archive_tar = $archive_tar ? {
    undef   => 'mqadv_dev80_linux_x86-64.tar.gz',
    default => $archive_tar,
  }

  $ibmmq_user = $user ? {
    undef   => 'mqm',
    default => $user,
  }

  $ibmmq_group = $group ? {
    undef   => 'mqm',
    default => $group,
  }

  $ibmmq_password = $password ? {
    undef   => 'mqm2015',
    default => $password,
  }

  $ibmmq_version = $version ? {
    undef   => '8.0.0-4',
    default => $version,
  }

  $ibmmq_cp_install_temp = $cp_install_temp ? {
    undef   => '/tmp/mqm_cp',
    default => $cp_install_temp,
  }

  $ibmmq_cp_archive_tar = $cp_archive_tar ? {
    undef   => '8.0.0-WS-MQ-LinuxX64-FP0004.tar.gz',
    default => $cp_archive_tar,
  }

  $ibmmq_cp_version = $cp_version ? {
    undef   => 'U8004-8.0.0-4',
    default => $cp_version,
  }

  $ibmmq_config_queue_manager = $config_queue_manager ? {
    undef   => 'QMGR_CLAIM',
    default => $config_queue_manager,
  }

  $ibmmq_config_default_port = $config_default_port ? {
    undef   => '5672',
    default => $config_default_port,
  }

  $ibmmq_config_channel_name = $config_channel_name ? {
    undef   => 'CHNL_CLAIM',
    default => $config_channel_name,
  }

  $ibmmq_config_channel_port = $config_channel_port ? {
    undef   => '5673',
    default => $config_channel_port,
  }

  $ibmmq_data_volume = $data_volume ? {
    undef   => '/dev/sdb2',
    default => $data_volume,
  }

  $ibmmq_data_size = $data_size ? {
    undef   => '10G',
    default => $data_size,
  }

  $ibmmq_log_volume = $log_volume ? {
    undef   => '/dev/sdc1',
    default => $log_volume,
  }

  $ibmmq_log_size = $log_size ? {
    undef   => '40G',
    default => $log_size,
  }

  $ibmmq_root_volume = $root_volume ? {
    undef   => '/dev/sdc1',
    default => $root_volume,
  }

  $ibmmq_root_size = $root_size ? {
    undef   => '10G',
    default => $root_size,
  }

  $ibmmq_install_temp_suffix = $install_temp_suffix ? {
    undef   => 'MQServer',
    default => $install_temp_suffix,
  }

  $ibmmq_install_temp_final = "${ibmmq_install_temp}/${ibmmq_install_temp_suffix}"

  # setup group and user for running the message queue
  group { $ibmmq_group:
    ensure => 'present',
  }

  user { $ibmmq_user:
    ensure     => 'present',
    home       => "/home/${ibmmq_user}",
    name       => $ibmmq_user,
    password   => $ibmmq_password,
    shell      => '/bin/bash',
    managehome => true,
    require    => Group[$ibmmq_group],
  }

  # Ensure IBM root directory is inatalled
  file { $ibmmq_install_root: ensure => 'directory', }

  # Ensure temp directory is present to extract files
  file { $ibmmq_install_temp: ensure => 'directory', }

  # Ensure temp directory is present to extract files
  file { $ibmmq_cp_install_temp: ensure => 'directory', }

  #Create data and log directory 
  file { '/opt': ensure => 'directory', }
  file { '/opt/IBM': ensure => 'directory', }
  file { '/var/mqm': ensure => 'directory', }
  file { '/var/mqm/log': ensure => 'directory', }
  file { '/var/mqm/data': ensure => 'directory', }

  # Format disks and mount points   
  class { '::lvm':
    volume_groups => {
      'vg_mq_root' => {
        physical_volumes => $ibmmq_root_volume,
        logical_volumes  => {
          'lv_mq_root' => {
            #'size'              => $ibmmq_root_size,
            'mountpath'         => $ibmmq_install_root,
            'mountpath_require' => true,
            'ensure'            => present,
          },
        },
      },
      'vg_mq_data' => {
        physical_volumes => $ibmmq_data_volume,
        logical_volumes  => {
          'lv_mq_data' => {
            #'size'              => $ibmmq_data_size,
            'mountpath'         => '/var/mqm/data',
            'mountpath_require' => true,
            'ensure'            => present,
          },
        },
      },
      'vg_mq_log'  => {
        physical_volumes => $ibmmq_log_volume,
        logical_volumes  => {
          'lv_mq_log' => {
            #'size'              => $ibmmq_log_size,
            'mountpath'         => '/var/mqm/log',
            'mountpath_require' => true,
            'ensure'            => present,
          },
        },
      },
    },
  }

  #Install Websphere base version
  class {'ibm_messagequeue::install':
    archive_filename    => $ibmmq_archive_tar,
    temp_dir            => $ibmmq_install_temp,
    version             => $ibmmq_version,
    original_source_dir => $ibmmq_archive_source_dir,
    source_dir          => $ibmmq_install_temp_final,
    target_dir          => $ibmmq_install_root,
  }

  #Install Websphere service pack update 
  class {'ibm_messagequeue::installcp':
    cp_archive_filename    => $ibmmq_cp_archive_tar,
    cp_temp_dir            => $ibmmq_cp_install_temp,
    cp_version             => $ibmmq_cp_version,
    cp_original_source_dir => $ibmmq_archive_source_dir,
    cp_source_dir          => $ibmmq_cp_install_temp,
    cp_target_dir          => $ibmmq_install_root,
  }

  #Configure queues manager, Listeners and AMQP channels
  class {'::ibm_messagequeue::config':
    config_install_root  => $ibmmq_install_root,
    config_queue_manager => $ibmmq_config_queue_manager,
    config_user          => $ibmmq_user,
    config_default_port  => $ibmmq_config_default_port,
    config_channel_name  => $ibmmq_config_channel_name,
    config_channel_port  => $ibmmq_config_channel_port,
  }

  # setup all the environment variables
  file { '/etc/profile.d/mqm_env.sh':
    content => "export MQ_ID=${ibmmq_user}"
  }

  # Control execution order
  Group[$ibmmq_group]
  ->
  User[$ibmmq_user]
  ->
  File['/opt']
  ->
  File['/opt/IBM']
  ->
  File[$ibmmq_install_root]
  ->
  File['/var/mqm']
  ->
  File['/var/mqm/log']
  ->
  File['/var/mqm/data']
  ->
  File[$ibmmq_install_temp]
  ->
  File[$ibmmq_cp_install_temp]
  ->
  Class['lvm']
  ->
  Class['ibm_messagequeue::install']
  ->
  Class['ibm_messagequeue::installcp']
  ->
  Class['ibm_messagequeue::config']
  ->
  File['/etc/profile.d/mqm_env.sh']

}

Hiera data passed

--- 
streams_mq_group: "mqm"
streams_mq_user: "mqm"
streams_mq_password: "password"
streams_mq_config_default_port: "5672"        
streams_mq_config_channel_port: "5673"       
mq_install_root: "/opt/IBM/mqm"
mq_install_temp: "/tmp/mqm"
mq_archive_source_dir: "https://repo.com/maven_central/repository/HIT"
mq_archive_tar: "mqadv_dev80_linux_x86-64.tar.gz"
mq_version: "8.0.0-4"
mq_cp_install_temp: "/tmp/mqm_cp"
mq_cp_archive_tar: "8.0.0-WS-MQ-LinuxX64-FP0004.tar.gz"
mq_cp_version: "U8004-8.0.0-4"
mq_config_queue_manager: "QMGR_CLAIM"  
mq_config_channel_name: "CHNL_CLAIM"  
mq_var_volume: "/dev/sdc"  
mq_var_size: "10G"        
mq_log_volume: "/dev/sdb"  
mq_log_size: "100G"
mq_root_volume: "/dev/sdd"  
mq_root_size: "10G"
mq_server: "uapp1021d"

puppetrole: "streams::messagequeue"
profile::streams::messagequeue::mq_install_root:  "%{hiera('mq_install_root')}"
profile::streams::messagequeue::mq_install_temp: "%{hiera('mq_install_temp')}"
profile::streams::messagequeue::mq_archive_source_dir: "%{hiera('mq_archive_source_dir')}"
profile::streams::messagequeue::mq_archive_tar: "%{hiera('mq_archive_tar')}"
profile::streams::messagequeue::mq_version: "%{hiera('mq_version')}"
profile::streams::messagequeue::mq_cp_install_temp: "%{hiera('mq_cp_install_temp')}"
profile::streams::messagequeue::mq_cp_archive_tar: "%{hiera('mq_cp_archive_tar')}"
profile::streams::messagequeue::mq_cp_version: "%{hiera('mq_cp_version')}"
profile::streams::messagequeue::mq_config_queue_manager: "%{hiera('mq_config_queue_manager')}"
profile::streams::messagequeue::mq_config_channel_name: "%{hiera('mq_config_channel_name')}"
profile::streams::messagequeue::mq_var_volume: "%{hiera('mq_var_volume')}"
profile::streams::messagequeue::mq_var_size: "%{hiera('mq_var_size')}"
profile::streams::messagequeue::mq_log_volume: "%{hiera('mq_log_volume')}"
profile::streams::messagequeue::mq_log_size: "%{hiera('mq_log_size')}"
profile::streams::messagequeue::mq_root_volume: "%{hiera('mq_root_volume')}"
profile::streams::messagequeue::mq_root_size: "%{hiera('mq_root_size')}"
profile::streams::messagequeue::mq_server: "%{hiera('mq_server')}"

profile::streams::messagequeue::mq_group: "%{hiera('streams_mq_group')}"
profile::streams::messagequeue::mq_user: "%{hiera('streams_mq_user')}"
profile::streams::messagequeue::mq_password: "%{hiera('streams_mq_password')}"
profile::streams::messagequeue::mq_config_default_port: "%{hiera('streams_mq_config_default_port')}" 
profile::streams::messagequeue::mq_config_channel_port: "%{hiera('streams_mq_config_channel_port')}"

It gives the following error.

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Physical_volume[/dev/sdd] is already declared in file /etc/puppetlabs/puppet/environments/qa/modules/lvm/manifests/volume_group.pp:17; cannot redeclare at /etc/puppetlabs/puppet/environments/qa/modules/lvm/manifests/volume_group.pp:17 on node uapp1021d.bsc.bscal.com Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

Fail to understand why I am getting this error. Appreciate any help.

Thank you

neel
  • 243
  • 6
  • 17
  • Your code relies on several variables whose values are not presented. In particular, it depends on them to express each logical volume's physical volumes, so it seems reasonable to suppose that those values are key. – John Bollinger Jan 06 '16 at 15:35
  • Based on the error message, I'm inclined to *speculate* that you list `/dev/sdd` among the physical volumes for more than one logical volume. Puppet-lvm does not accommodate that, nor should it, because LVM itself does not accommodate logical volumes sharing physical volumes. – John Bollinger Jan 06 '16 at 15:37
  • thank you, the values gets in from hiera. .mq_var_volume: "/dev/sdc" mq_var_size: "10G" mq_log_volume: "/dev/sdb" mq_log_size: "100G" mq_root_volume: "/dev/sdd" mq_root_size: "10G" – neel Jan 06 '16 at 17:19
  • class profile::streams::messagequeue( $mq_install_root = '/opt/IBM/mqm', $mq_install_temp = '/tmp/mqm', $mq_install_temp_suffix = 'MQServer', $mq_version ='8.0.0-4', $mq_cp_install_temp = '/tmp/mqm_cp', $mq_cp_archive_tar = '8.0.0-WS-MQ-LinuxX64-FP0004.tar.gz', $mq_data_volume = '/dev/sdc', $mq_data_size = '10G', $mq_log_volume = '/dev/sdb', $mq_log_size = '40G', $mq_root_volume = '/dev/sdd', $mq_root_size = '10G', ) – neel Jan 06 '16 at 17:34
  • If you have relevant code or data to present then **[edit it into the question](http://stackoverflow.com/posts/34636524/edit)**. Do not present it in comments. – John Bollinger Jan 06 '16 at 19:41
  • sure, pasted the entire code. – neel Jan 07 '16 at 11:06
  • thanka John, added entire code for reference. /dev/sdd is passed only once for sure. thats whats bothering me on why this should occur. bug with module? – neel Jan 07 '16 at 11:28
  • Although you say "/dev/sdd is passed only once for sure", the error message you presented seems to belie that. I suggest you check by inserting `alert()` calls into class ibm_messagequeue to emit the variables' values into the master's log. – John Bollinger Jan 07 '16 at 14:10
  • It is conceivable, however, that somewhere else you are declaring the extraneous `Physical_volume[/dev/sdd]` resource directly. – John Bollinger Jan 07 '16 at 14:12
  • Thanks John, that helped me locate issue. Problem was hiera – neel Jan 13 '16 at 00:03

1 Answers1

0

Your mq_data_volume defaults to sdd, and while you override the default for mq_root_volume with sdd, you don't change the value of mq_data_volume.

So yes, you do have a duplication after all.

Felix Frank
  • 8,125
  • 1
  • 23
  • 30