diff --git a/manifests/app_type.pp b/manifests/app_type.pp index 7e52592..d8096b1 100644 --- a/manifests/app_type.pp +++ b/manifests/app_type.pp @@ -113,16 +113,25 @@ define sunetdrive::app_type ( minute => '*/5', } file { '/opt/nextcloud/user-sync.sh': - ensure => file, - owner => 'root', - group => 'root', - mode => '0700', - content => template('sunetdrive/application/user-sync.erb.sh'), + ensure => absent, } -> cron { 'gss_user_sync': - command => '/opt/nextcloud/user-sync.sh', - user => 'root', - minute => '*/5', + ensure => absent, + } + file { '/usr/local/bin/nocc': + ensure => present, + force => true, + owner => 'root', + group => 'root', + content => template('sunetdrive/application/nocc.erb'), + mode => '0740', + } + file { '/etc/sudoers.d/99-nocc': + ensure => file, + content => "script ALL=(root) NOPASSWD: /usr/local/bin/nocc\n", + mode => '0440', + owner => 'root', + group => 'root', } file { '/usr/local/bin/occ': ensure => present, diff --git a/manifests/multinode.pp b/manifests/multinode.pp index 5c4dff0..ed3def2 100644 --- a/manifests/multinode.pp +++ b/manifests/multinode.pp @@ -40,6 +40,21 @@ class sunetdrive::multinode ( user { 'www-data': ensure => present, system => true } sunet::system_user {'mysql': username => 'mysql', group => 'mysql' } ensure_resource('file', '/opt/nextcloud' , { ensure => directory, recurse => true } ) + file { '/usr/local/bin/nocc': + ensure => present, + force => true, + owner => 'root', + group => 'root', + content => template('sunetdrive/application/nocc.erb'), + mode => '0740', + } + file { '/etc/sudoers.d/99-nocc': + ensure => file, + content => "script ALL=(root) NOPASSWD: /usr/local/bin/nocc\n", + mode => '0440', + owner => 'root', + group => 'root', + } file { '/usr/local/bin/occ': ensure => present, force => true, diff --git a/templates/application/nocc.erb b/templates/application/nocc.erb new file mode 100755 index 0000000..7985878 --- /dev/null +++ b/templates/application/nocc.erb @@ -0,0 +1,21 @@ +#!/bin/bash + +if [[ "${1}" =~ ^nextcloud ]]; then + container=${1} + shift +else + container="nextcloud_app_1" +fi + + +oc_list=$(env| grep 'OC_') +if [[ "x${oc_list}" != "x" ]]; then + for row in $(echo "${oc_list}"); do + MY_VARS="${MY_VARS} -e ${row}" + done +fi + +docker exec -ti ${MY_VARS} -u www-data ${container} php --define apc.enable_cli=1 /var/www/html/occ "$@" +exit 0 + +