# puppet and managing ports : many questions



## nORKy (Sep 9, 2011)

I'm testing sysutils/puppet to manage many FreeBSD servers.

I have many questions about ports:

- puppet has a module to manage ports with portupgrade. I'm a portmaster user: what is the difference?
- portupgrade needs to be in "batch=yes": so all ports validate defaults options; I don't want this. How can I make a *make config* before myself? I think I can do a *make config* on the puppet server and send the options file, what do you think ? 

Thank you.


----------



## pestaa (Nov 14, 2011)

I'd be also curious as how others have done this. Puppet doesn't excel when it comes to source compilation.


----------



## pestaa (Nov 15, 2011)

nORKy said:
			
		

> ... and send the options file, what do you think ?



Seems like syncing /var/db/package/options is the only feasible way. If that file is missing, make config runs and kicks into interactive mode immediately.

There is also no such command to create these options files partially (defining a setting or two, leaving the others to default), but I'm hesitant to leave it at that.

The best way imho would be `# make config-default --OPTION1=off --OPTION2=on` so that the options file become 
	
	



```
WITHOUT_OPTION1=true
WITH_OPTION2=true
WITH_OPTION3=true
```
 even though the default options were 
	
	



```
OPTION1 on
OPTION2 off
OPTION3 on
```

However, I couldn't figure out how to extend the central port makefile (/usr/ports/Mk/bsd.port.mk) with another make target. I think I'll try including the new script from the inside.


----------



## SirDice (Nov 15, 2011)

Use something like this in /etc/make.conf:

```
.if ${.CURDIR:M*/some/port}
WITH_OPTION1=YES
WITHOUT_OPTION2=YES
.endif
```


----------



## mix_room (Nov 15, 2011)

You could also run your own package repository where puppet can fetch your packages. 
You would then need a machine where you could build all the programs as you want them, package them, and then upload them.


----------



## pestaa (Nov 16, 2011)

SirDice said:
			
		

> Use something like this in /etc/make.conf



This assumes the current directory is properly switched to each and every port puppet installs.

But the bigger issue still is the dialog that pops up if not all options are defined.



			
				mix_room said:
			
		

> You could also run your own package repository where puppet can fetch your packages.



That's a lot of infrastructure for a relatively small problem.


----------



## mix_room (Nov 17, 2011)

pestaa said:
			
		

> That's a lot of infrastructure for a relatively small problem.



You should (ideally) be testing your compiles anyway. As such you should have one build of each installed somewhere, hence its relatively easy to make a package. Just dump this on a web-host somewhere - ie install www/lighttpd or www/apache? on your package builder, and VOILA there is your package repository. 

Perhaps you will get a better solution if you explain your problem in more detail. Are the servers identical? Are they completely different? Do you really need to build from source, and are the requirements different for every server. And: what is 'many servers' for you?

EDIT: 
http://bsdbased.com/2010/03/23/freebsd-binary-package-repository-howto
http://lists.freebsd.org/pipermail/freebsd-questions/2006-May/122646.html
Might be of interest.


----------

