Why is my Ansible Tower Job Failing with error `raise os.error, 'out of pty devices'`?

Solution Verified - Updated -

Environment

  • Ansible Tower 3.8.5-2

Issue

  • Ansible Tower job fails with raise os.error, 'out of pty devices'

Resolution

  • The issue has been fixed in Ansible Tower version 3.8.5-3 onwards.

  • The following steps can be followed as a workaround in lower minor version

  • Take the backup of current configuration using below command:

     # cp /var/lib/awx/venv/awx/lib/python3.6/site-packages/ansible_runner/runner_config.py /tmp/runner_config.py.orig
    
  • Edit the file with the new values on line 471 as per the example below:

      '--dev', '/dev',                                       ---->       Change this values with below 
      '--dev-bind', '/dev', 'dev',
    
  • Stop and Start the Tower services to apply the changes:

    # ansible-tower-service stop
    # ansible-tower-service start
    
  • Enable JOB ISOLATION and re-run the job.

  • If the file change is not possible we can disable job isolation and run the JOB template.

    Go to SETTINGS > JOBS > TOGGLE OFF ENABLE JOB ISOLATION and then re-run the job template.
    

Root Cause

  • This issue was caused by a wrong mapping while using bwrap (process isolation).

Diagnostic Steps

  • You'll see below error on job logs when you run the job template:

     File "/usr/lib64/python2.7/pty.py", line 70, in _open_terminal
        raise os.error, 'out of pty devices'
     OSError: out of pty devices
    

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments