AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[hiera](server)

Martin Hope
Skullone
Asked: 2016-11-25 10:05:58 +0800 CST

Puppet/hiera : 从一个模板生成多个文件

  • 0

我正在运行 puppet 4,我想从同一个模板生成几个配置文件,每个配置文件都有不同的配置。

例如 :

# cat /tmp/a.conf 
test1

# cat /tmp/b.conf 
test2

而且我需要将所有这些信息放在 hiera 中,所以我认为是这样的:

test::clusters:
  - 'a.conf'
    text: 'test1'
  - 'b.conf'
    text: 'test2'

谢谢

puppet template puppetmaster hiera
  • 2 个回答
  • 796 Views
Martin Hope
Nathan Basanese
Asked: 2016-09-10 17:04:00 +0800 CST

Puppet 2.7 是否允许未参数化的“params”类的类继承?

  • 1

运行时出现以下错误puppet-lint:

$ puppet-lint manifests/*
manifests/init.pp - WARNING: class inheriting from params class on line 72

我在duckduckgo.com上快速搜索了一下,得到了这个:

http://puppet-lint.com/checks/class_inherits_from_params_class/

但是,我们的 Puppet Agent 版本都是 2.7 或更高版本,我们的 Puppet Master 都是 3.0 或更高版本。

作为参考,有init.pp问题的代码如下:

class myclass (
    $zone = 'top',
    $::myclass::params::base_url,
    $::myclass::params::username,
) inherits myclass::params {
...

中的代码params.pp如下:

class myclass::params {
    $base_url  = hiera('myclass::base_url','https://beta.tpsreports.com/coversheets/')
    $username = hiera('clap::base_url','prod')
}

即使 Hiera 查找失败,我仍然不应该收到这样的错误:

err: Could not retrieve catalog from remote server: Error 400 on SERVER: Must pass ::myclass::params::base_url to Class[Myclass] at /etc/puppet/manifests/nodes/beta_servers_0.pp:126 on node beta-web-server-0.tpsreports.com

既然我已经讨论了一些背景,我非常愿意添加,如果有人问,我的问题如下:

  1. 如果params即使 hiera 查找以某种方式失败,我的类也会提供参数,为什么我会收到此错误?
  2. 我是否必须使用可怕的解决方法(即 puppet-lint.com 链接中的“你应该做的事情”,即使我的 Puppet 版本高于2.6.2所有情况?
dependencies puppet hiera
  • 1 个回答
  • 76 Views
Martin Hope
Skullone
Asked: 2016-08-19 10:14:41 +0800 CST

Puppet 和 systemctl 的麻烦

  • 2

我在使用 puppet 和 systemctl 时遇到了一些问题。我曾经为“服务”加载几个参数,但它不再在 centos7 上工作。

这是我的错误:

Error: Could not enable [ntpd ntpdate]: 
Error: /Stage[main]/Ntp::Service/Service[[ntpd ntpdate]]/enable: change from false to true failed: Could not enable [ntpd ntpdate]: 

这是我的代码:

希拉:

ntp::service::ntp_services: 
  - "ntpd"
  - "ntpdate"

服务.pp:

class ntp::service ($ntp_services) {
    service {"$ntp_services":
        hasrestart  => false,
        hasstatus   => true,
        ensure      => running,
        enable      => true,
    }
}

它在 centos 6 上运行良好,并且曾经在 centos 7 上运行。

如果我这样定义参数,它会起作用:

ntp::service::ntp_services: "ntpd"

但我必须为 1 个服务定义 1 个参数...

谢谢

puppet centos7 systemctl hiera
  • 1 个回答
  • 392 Views
Martin Hope
030
Asked: 2016-07-12 09:59:22 +0800 CST

在 Ansible 中使用 hiera 作为 ENC 的效果是什么?

  • 5

我在 Puppet 中使用 hiera 作为外部节点分类器,以避免将角色部署在例如不兼容的节点上。现在我有两台使用 Ansible 配置的服务器。我担心当集群增长时,我必须检查哪些节点可用,然后决定应该应用什么角色,而不是自动执行的 hiera。例如,系统 A 是开发人员系统和部署开发角色,系统 B 是数据库系统部署数据库角色。

ansible hiera
  • 1 个回答
  • 1429 Views
Martin Hope
Hellstorm
Asked: 2016-07-11 01:57:36 +0800 CST

使用 Hiera 进行用户管理的最佳方式

  • 1

我目前正在尝试移动我们的 Puppet 设置以进一步使用 Hiera。关于这一点,我想用 Hiera 创建用户,但是在层次结构中向上移动时遇到了一些问题。

场景是我希望在每个安装中都包含一组基本用户。此外,有时我需要为不同的节点子集添加一些特定用户,可能特定于某些数据中心或某些节点。

所以我想到了以下设置:

hiera.yaml:

:hierarchy:
  - "nodes/%{::trusted.certname}"
  - "datacenter/${::datacenter}"
  - "common"

用户.pp:

class profile::users {
  $user_accounts = hiera('user_accounts')
  create_resources(user, $user_accounts)
}

在 common.yaml 中:

user_accounts:
  bob:
    comment: "Bob"
    managehome: true

然后再往上走。我看到的主要问题是:

  • 如何为每个用户实现默认属性?比如在这个例子中,我想managehome: true为所有用户设置,而不是每次都显式地写。不过,我有时可能想禁用它。
  • 如果我user_accounts在层次结构中更进一步,它将覆盖user_accounts来自 common.yaml 的哈希,因此我需要复制条目。我偶然发现了 Hiera 中的深度合并,但想知道这是否实际使用过或者是最佳实践。另外,它不能解决第一个问题,我需要merge_behavior在 hiera.yaml 中设置,我想避免。
  • 我如何在这里为每个用户插入 ssh 密钥?最好的解决方案是将 ssh 密钥作为属性添加到用户帐户。

那么,有没有人了解用户管理实际上是如何用 Puppet 很好地完成的?谢谢 :)

puppet hiera
  • 1 个回答
  • 2070 Views

Sidebar

Stats

  • 问题 205406
  • 回答 270551
  • 最佳答案 135275
  • 用户 68468
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve