This message was deleted.
# puppet
s
This message was deleted.
b
yes that still works
c
hmm 🤔 wonder why I'm not seeing any change
Copy code
$ sudo cat local_modules/profile/manifests/nodejs/hello.pp                                                                                                                          class profile::nodejs::hello {                                                                                                                                                                 file { '/tmp/hello.txt':                                                                                                                                                                ensure  =>  file,                                                                                                                                                                     content => "hello, world\n",                                                                                                                                                        }                                                                                                                                                                                   }
b
you define a class but you dont call the class
l
if it's meant to be part of the module, you would be better off setting a module path and
puppet apply -e 'include profile::nodejs::hello'
y
And maybe you’d like to consider using Puppet Bolt instead :)
c
I'm a puppet n00b, so learning Bolt right now might muddy the waters 😉
@bastelfreak care to elaborate?
@Lumiere that helped. Thanks. I needed to specify my module path and then that...and it worked.
b
you need to add the class to the catalog, for example with include
l
yea, my puppet apply is literally just creating a catalog that only includes the class (and whatever it needs)
c
Now I'm getting this 🙁
l
what version of puppet are you running?
also, you should really use ubuntu's dpkg for nodejs if at all possible
💯 1
c
7.20.0
l
instead of execing a curl | bash
you can't determine if that exec was idempotent
c
I'm trying to figure out how to deploy strapi and I believe it needs a particular version of nodejs, hence why I'm trying it this way.
l
you're going to need to deep dive how to do that, because exec is almost never the right choice
l
the idea in puppet is to deterministically say what each managed resource is and let puppet figure out how to get there
c
@Lumiere I agree with non idempotent ways...but I'm just trying to get something to work for now..and can refactor later. Both Puppet and Strapi are new to me 😄 ( ansible background )
l
ok, so reading the script, all it really does is install a gpgkey and echo to a .d file
c
but that isn't the error I'm getting though. I thought the issue is on the nodejs class part?
l
so what I would do is review https://deb.nodesource.com/setup_16.x and just create an apt_source and give it the right url and gpgkey and then in the nodejs class, you may need to actually go and check if it actually works
I don;t know what nodejs class you are using
c
l
yea, looks like you need to make a patch / PR to that https://github.com/voxpupuli/puppet-nodejs/blob/master/manifests/params.pp and then ask #C0W1Y5VL0 to review it
you'll also want to run a --debug on that likely to try and figure out where it was actually trying to do that
c
<- Puppet n00b remember? Not sure what to do with the params.pp patch/PR you're talking about.
l
https://github.com/voxpupuli/puppet-nodejs/blob/master/manifests/params.pp#L54-L76 the first section of that is the definitions for 20.04, the second is the fallbacks
b
as an alternative approach I recommend rolling out dns/ntp configs ans ssh keys. that is quite easy and helps you a lot to understand the Puppet DSL
every other task afterwards will be easier
l
yea, that would be a better starting point
b
and no matter how dump a question might look, ask it anyways
l
in your case, nodesource is already configured by the nodejs class, you just need to tell it what version you want
b
puppet if flexible so it works in every environment. that means many solutions bring the same result. but learning to digferentiate between the easy and tricky solutions takes a but of time and feedback. so starz with the easy stuff to learn the basics
l
and understand that the learning curve is steep, so take your time and get your footing
c
Thanks for the suggestions @bastelfreak I feel like I do understand some of the basics, but unfortunately I'm tasked with getting this app deployed and need to use Puppet. 😕
@Lumiere I took the
exec
part out of the install.pp file and still get the same error
b
is there a reason for using puppet apply? is that usually used in that environment or do you just use it for tests?
c
for testing...so I don't have 1400 git commits in my branch to push up and test 😄 Was hoping to test some of this locally
b
if the puppet agent is usually used, stick to it
this 1
k
usually for testing you branch your control repo and use
puppet agent --environment
to run that branch's code
b
there is probably a bunch of stuff comfigured via puppet and during your tests your are only using a fraction of it, that can lead to side effects
c
yes, but I don't want a ton of commits for me learning this stuff. I'd like to reduce the noise that others see on the repo.
l
is there anyone in your org with puppet experience that you could partner with for learning? (this seems like bad managerial practice to throw someone under the bus like this)
💯 1
so, I recommend making a branch and then squashing the commits before PR
b
do you have your own test branch/environment?
c
@Lumiere yes I planned on doing that...but still didn't want to have all the commits out there for every little typo/thing I try
k
it's good to have the history of your attempts
b
people call me principal automation architect and I can probably produce 200 commits with typos a day, not on purpose
as long as the git server doesnt burn under the load thats totally fine :D
c
OK, I guess I can try this particular code via pushing it up to the branch and let Foreman do it's thing...but I will be back if I get the same error there too 😉
r
when running apply locally you usually need to do something like this.
Copy code
# cwd should be your control repo
# populate upstream modules
r10k puppetfile install
# run puppet. You might need to specify something other than site.pp
# depending on how you're classifying nodes
sudo puppet apply manifests/site.pp --modulepath=modules/:site/ --hiera_config=hiera.yaml -tv
big caveat on the above is that it almost never works in large environments with facts, ec2 tagging, ENC/foreman, etc. However you can make a test.pp in place of the site.pp to load just a module or two if you're still in the process of learning Puppet.
c
@ramindk That's what I did, but got the error I mentioned above. What I'm trying to test now, shouldn't be pulling any custom vars from Foreman or anything...and I've already installed the modules via
r10k
and specified the
--modulepath
on the cli...as well as setting that in the
environment.conf
file
OK, well. it actually worked when I pushed it up to the branch and ran it via
agent/Foreman
Thanks for all of your help! @Lumiere @bastelfreak
👍 1