Lambdas: counting up php-fpm worker ports with each

asked 2014-07-15 04:55:56 -0500

Hi folks,

I'm using puppet 3.6 with the future parser. Now I'm trying to create PHP-FPM workers over an hiera hash:

    "password": "asdfasdf"
    "server_name": ""
    "password": "asdfasd2f"
    "server_name": ""

So I've the keys (testuser and testuser2) and now I want to create the pools (I'm calling my php-fpm module with create_ressources and a hash)

$website::website_values.each |$site, $value| {
$fpm_host = ""
$php_fpm_pools = {
        "$site" => {
                listen => "${fpm_host}:${fpm_port}",
                user => $site,

$fpm_port has to be 9000 and +1 for every user. So I'm counting (stdlib) the keys:

$keys = keys($website::website_values)
        $count = count($keys)

now I know, that I've 2 fpm pools to be created. so I need the following fpm ports: 9001, 9002

how can I couting up $fpm_port = 9000 +1 $x times for my hash?

=> and no, I dont want do declare the port in hiera manually :-)

edit retag flag offensive close merge delete