diff --git a/changelogs/fragments/3426-copy-permissions-along-with-file-for-jboss-module.yml b/changelogs/fragments/3426-copy-permissions-along-with-file-for-jboss-module.yml new file mode 100644 index 0000000000..7685cce02b --- /dev/null +++ b/changelogs/fragments/3426-copy-permissions-along-with-file-for-jboss-module.yml @@ -0,0 +1,6 @@ +bugfixes: + - jboss - fix the deployment file permission issue when Jboss server is running + under non-root user. The deployment file is copied with file content only. The + file permission is set to ``440`` and belongs to root user. When the + JBoss ``WildFly`` server is running under non-root user, it is unable to read + the deployment file (https://github.com/ansible-collections/community.general/pull/3426). diff --git a/plugins/modules/web_infrastructure/jboss.py b/plugins/modules/web_infrastructure/jboss.py index 4c077a1ddb..5512e10ee4 100644 --- a/plugins/modules/web_infrastructure/jboss.py +++ b/plugins/modules/web_infrastructure/jboss.py @@ -142,7 +142,7 @@ def main(): # Clean up old failed deployment os.remove(os.path.join(deploy_path, "%s.failed" % deployment)) - shutil.copyfile(src, os.path.join(deploy_path, deployment)) + module.preserved_copy(src, os.path.join(deploy_path, deployment)) while not deployed: deployed = is_deployed(deploy_path, deployment) if is_failed(deploy_path, deployment): @@ -153,7 +153,7 @@ def main(): if state == 'present' and deployed: if module.sha1(src) != module.sha1(os.path.join(deploy_path, deployment)): os.remove(os.path.join(deploy_path, "%s.deployed" % deployment)) - shutil.copyfile(src, os.path.join(deploy_path, deployment)) + module.preserved_copy(src, os.path.join(deploy_path, deployment)) deployed = False while not deployed: deployed = is_deployed(deploy_path, deployment)