This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
puppet [2017/03/28 14:48] k2patel [Value in manifests] |
puppet [2019/03/07 14:53] k2patel [Puppet Dynamic values playground] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Puppet (data center automation and configuration management framework) ====== | ====== Puppet (data center automation and configuration management framework) ====== | ||
+ | |||
+ | [[Puppet Upgrade 4.x to 5.x]] | ||
==== Puppet YUM Repository ==== | ==== Puppet YUM Repository ==== | ||
Line 39: | Line 41: | ||
</code> | </code> | ||
+ | ==== Puppet Dynamic values playground ==== | ||
+ | === EPP and passing values === | ||
+ | <code ruby> | ||
+ | $template_parameters = { | ||
+ | test => $test1, | ||
+ | test2 => $test::test, | ||
+ | nice => $works, | ||
+ | } | ||
+ | |||
+ | content => epp('vsftpd/template.epp', $template_parameters), | ||
+ | </code> | ||
+ | ==== trimming values ==== | ||
+ | Following can grab the last character from the hostname and convert to integer to avoid warning. | ||
+ | <code ruby> | ||
+ | $esnumber = inline_epp('<%= Integer.new($::hostname[-1,1]) + 1 %>') | ||
+ | </code> | ||
==== Checking Hiera Value ==== | ==== Checking Hiera Value ==== | ||
**Trying to lookup vhostip value** | **Trying to lookup vhostip value** | ||
Line 279: | Line 297: | ||
create_resources('apache::vhost', $myApacheVhost) | create_resources('apache::vhost', $myApacheVhost) | ||
</code> | </code> | ||
+ | |||
+ | ==== Troubleshooting ==== | ||
+ | === duplicate resource was found while collecting exported resources === | ||
+ | 8-O | ||
+ | <code bash | error > | ||
+ | Info: Loading facts | ||
+ | Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: A duplicate resource was found while collecting exported resources, with the type and title Apache::Balancermember[visualizer] on node testserver.k2patel.in | ||
+ | Warning: Not using cache on failed catalog | ||
+ | Error: Could not retrieve catalog; skipping run | ||
+ | </code> | ||
+ | |||
+ | |||
+ | Many suggestions from the puppet forums to run query shown below, didn't helped. | ||
+ | |||
+ | <code bash | depend on your puppet version select one which works> | ||
+ | sudo -u postgres psql puppetdb -c 'delete from catalogs where certname in (select certname from certnames where certname like '%testserver.k2patel.in%');' | ||
+ | |||
+ | sudo -u postgres psql puppetdb -c 'delete from catalogs where id in (select id from certnames where certname like '%testserver.k2patel.in%');' | ||
+ | </code> | ||
+ | |||
+ | Only thing worked for me to drop database and recreate. | ||
+ | |||
+ | <code bash> | ||
+ | systemctl stop puppetdb | ||
+ | su - postgres | ||
+ | dropdb puppetdb | ||
+ | createdb -E UTF8 -O puppetdb puppetdb | ||
+ | psql puppetdb -c 'create extension pg_trgm'; | ||
+ | </code> | ||
+ | |||
+ | === Mapping values === | ||
+ | <code ruby> | ||
+ | <%- $ips = $vs_map[$name].map |$val| { $val['address']['ip'] } -%> | ||
+ | </code> | ||
+ | |||
==== External Links ==== | ==== External Links ==== | ||
Line 287: | Line 340: | ||
[[ https://groups.google.com/group/puppet-users/browse_thread/thread/e56e0f678a134089 | Incremental Number ]] | [[ https://groups.google.com/group/puppet-users/browse_thread/thread/e56e0f678a134089 | Incremental Number ]] | ||
+ | |||
+ | [[ https://github.com/jessereynolds/puppet_certificate_extensions_facts | Trusted facts example ]] |