``profile::mkresource::files`` ============================== ``profile::mkresource::files`` is a puppet ``define`` (a.k.a. ``function``) which easily allows the creation of files through the puppet ``file`` resource (through the ``create_resources`` puppet function. This ``define`` is intended to be called in a controlled way from a ``role`` or from another ``profile``, through an ``Array`` list. However, it also allows the possibility to provide freedom by calling it through a ``Hash`` of files. Further information is explained below": * ``Array``: In order to have more control on the files that are being created. In example:: # Begin: puppet class class role::hpc::ui ( Array $scratch = hiera('base::scratch', []), ... ) { ... profile::mkresource::files { "scratch": files => $scratch, defaults => { mode => '1777' }; } ... } # End: puppet class # Begin: hiera call base::scratch: - '/scratch' - '/ssd-scratch' # End: hiera call * ``Hash``: This will provide more flexibility from the user side. Only really strange cases will be allowed. Example:: # Begin: puppet class class role::hpc::ui ( Array $scratch = hiera('base::scratch', {}), ... ) { ... profile::mkresource::files { "scratch": files => $scratch; } ... } # End: puppet class # Begin: hiera call base::scratch: '/scratch': ensure: directory mode: '1777' owner: 'root' group: 'root' '/ssd-scratch' ensure: directory mode: '1770' group: 'svc-cluster_merlin5' # End: hiera call Parameters ---------- ========== ==================== ========================== **Name** **Type** **Default** ---------- -------------------- -------------------------- $files Variant[Array, Hash] {} $defaults Hash {} ========== ==================== ========================== ``files`` ~~~~~~~~~ Defaults to ``Hash`` type ``{}``. Whenever is an ``Array``, it will be converted to ``Hash`` as ``create_resources`` is used and it always expects a ``Hash``. Two different call examples: * ``Hash``:: base::scratch: '/scratch': ensure: directory mode: '1777' owner: 'root' group: 'root' '/ssd-scratch' ensure: directory mode: '1770' group: 'svc-cluster_merlin5' * ``Array``:: base::scratch: - '/scratch' - '/ssd-scratch' ``defaults`` ~~~~~~~~~~~~ Defaults to empty ``Hash``. Should contain ``file`` resource parameters (in example, ``mode``, ``owner``, ``group``, ``ensure``, etc.) Example:: profile::mkresource::files { "scratch": files => [ '/scratch', '/ssd-scratch' ], defaults => { mode => '1777' }; }