1

Trying to make AWX use External postgres DB, Changed the inventory database details

pg_hostname=localhost
pg_username=postgres
pg_password=postgres
pg_database=postgres
pg_port=5432
# pg_sslmode=disable

As per the document when we use External DB we will be seeing only 4 containers after deployment,

073a3a8a3c1e        ansible/awx_task:6.0.0       "/tini -- /bin/sh -c…"   5 minutes ago       Up 5 minutes        8052/tcp                                              awx_task
8bce5c10c216        ansible/awx_web:6.0.0        "/tini -- /bin/sh -c…"   5 minutes ago       Up 5 minutes                                                              awx_web
3605dc453977        ansible/awx_rabbitmq:3.7.4   "docker-entrypoint.s…"   5 minutes ago       Up 5 minutes        4369/tcp, 5671-5672/tcp, 15671-15672/tcp, 25672/tcp   awx_rabbitmq
9801f2a41901        memcached:alpine             "docker-entrypoint.s…"   5 minutes ago       Up 5 minutes        11211/tcp                                             awx_memcached

AWX_Task logs


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

Traceback (most recent call last):
  File "/usr/bin/awx-manage", line 11, in <module>
    load_entry_point('awx==6.0.0.0', 'console_scripts', 'awx-manage')()
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/__init__.py", line 140, in manage
    execute_from_command_line(sys.argv)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/run_dispatcher.py", line 123, in handle
    reaper.reap()
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/dispatch/reaper.py", line 36, in reap
    me = instance or Instance.objects.me()
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/managers.py", line 114, in me
    if node.exists():
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/models/query.py", line 673, in exists
    return self.query.has_results(using=self.db)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/models/sql/query.py", line 517, in has_results
    return compiler.has_results()
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 858, in has_results
    return bool(self.execute_sql(SINGLE))
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 887, in execute_sql
    cursor = self.connection.cursor()
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/backends/base/base.py", line 254, in cursor
    return self._cursor()
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/backends/base/base.py", line 229, in _cursor
    self.ensure_connection()
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection
    self.connect()
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection
    self.connect()
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/backends/base/base.py", line 189, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/backends/postgresql/base.py", line 176, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/psycopg2/__init__.py", line 130, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: could not connect to server: Connection refused
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?
could not connect to server: Cannot assign requested address
    Is the server running on host "localhost" (::1) and accepting
    TCP/IP connections on port 5432?

I can see this in AWX_WEB logs


Using /etc/ansible/ansible.cfg as config file
127.0.0.1 | FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    }, 
    "changed": false, 
    "msg": "argument port is of type <type 'str'> and we were unable to convert to int: <type 'str'> cannot be converted to an int"
}
Us

Any one faced this kind of issue. Please guide me with this

ANC
  • 11
  • 4
  • I have no clue where this error message is fired from... Meanwhile, there is something totally wrong with your configuration: `pg_hostname=localhost`. In docker context, `localhost` relates to the running container (i.e. awx_web or awx_task), not the docker host. You need to change that to a name or an ip resolvable by your containers and pointing to your host. – Zeitounator Jul 09 '19 at 17:18
  • Yeah I figured that soon after. Issue was I'm running AWX in local host with local postgress with hostname as Local Host, it doesn't work like that. I went for RDS Postgress DB and that worked perfectly fine. Just wondering how to make use of Primary-secondary Database Replication for AWX. Thanks for your comment though much appreciated. – ANC Jul 10 '19 at 14:56

0 Answers0