Search code examples
listmodulepuppet

Puppet cli and list of variables


First time asking after a long time reading. :)

I am trying to write a puppet module with a list of packages to install using a shell command (Cannot use the package module as the packages are installed using conda).

  class deep_learning {
  $deep_learning_package_list = [ 'numpy' , 'pandas' ]

  $deep_learning_package_list.each |$deep_learning_package| {
    command  => '/opt/mambaforge/bin/conda install $deep_learning_package',
    provider => shell,
    }
  } 
}

What am I doing wrong?


Solution

  • I resolved this using one variable and a command:

      class deep_learning {
      $deep_learning_package_list = "numpy pandas"
    
      exec { "/opt/mambaforge/bin/conda install -y ${deep_learning_package_list}":
      }
      }