hiera

Puppet 6 and module puppetlabs/accounts does not create user account in Hiera YAML format

蹲街弑〆低调 提交于 2019-12-20 06:08:52
问题 When I run puppet agent --test I have no errors output but the user did not create. My puppet hira.yaml configuration is: --- version: 5 datadir: "/etc/puppetlabs/code/environments" data_hash: yaml_data hierarchy: - name: "Per-node data (yaml version)" path: "%{::environment}/nodes/%{::trusted.certname}.yaml" - name: "Common YAML hierarchy levels" paths: - "defaults/common.yaml" - "defaults/users.yaml" users.yaml is: accounts::user: joed: locked: false comment: System Operator uid: '1700' gid

Hiera 3 + Puppet 4.2 can't manage empty value in yaml datasource

ぃ、小莉子 提交于 2019-12-13 20:24:58
问题 I'm facing some issues to use Hiera 3 with Puppet 4.2. When applying my puppet manifest using this command: puppet apply environments/production/manifests/init.pp --hiera_config=hiera.yaml I get the following error: Error: Evaluation Error: Error while evaluating a Function Call, Could not find data item myclass::ensure in any Hiera data file and no default supplied at /home/vagrant/temp/environments/production/manifests/init.pp:13:39 on node a Here is the directory structure : $ tree . ├──

using the pe_accounts module with hiera

流过昼夜 提交于 2019-12-13 04:23:42
问题 I need to be able to manage user accounts using pe_accounts and hiera. This page: http://docs.puppetlabs.com/pe/latest/accounts_class.html#usage-example says I can create a module like site_accounts and add this text class {'pe_accounts': data_store => yaml, } to site_accounts/manifests/init.pp and then install this syntax --- sysop: locked: false comment: System Operator uid: '700' gid: '700' groups: - admin - sudonopw into a file named /var/lib/hiera/pe_accounts_users_hash.yaml and this

Puppet - Escaping YAML variables for Hiera

对着背影说爱祢 提交于 2019-12-12 13:59:06
问题 I have a pretty simple requirement, but I've tried every escape sequence I can think of, but can't get the output needed. I need to litterally output into a file: %{VAR} Here's my YAML file: myclass::outputstuff: - Heres a litteral var %{VAR} - Heres something else %{SOMETHING} And my template.erb: <%= @outputstuff.each do | ostuff | -%> <%= ostuff -%> <% end -%> But it like this, it outputs: Heres a litteral var Heres something else If I add a percent sign like %%{VAR} , as advised by other

How to setup a default hiera lookup value

巧了我就是萌 提交于 2019-12-12 06:00:08
问题 I am setting up my Puppet code using Hiera such that if a value is not found in Hiera, it assigns a default value to it. I am not getting the desired results and wanted to know how others did it : lookup( <NAME>, [<VALUE TYPE>], [<MERGE BEHAVIOR>], [<DEFAULT VALUE>] ) I think I found the answer https://www.devco.net/archives/2016/03/13/the-puppet-4-lookup-function.php , will try it shortly lookup({"name" => "some::thing", "default_value" => "default"}) 回答1: The solution that worked for me was

Python YAML hiera and how have value be inside double quotes?

核能气质少年 提交于 2019-12-12 04:35:24
问题 I have this code python_data_struct = { 'amazon_app_id': amazon_app_id, 'librivox_rest_url': librivox_rest_url, 'librivox_id': librivox_id, 'top': top, 'pacakge': 'junk', 'version': 'junk', 'password': password, 'description': description, 'long_description': long_description, 'make_audiobook::sftp_script::appname': '\"%{::appname}\"' } try: myyaml = yaml.dump(python_data_struct) except: e = sys.exc_info()[0] print "Error on %s Error [%s]" % ( librivox_rest_url, e ) sys.exit(5) write_file(

Puppet onlyif and unless conditional test from boolean data in Hiera and CLI script output

℡╲_俬逩灬. 提交于 2019-12-11 16:00:04
问题 I am running Puppet v3.0 on RHEL 6 and am doing package management via the exec resource. I would like to add a number of control gates into my manifest via onlyif and unless . First I would like to use booleans as defined in Hiera [ auto lookup function ]. Secondly I would like to use booleans from a bash script running diff <() <() . Im using the following hiera data : --- my-class::package::patch_now: 0 my-class::package::package_list: acl-2.2.49-6.el6-x86_64 acpid-1.0.10-2.1.el6-x86_64 ..

How to get hiera to output the literal string '%{::fqdn}'?

蹲街弑〆低调 提交于 2019-12-11 07:59:25
问题 I would like to know what I would need to have in my yaml file to have hiera output the literal string %{::fqdn} instead of outputting the value of the puppet fact fqdn . Here is what I have tried. # grep foo::p4 /etc/puppetlabs/code/environments/production/hieradata/bar.yaml foo::p4: 'http://%{hiera(''p1'')}/%{::fqdn}' And this is the result: # hiera foo::p4 '::prefix_fact=bar' '::fqdn=thing.com' environment=production http://test/thing.com What I actually want the output to be is: http://%

Do basic math inside Hiera

送分小仙女□ 提交于 2019-12-10 15:59:10
问题 I'm trying to set a crontab's weekday in hiera based on a custom fact and a basic modulo but I can't even figure out if it's possible. I'd like to do something like: cron-job: command: "do something" user: myuser hour: "%{::instance}" minute: "%{::instance}" weekday: "%{::instance}" % 7 Can that even be done? 回答1: No, this is not possible. Please keep in mind that the YAML is just data , not code. Hiera does offer some transformations using Interpolation Tokens, but there are only two

Puppet - set defaults in manifest if not present in hiera when iterating over hash

最后都变了- 提交于 2019-12-10 10:25:56
问题 I am iterating over many entries in a hiera hash, and wish to remove identical duplicate lines from hiera by setting defaults in the manifest (such as ensure , groups , managehome etc), and have the defaults overridden IF the duplicate key/value pair exists in hiera. To date, everything I have tried fails to get the default values. I get the idea that I need to declare a resource, but am uncertain. I have tried setting "default_values_hash" in the lookup and other methods, but nothing appears