Changed installation to Debian package
App store and web update are now disabled. Apps need to be installed with as Debian packages as well.
This commit is contained in:
parent
68e0865931
commit
650562a73d
7 changed files with 49 additions and 75 deletions
|
|
@ -6,7 +6,6 @@ import json
|
|||
|
||||
def run_module():
|
||||
module_args = {
|
||||
'nextcloud_path': {'type': 'str', 'default': '/var/www/nextcloud'},
|
||||
'config': {'type': 'dict', 'default': {}}
|
||||
}
|
||||
|
||||
|
|
@ -24,10 +23,7 @@ def run_module():
|
|||
if 'config_id' not in module.params:
|
||||
module.params['config_id'] = 's01'
|
||||
|
||||
os.chdir(module.params['nextcloud_path'])
|
||||
|
||||
rc, stdout, stderr = module.run_command(['/usr/bin/php', 'occ', 'ldap:show-config', '--show-password', '--output', 'json'], check_rc=True,
|
||||
cwd=module.params['nextcloud_path'])
|
||||
rc, stdout, stderr = module.run_command(['nextcloud-occ', 'ldap:show-config', '--show-password', '--output', 'json'], check_rc=True)
|
||||
|
||||
try:
|
||||
current_configs = json.loads(stdout)
|
||||
|
|
@ -41,15 +37,13 @@ def run_module():
|
|||
module.fail_json(msg=f"Config ID ({module.params['config']['config_id']}) does not match next free config ID ({new_config_id})!", **result)
|
||||
|
||||
if not module.check_mode:
|
||||
rc, stdout, stderr = module.run_command(['/usr/bin/php', 'occ', 'ldap:create-empty-config', '--only-print-prefix'], check_rc=True,
|
||||
cwd=module.params['nextcloud_path'])
|
||||
rc, stdout, stderr = module.run_command(['nextcloud-occ', 'ldap:create-empty-config', '--only-print-prefix'], check_rc=True)
|
||||
new_config_id = stdout.strip()
|
||||
|
||||
if new_config_id != new_config_id_calculated:
|
||||
module.fail_json(msg=f"New config id ({new_config_id}) is not the same as calculated id ({new_config_id_calculated})!", **result)
|
||||
|
||||
rc, stdout, stderr = module.run_command(['/usr/bin/php', 'occ', 'ldap:show-config', '--show-password', '--output', 'json'], check_rc=True,
|
||||
cwd=module.params['nextcloud_path'])
|
||||
rc, stdout, stderr = module.run_command(['nextcloud-occ', 'ldap:show-config', '--show-password', '--output', 'json'], check_rc=True)
|
||||
|
||||
try:
|
||||
current_configs = json.loads(stdout)
|
||||
|
|
@ -73,25 +67,22 @@ def run_module():
|
|||
|
||||
if not module.check_mode:
|
||||
try:
|
||||
module.run_command(['/usr/bin/php', 'occ', 'ldap:set-config', module.params['config']['config_id'], key,
|
||||
module.run_command(['nextcloud-occ', 'ldap:set-config', module.params['config']['config_id'], key,
|
||||
';'.join(new_config[key]) if isinstance(new_config[key], list) else str(new_config[key])],
|
||||
check_rc=True, cwd=module.params['nextcloud_path'])
|
||||
check_rc=True)
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Error on key " + key + " : " + str(e), **result)
|
||||
|
||||
rc, stdout, stderr = module.run_command(['/usr/bin/php', 'occ', 'ldap:test-config', module.params['config']['config_id']], check_rc=True,
|
||||
cwd=module.params['nextcloud_path'])
|
||||
rc, stdout, stderr = module.run_command(['nextcloud-occ', 'ldap:test-config', module.params['config']['config_id']], check_rc=True)
|
||||
|
||||
if stdout.strip() != 'The configuration is valid and the connection could be established!':
|
||||
module.fail_json(msg=f"LDAP connection test failed: {stdout}", **result)
|
||||
|
||||
if not module.check_mode:
|
||||
module.run_command(['/usr/bin/php', 'occ', 'ldap:set-config', module.params['config']['config_id'], 'ldapConfigurationActive', '1'], check_rc=True,
|
||||
cwd=module.params['nextcloud_path'])
|
||||
module.run_command(['nextcloud-occ', 'ldap:set-config', module.params['config']['config_id'], 'ldapConfigurationActive', '1'], check_rc=True)
|
||||
|
||||
# set update interval, seems necessary to activate sync.
|
||||
module.run_command(['/usr/bin/php', 'occ', 'config:app:set', 'user_ldap', 'updateAttributesInterval', '--value=86400'], check_rc=True,
|
||||
cwd=module.params['nextcloud_path'])
|
||||
module.run_command(['nextcloud-occ', 'config:app:set', 'user_ldap', 'updateAttributesInterval', '--value=86400'], check_rc=True)
|
||||
|
||||
module.exit_json(**result)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue