ENC

37 views
Skip to first unread message

Sergiu Cornea

unread,
Dec 11, 2015, 5:54:02 PM12/11/15
to Puppet Users
Hello guys,

I have an ENC which is producing the right data as far as I could have test it (copy and paste it in a yaml file), however, when I am using Puppet directly Puppet seems to do nothing with it. 

This is my Puppet.conf file and logging shows that this script is being executed by the Puppet master, like I've said Puppet doesn't seem to be using the data.

[master]
  node_terminus = exec
  external_nodes = /var/lib/puppet/fetch_enc.sh

Thank you,

Regards,
Sergiu

Matt Zagrabelny

unread,
Dec 11, 2015, 8:00:42 PM12/11/15
to puppet...@googlegroups.com
On Fri, Dec 11, 2015 at 11:54 AM, Sergiu Cornea
<s.co...@my.westminster.ac.uk> wrote:
> Hello guys,
>
> I have an ENC which is producing the right data as far as I could have test
> it (copy and paste it in a yaml file), however, when I am using Puppet
> directly Puppet seems to do nothing with it.

Try running something like:

puppet master --no-daemonize --debug

and read the output.

You should see something like:

Debug: Executing '/var/lib/puppet/fetch_enc.sh yournode.example.com'

Try running that same command:

/var/lib/puppet/fetch_enc.sh yournode.example.com

and see what the output is.

Also, there should be plenty of debugging information in the output of
puppet master --no-daemonize --debug.

Cheers,

-m

> This is my Puppet.conf file and logging shows that this script is being
> executed by the Puppet master, like I've said Puppet doesn't seem to be
> using the data.
>
> [master]
> node_terminus = exec
> external_nodes = /var/lib/puppet/fetch_enc.sh
>
> Thank you,
>
> Regards,
> Sergiu
>
> This message and its attachments are private and confidential. If you have
> received this message in error, please notify the sender and remove it and
> its attachments from your system.
>
> The University of Westminster is a charity and a company limited by
> guarantee. Registration number: 977818 England. Registered Office: 309
> Regent Street, London W1B 2UW.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/8cee2af7-cc5a-4a0b-a941-06a070df6f72%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Sergiu Cornea

unread,
Dec 14, 2015, 10:11:18 AM12/14/15
to Puppet Users
Hi Matt,

Thank you for your answer.

I have executed the 2 commands that you've mentioned and for the first command (puppet master --no-daemonize --debug) shows that my script it is run, however, nothing it is happening with the data and the second command (/var/lib/puppet/fetch_enc.sh yournode.example.com ) gives me a hiera file, which matches the YAML file that I previously had. Also, I have done a syntax check on my Hiera Yaml file and seems fine.

Then only thing I cannot seem to understand is that I have edit the puppet.conf file and added those lines, I can execute the script and as I've said using the 2nd command I can clearly see the YAML file in the correct format as I have test it with the ruby -e command also I copy paste into a file called .yaml and run it and runs smoothly.

I don't know what really goes on and Puppet does nothing with it :(

Thank you once again,

Kind regards,
Sergiu

Doug Byrne

unread,
Dec 14, 2015, 2:26:51 PM12/14/15
to Puppet Users
What does your ENC output look like? You keep refering to it as Hiera YAML, but ENC and Hiera are not the same. Make sure it follows the format rules here: https://docs.puppetlabs.com/guides/external_nodes.html#enc-output-format

-Doug

Sergiu Cornea

unread,
Dec 14, 2015, 2:31:09 PM12/14/15
to Puppet Users
Hi Doug,

Thank you for your reply.

This is what my ENC output looks like:

  1. classes:
  2.     docker_host:
  3.     docker:
  4.       extra_parameters:
  5.         - "--tlsverify"
  6.         - "--tlscacert=/etc/ssl/certs/my.crt"
  7.         - "--tlscert=/etc/ssl/certs/new.crt"
  8.         - "--tlskey=/etc/ssl/private/akey.pem"
  9.     docker_certs:
  10. parameters:
  11.   docker::username: username
  12.   docker::registry: registry.com
  13.   docker::email: email@email.com
  14.   docker::tcp_bind: tcp://0.0.0.0:1111
  15.   docker::password: mypassword
  16. environment: production
However, I believe it is sort of working, but Puppet started complaining now about the docker::username: saying that's empty and couldn't be found in any Hiera files and no default has been set-up...To be honest, I don't know why I am getting this error :( , I've tried spacing it, remove completely the spacing but no luck. 

What do you think I might be doing wrong?

Thank you,

Kind regards,
Sergiu

On Friday, 11 December 2015 17:54:02 UTC, Sergiu Cornea wrote:

Doug Byrne

unread,
Dec 14, 2015, 8:45:46 PM12/14/15
to Puppet Users
I've only ever used the ENC to set top scope variables, and the documentation only mentions top scope variables. Maybe class scoped variables can't be set by ENC using the parameters section. You could try adding those parameters under classes:docker: or use Hiera.

jcbollinger

unread,
Dec 15, 2015, 2:31:22 PM12/15/15
to Puppet Users


On Monday, December 14, 2015 at 8:31:09 AM UTC-6, Sergiu Cornea wrote:
Hi Doug,

Thank you for your reply.

This is what my ENC output looks like:

  1. classes:
  2.     docker_host:
  3.     docker:
  4.       extra_parameters:
  5.         - "--tlsverify"
  6.         - "--tlscacert=/etc/ssl/certs/my.crt"
  7.         - "--tlscert=/etc/ssl/certs/new.crt"
  8.         - "--tlskey=/etc/ssl/private/akey.pem"
  9.     docker_certs:
  10. parameters:
  11.   docker::username: username
  12.   docker::registry: registry.com
  13.   docker::email: email@email.com
  14.   docker::tcp_bind: tcp://0.0.0.0:1111
  15.   docker::password: mypassword
  16. environment: production
However, I believe it is sort of working, but Puppet started complaining now about the docker::username: saying that's empty and couldn't be found in any Hiera files and no default has been set-up...To be honest, I don't know why I am getting this error :( , I've tried spacing it, remove completely the spacing but no luck. 

What do you think I might be doing wrong?


The 'parameters' key in the ENC output format is for specifying a hash whose entries will be exposed to the catalog compiler as top-scope variables.  You appear to be trying instead to use it to give class parameters for class 'docker'.  Oddly, however, not for all the parameters of class 'docker' -- you are giving a value for class parameter $docker::extra_parameters in the proper way.

It appears that you want your ENC to produce something more like:

classes:
  docker_host
:
  docker
:
    username
: username
    registry
: registry.com
    email
: email@email.com
    tcp_bind
: tcp://0.0.0.0:1111
    password
: mypassword
    extra_parameters
:

     
- "--tlsverify"
     
- "--tlscacert=/etc/ssl/certs/my.crt"
     
- "--tlscert=/etc/ssl/certs/new.crt"
     
- "--tlskey=/etc/ssl/private/akey.pem"
  docker_certs
:

environment
: production


I have removed the 'parameters' key because no entries remained in it, but that's not strictly necessary.  Puppet ENC behavior and output format is covered well by the PuppetLabs documentation.


John

Reply all
Reply to author
Forward
0 new messages