Timeout when waiting for postgres:5432 psycopg2.OperationalError: could not translate host name "postgres" to address: Nam│ │127.0.0.1 | FAILED! "unable to connect to database: could not translate host name \"postgres\" to address: Name or service no

macOS Docker Desktop

% docker --version
Docker version 19.03.13, build 4484c46d9d

% ansible --version
ansible 2.10.2
config file = None
configured module search path = [‘/Users/admin/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.8.6 (default, Oct 8 2020, 14:06:32) [Clang 12.0.0 (clang-1200.0.32.2)]

docker logs -f awx_task

Using /etc/ansible/ansible.cfg as config file │
│Using /etc/ansible/ansible.cfg as config file │
│127.0.0.1 | FAILED! => { │
│ “ansible_facts”: { │
│ “discovered_interpreter_python”: “/usr/libexec/platform-python” │
│ }, │
│ “changed”: false, │
│ “elapsed”: 300, │
│ “msg”: “Timeout when waiting for postgres:5432” │
│} │
│Using /etc/ansible/ansible.cfg as config file │
│An exception occurred during task execution. To see the full traceback, use -vvv. The error was: psycopg2.OperationalError: could not translate host name “postgres” to address: Nam│
│127.0.0.1 | FAILED! => { │
│ “ansible_facts”: { │
│ “discovered_interpreter_python”: “/usr/libexec/platform-python” │
│ }, │
│ “changed”: false, │
│ “msg”: “unable to connect to database: could not translate host name "postgres" to address: Name or service not known\n” │
│} │
│2020-10-21 11:05:17,620 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set│
│2020-10-21 11:05:17,620 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set│
│2020-10-21 11:05:17,927 INFO RPC interface ‘supervisor’ initialized │
│2020-10-21 11:05:17,927 INFO RPC interface ‘supervisor’ initialized │
│2020-10-21 11:05:17,927 CRIT Server ‘unix_http_server’ running without any HTTP authentication checking │
│2020-10-21 11:05:17,927 CRIT Server ‘unix_http_server’ running without any HTTP authentication checking │
│2020-10-21 11:05:17,928 INFO supervisord started with pid 103 │
│2020-10-21 11:05:17,928 INFO supervisord started with pid 103 │
│2020-10-21 11:05:18,931 INFO spawned: ‘awx-config-watcher’ with pid 106 │
│2020-10-21 11:05:18,931 INFO spawned: ‘awx-config-watcher’ with pid 106 │
│2020-10-21 11:05:18,935 INFO spawned: ‘dispatcher’ with pid 107 │
│2020-10-21 11:05:18,935 INFO spawned: ‘dispatcher’ with pid 107 │
│2020-10-21 11:05:18,938 INFO spawned: ‘callback-receiver’ with pid 108 │
│2020-10-21 11:05:18,938 INFO spawned: ‘callback-receiver’ with pid 108 │
│READY │
│2020-10-21 11:05:20,041 INFO success: awx-config-watcher entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) │
│2020-10-21 11:05:20,041 INFO success: awx-config-watcher entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) │
│2020-10-21 11:05:20,041 INFO success: dispatcher entered RUNNING state, process has stayed up for > than 1 seconds (startsecs

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/conf/settings.py”, line 80, in _ctit_db_wrapper
������
yield
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/conf/settings.py”, line 418, in getattr
value = self._get_local(name)
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/conf/settings.py”, line 360, in _get_local
setting = Setting.objects.filter(key=name, user__isnull=True).order_by(‘pk’).first()
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/query.py”, line 653, in first
for obj in (self if self.ordered else self.order_by(‘pk’))[:1]:
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/query.py”, line 274, in iter
self._fetch_all()
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/query.py”, line 1242, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/query.py”, line 55, in iter
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/sql/compiler.py”, line 1140, in execute_sql
cursor = self.connection.cursor()
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/base/base.py”, line 256, in cursor
return self._cursor()
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/base/base.py”, line 233, in _cursor
self.ensure_connection()
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/base/base.py”, line 217, in ensure_connection
self.connect()
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/utils.py”, line 89, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/base/base.py”, line 217, in ensure_connection
self.connect()
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/base/base.py”, line 195, in connect
self.connection = self.get_new_connection(conn_params)
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/postgresql/base.py”, line 178, in get_new_connection
connection = Database.connect(**conn_params)
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/psycopg2/init.py”, line 126, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: could not translate host name “postgres” to address: Name or service not known

2020-10-21 12:06:04,970 ERROR awx.conf.settings Database settings are not available, using defaults.
Traceback (most recent call last):
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/base/base.py”, line 217, in ensure_connection
self.connect()
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/base/base.py”, line 195, in connect
self.connection = self.get_new_connection(conn_params)
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/postgresql/base.py”, line 178, in get_new_connection
connection = Database.connect(**conn_params)
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/psycopg2/init.py”, line 126, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: could not translate host name “postgres” to address: Name or service not known

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/conf/settings.py”, line 80, in _ctit_db_wrapper
������
yield
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/conf/settings.py”, line 418, in getattr
value = self._get_local(name)
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/conf/settings.py”, line 360, in _get_local
setting = Setting.objects.filter(key=name, user__isnull=True).order_by(‘pk’).first()
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/query.py”, line 653, in first
for obj in (self if self.ordered else self.order_by(‘pk’))[:1]:
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/query.py”, line 274, in iter
self._fetch_all()
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/query.py”, line 1242, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/query.py”, line 55, in iter
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/sql/compiler.py”, line 1140, in execute_sql
cursor = self.connection.cursor()
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/base/base.py”, line 256, in cursor
return self._cursor()
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/base/base.py”, line 233, in _cursor
self.ensure_connection()
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/base/base.py”, line 217, in ensure_connection
self.connect()
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/utils.py”, line 89, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/base/base.py”, line 217, in ensure_connection
self.connect()
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/base/base.py”, line 195, in connect
self.connection = self.get_new_connection(conn_params)
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/postgresql/base.py”, line 178, in get_new_connection
connection = Database.connect(**conn_params)
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/psycopg2/init.py”, line 126, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: could not translate host name “postgres” to address: Name or service not known

2020-10-21 12:06:04,974 ERROR awx.conf.settings Database settings are not available, using defaults.
Traceback (most recent call last):
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/base/base.py”, line 217, in ensure_connection

среда, 21 октября 2020 г. в 16:07:04 UTC+3, Roscha: