Ubuntu下重新安装 Ansible AWX

一个同事误删了/etc/awx/settings.py 造成AWX 不能正常使用。

当时的想法就是重新安装AWX。现在想想,如果在首次安装后没有对settings.py 进行过修改,可以直接从安装包里恢复就行。不过要根据awx-setup-1.3.1/group_vars/all 里的值对awx-setup-1.3.1/roles/awx_install/templates/settings.py.j2 里的变量进行初始化。

# Uninstall the current one

apt-get remove awx

# Install AWX

awx-setup-1.3.1# ./setup.sh

不过遇到了下面的错误:

TASK: [create awx database schema]********************************************

failed: [127.0.0.1] => {"changed": true,"cmd": ["awx-manage", "syncdb","--noinput"], "delta": "0:00:00.694911","end": "2013-11-21 01:30:39.462253", "item":"", "rc": 1, "start": "2013-11-2101:30:38.767342"}

stderr: Traceback (most recent call last):

  File"/usr/bin/awx-manage", line 9, in

   load_entry_point('awx==1.3.1', 'console_scripts', 'awx-manage')()

  File"awx/__init__.py", line 70, in manage

  File"/usr/lib/python2.7/dist-packages/django/core/management/__init__.py",line 443, in execute_from_command_line

    utility.execute()

  File"/usr/lib/python2.7/dist-packages/django/core/management/__init__.py",line 382, in execute

   self.fetch_command(subcommand).run_from_argv(self.argv)

  File"/usr/lib/python2.7/dist-packages/django/core/management/base.py",line 196, in run_from_argv

   self.execute(*args, **options.__dict__)

  File"/usr/lib/python2.7/dist-packages/django/core/management/base.py",line 232, in execute

    output =self.handle(*args, **options)

  File"/usr/lib/python2.7/dist-packages/django/core/management/base.py",line 371, in handle

    returnself.handle_noargs(**options)

  File"/usr/lib/python2.7/dist-packages/awx/lib/site-packages/south/management/commands/syncdb.py",line 92, in handle_noargs

   syncdb.Command().execute(**options)

  File"/usr/lib/python2.7/dist-packages/django/core/management/base.py",line 232, in execute

    output =self.handle(*args, **options)

  File"/usr/lib/python2.7/dist-packages/django/core/management/base.py",line 371, in handle

    returnself.handle_noargs(**options)

  File"/usr/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py",line 57, in handle_noargs

    cursor =connection.cursor()

  File"/usr/lib/python2.7/dist-packages/django/db/backends/__init__.py",line 319, in cursor

    cursor =util.CursorWrapper(self._cursor(), self)

  File"/usr/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py",line 177, in _cursor

    self.connection =Database.connect(**conn_params)

  File"/usr/lib/python2.7/dist-packages/psycopg2/__init__.py", line 179, inconnect

   connection_factory=connection_factory, async=async)

psycopg2.OperationalError: FATAL:  password authentication failed for user"awx"

stdout: Syncing...

 

FATAL: all hosts have already failed -- aborting

尝试过在postgre 数据库中修改user ‘awx’ 的密码,甚至卸载整个postgre 数据库,可是问题依旧。

其实user awx 是在安装过程中创建的, 改数据看里密码肯定不起作用。

其实这里的关键在于要把user awx 从系统里删除。

root@ansible:/home/localadmin/awx-setup-1.3.1# apt-get remove awx
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  awx
0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded.
After this operation, 13.4 MB disk space will be freed.
Do you want to continue [Y/n]? Y
(Reading database ... 105140 files and directories currently installed.)
Removing awx ...
* restarting supervisor and apache2 services
root@ansible:/home/localadmin/awx-setup-1.3.1# dpkg -l | grep awx
rc  awx                                1.3.1-0                                all          AnsibleWorks
root@ansible:/home/localadmin/awx-setup-1.3.1# cd /var/lib/a
apt/              aptitude/         apt-xapian-index/ awx/              
root@ansible:/home/localadmin/awx-setup-1.3.1# rm -r /var/lib/awx
root@ansible:/home/localadmin/awx-setup-1.3.1# rm -r /etc/awx

root@ansible:/etc# userdel -r awx
userdel: user awx is currently used by process 9259

root@ansible:/etc# kill 9259
root@ansible:/etc# userdel -r awx
userdel: user awx is currently used by process 9260
root@ansible:/etc# /etc/init.d/apache2 stop
 * Stopping web server apache2                                                                                               
 * The apache2 configtest failed, so we are trying to kill it manually. This is almost certainly suboptimal, so please make sure your system is working as you'd expect now!
 ... waiting                                                                                                          [ OK ]

 root@ansible:/etc# userdel -r awx
userdel: awx mail spool (/var/mail/awx) not found
userdel: awx home directory (/var/lib/awx) not found
root@ansible:/etc# cd /home/localadmin/awx-setup-1.3.1/

root@ansible:/home/localadmin/awx-setup-1.3.1# ./setup.sh


问题最终解决了。

你可能感兴趣的:(AWX,Ansible)