Puppet lvm duplicate Declarrion-服务器上出现错误400

Puppet lvm duplicate Declarrion-服务器上出现错误400,puppet,lvm,Puppet,Lvm,我的代码使用的是puppetlabs lvm模块。使用方法如下所示 r10k配置文件中调用模块的部分代码 class profile::streams::messagequeue( $mq_install_root = '/opt/IBM/mqm', $mq_install_temp = '/tmp/mqm', $mq_install_temp_suffix = 'MQServer', $mq_archive_source_dir = 'pu

我的代码使用的是puppetlabs lvm模块。使用方法如下所示

r10k配置文件中调用模块的部分代码

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,
  }

}
安装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数据

--- 
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')}"
它给出了以下错误

错误:无法从远程服务器检索目录:服务器上的错误400: 重复声明:物理卷[/dev/sdd]已在文件/etc/puppetlabs/puppet/environments/qa/modules/lvm/manifests/volume\u group.pp:17中声明;无法在/etc/puppetlabs/puppet/environments/qa/modules/lvm/manifests/volume_group重新声明。pp:17 在节点uapp1021d.bsc.bscal.com上 警告:未在失败的目录上使用缓存 错误:无法检索目录;跳绳跑

不明白我为什么会犯这个错误。谢谢你的帮助


感谢您

您的
mq_数据_卷
默认为
sdd
,当您使用
sdd
覆盖
mq_root_卷
的默认值时,您不会更改
mq_数据_卷
的值


因此,是的,您毕竟有一个复制。

您的
mq_数据_卷
默认为
sdd
,当您使用
sdd
覆盖
mq_根_卷
的默认值时,您不会更改
mq_数据_卷
的值


因此,是的,您毕竟有一个重复。

您的代码依赖于几个变量,这些变量的值没有显示出来。特别是,表示每个逻辑卷的物理卷取决于它们,因此假设这些值是关键值似乎是合理的。根据错误消息,我倾向于推测您在多个逻辑卷的物理卷中列出
/dev/sdd
。Puppet lvm不支持,也不应该支持,因为lvm本身不支持共享物理卷的逻辑卷。谢谢,这些值来自hiera。mq_var_volume:“/dev/sdc”mq_var_size:“10G”mq_log_volume:“/dev/sdb”mq_log_size:“100G”mq_root_volume:“/dev/sdc”mq_root_size:“10G”类配置文件::流::消息队列($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-linux64-FP0004.tar.gz',$mq_数据量='dev/dev/mq/sdu数据大小=‘10G’、$mq_log_volume=’/dev/sdb’、$mq_log_size=‘40G’、$mq_root_volume=’/dev/sdd’、$mq_root_size=‘10G’、)如果您有相关的代码或数据要显示,请不要在注释中显示。您的代码依赖于几个没有显示值的变量。特别是,它依赖于这些变量来表示每个逻辑卷的物理卷,因此假设这些值是键似乎是合理的。根据错误消息,我倾向于ate您在多个逻辑卷的物理卷中列出了
/dev/sdd
。Puppet lvm不支持,也不应该支持,因为lvm本身不支持共享物理卷的逻辑卷。谢谢,这些值来自hiera..mq_var_volume:“/dev/sdc”mq_var_size:“10G”mq_log_volume:“/dev/sdb”mq_日志大小:“100G”mq_根目录卷:“/dev/sdd”mq_根目录大小:“10G”类配置文件::流::消息队列($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-linux64-FP0004.tar.gz',$mq_数据量='dev/dev/mq/sdu数据大小=“10G'、$mq_log_volume='/dev/sdb'、$mq_log_size='40G'、$mq_root_volume='/dev/sdd'、$mq_root_size='10G',)如果您有相关代码或数据要显示,请不要在注释中显示。