Puppet lvm重复声明 - 服务器上的错误400

时间:2016-01-06 15:15:59

标签: puppet lvm

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

来自r10k配置文件的部分代码调用模块。

Intent next = new Intent(CurrentActivity.this, LoginActivity.class);
        // will close all the running activiities and goes to Login Activity
next.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(next);
finish();

安装ibm mq。

的主模块代码
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,
  }

}

传递Hiera数据

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']

}

它会出现以下错误。

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

无法理解我收到此错误的原因。感谢任何帮助。

谢谢

1 个答案:

答案 0 :(得分:0)

您的mq_data_volume默认为sdd,当您使用mq_root_volume覆盖sdd的默认值时,您不会更改mq_data_volume的值}。

所以是的,毕竟你确实有重复。