Allow to disable HTTPS (soon mandatory to run acceptance tests)
file { "${sys_rootpath}/${_archive_rootdir}/config/packages/prod/":
ensure => 'directory',
owner => $sys_user,
group => $sys_group,
mode => '0750',
require => [
File["${sys_rootpath}/${_archive_rootdir}"],
],
}
if $app_disable_https {
file { "${sys_rootpath}/${_archive_rootdir}/config/packages/prod/nelmio_security.yaml":
ensure => 'file',
mode => '0600',
owner => $sys_user,
group => $sys_group,
content => stdlib::to_yaml({ 'nelmio_security' => { 'forced_ssl' => { 'enabled' => false } } }, { indentation => 4 }),
require => [
File["${sys_rootpath}/${_archive_rootdir}/config/packages/prod/"],
],
}
}
Ressources
similar to: adullact/puppet-tajine!39 (comment 126144)
@fcombernous comment: instead of
exec
it is safer to usefile
with function : https://github.com/puppetlabs/puppetlabs-stdlib/blob/main/REFERENCE.md#stdlib--to_yaml
see: puppetlabs-stdlib/spec/functions/to_yaml_spec.rb
describe 'to_yaml' do
...
it {
is_expected.to run.with_params('one' => { 'oneA' => 'A', 'oneB' => { 'oneB1' => '1', 'oneB2' => '2' } }, 'two' => ['twoA', 'twoB'])
.and_return("---\none:\n oneA: A\n oneB:\n oneB1: '1'\n oneB2: '2'\ntwo:\n- twoA\n- twoB\n")
}
it { is_expected.to run.with_params({ 'foo' => { 'bar' => true, 'baz' => false } }, :indentation => 4).and_return("---\nfoo:\n bar: true\n baz: false\n") }
see also: vagrant-comptoir-du-libre puppet/manifests/default.pp
# source: https://gitlab.adullact.net/Comptoir/vagrant-comptoir-du-libre/-/blob/main/puppet/manifests/default.pp
file { '/opt/comptoir/comptoir/config/packages/prod/nelmio_security.yaml':
ensure => 'file',
mode => '0640',
content => "nelmio_security:\n forced_ssl:\n enabled: false",
require => [
Class['comptoir'],
File["/opt/comptoir/comptoir/config/packages/prod/"],
],
}
exec { 'console cache:warmup, after disable HTTPS Comptoir-du-Libre configuration':
command => "/opt/comptoir/comptoir/bin/console cache:warmup",
cwd => "/opt/comptoir/comptoir",
user => 'www-data',
group => 'www-data',
environment => [
'APP_ENV=prod',
'APP_DEBUG=0',
],
require => [
Class['comptoir'],
File["/opt/comptoir/comptoir/config/packages/prod/nelmio_security.yaml"],
],
}
Edited by Fabrice Gangler