awx-manage command can create log files readable only by root user leading to startup failure

Solution Verified - Updated -

Issue

After running awx-manage as the root user, Ansible Automation Platform fails to start with "permission denied" errors such as the following in /var/log/supervisor/awx-uwsgi.log:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/logging/config.py", line 565, in configure
    handler = self.configure_handler(handlers[name])
  File "/usr/lib64/python3.6/logging/config.py", line 738, in configure_handler
    result = factory(**kwargs)
  File "/usr/lib64/python3.6/logging/handlers.py", line 437, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib64/python3.6/logging/__init__.py", line 1032, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib64/python3.6/logging/__init__.py", line 1061, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
PermissionError: [Errno 13] Permission denied: '/var/log/tower/management_playbooks.log'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/wsgi.py", line 39, in <module>
    application = get_wsgi_application()
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/utils/log.py", line 76, in configure_logging
    logging_config_func(logging_settings)
  File "/usr/lib64/python3.6/logging/config.py", line 802, in dictConfig
    dictConfigClass(config).configure()
  File "/usr/lib64/python3.6/logging/config.py", line 573, in configure
    '%r: %s' % (name, e))
ValueError: Unable to configure handler 'management_playbooks': [Errno 13] Permission denied: '/var/log/tower/management_playbooks.log'
unable to load app 0 (mountpoint='') (callable not found or import error)

Environment

  • Ansible Automation Platform
    • 1.2
    • 2.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content