Skip to content

Instantly share code, notes, and snippets.

@dasgoll
Last active February 12, 2022 14:15
Show Gist options
  • Save dasgoll/7073664f0f7f73f4aa3e7cf8c95a8dbc to your computer and use it in GitHub Desktop.
Save dasgoll/7073664f0f7f73f4aa3e7cf8c95a8dbc to your computer and use it in GitHub Desktop.
Install AWX on CentOS 7
[https://computingforgeeks.com/install-ansible-awx-on-centos-7-fedora-with-nginx-reverse-proxy-letsencrypt/]
###Appendix: Let's Encrypt with Certbot on Amazon Linux
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/SSL-on-an-instance.html#letsencrypt
# Insall EPEL repository
yum -y install epel-release
# Disable firewall and SELinux
systemctl disable firewalld
systemctl stop firewalld
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
reboot
# Enable continuous release (CR) repository if some paskage from EPEL are dependant on newer release
yum -y install git gettext ansible docker nodejs npm gcc-c++ bzip2
yum -y install python-docker-py
# Start and enable docker service
systemctl start docker
systemctl enable docker
# Clone repository and deploy (it will take about 20 minutes)
git clone https://github.com/ansible/awx.git
cd awx/installer/
ansible-playbook -i inventory install.yml
# Monitor migrations status (it will take about 10 minutes)
docker logs -f awx_task
Now you can access AWX web server http://my-awx.example.com.
The default administrator username is admin, and the password is password.
@don-rumata
Copy link

yum -y install docker-python

@rpaugusto-eu
Copy link

rpaugusto-eu commented Jun 3, 2019

Currently deploying on CentOS 7 1810 fully up to date.

At line 29, it gets to a point that gives me an error about conflicting docker SDK libraries and lack of compose library. Even don-rumata suggestion didn't solve it.
I solved it by removing everything I had installed related to docker with python (python-docker-py or docker-python) and replacing line 20 command with these:

yum -y install python-pip
pip install docker docker-compose

@stouuraa
Copy link

stouuraa commented Sep 2, 2019

i 'd this error after complete install awx :
curl: (7) Failed to connect to My @ip port 80: Connection refused
and i resolv it with these commands:

pip uninstall docker
pip uninstall docker-py
pip uninstall docker-compose
pip install docker-compose==1.9.0

@shgonzalez
Copy link

i 'd this error after complete install awx :
curl: (7) Failed to connect to My @ip port 80: Connection refused
and i resolv it with these commands:

pip uninstall docker
pip uninstall docker-py
pip uninstall docker-compose
pip install docker-compose==1.9.0

Thank you!!

@faabiancab
Copy link

could you please help me with this error?

[root@centos7 installer]# ansible-playbook -i inventory install.yml

PLAY [Build and deploy AWX] ********************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************
fatal: [localhost]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"setup": {"failed": true, "module_stderr": "/usr/bin/env: python3: No such file or directory\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 127}}, "msg": "The following modules failed to execute: setup\n"}

PLAY RECAP *************************************************************************************************************************
localhost : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

[root@centos7 installer]#

-Docker is Running.

[root@centos7 ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

[root@centos7 ~]# systemctl status docker
â—� docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2020-09-06 04:45:20 UTC; 44s ago
Docs: http://docs.docker.com
Main PID: 1532 (dockerd-current)
CGroup: /system.slice/docker.service
├─1532 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=do...
└─1545 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-int...

Sep 06 04:45:19 centos7 dockerd-current[1532]: time="2020-09-06T04:45:19.906672982Z" level=warning msg="Docker could not en...ystem"
Sep 06 04:45:19 centos7 dockerd-current[1532]: time="2020-09-06T04:45:19.935201401Z" level=info msg="Graph migration to con...conds"
Sep 06 04:45:19 centos7 dockerd-current[1532]: time="2020-09-06T04:45:19.936058581Z" level=info msg="Loading containers: start."
Sep 06 04:45:20 centos7 dockerd-current[1532]: time="2020-09-06T04:45:20.077597010Z" level=info msg="Firewalld running: false"
Sep 06 04:45:20 centos7 dockerd-current[1532]: time="2020-09-06T04:45:20.246261411Z" level=info msg="Default bridge (docker...dress"
Sep 06 04:45:20 centos7 dockerd-current[1532]: time="2020-09-06T04:45:20.307628249Z" level=info msg="Loading containers: done."
Sep 06 04:45:20 centos7 dockerd-current[1532]: time="2020-09-06T04:45:20.324019711Z" level=info msg="Daemon has completed i...ation"
Sep 06 04:45:20 centos7 dockerd-current[1532]: time="2020-09-06T04:45:20.324139460Z" level=info msg="Docker daemon" commit=...1.13.1
Sep 06 04:45:20 centos7 dockerd-current[1532]: time="2020-09-06T04:45:20.330828761Z" level=info msg="API listen on /var/run....sock"
Sep 06 04:45:20 centos7 systemd[1]: Started Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full

-Ansible Version,

[root@centos7 installer]# ansible --version
ansible 2.9.10
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Apr 2 2020, 13:16:51) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

@dasgoll
Copy link
Author

dasgoll commented Sep 6, 2020

could you please help me with this error?

[root@centos7 installer]# ansible-playbook -i inventory install.yml

PLAY [Build and deploy AWX] ********************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************
fatal: [localhost]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"setup": {"failed": true, "module_stderr": "/usr/bin/env: python3: No such file or directory\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 127}}, "msg": "The following modules failed to execute: setup\n"}

PLAY RECAP *************************************************************************************************************************
localhost : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

[root@centos7 installer]#

-Docker is Running.

[root@centos7 ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

[root@centos7 ~]# systemctl status docker
â—� docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2020-09-06 04:45:20 UTC; 44s ago
Docs: http://docs.docker.com
Main PID: 1532 (dockerd-current)
CGroup: /system.slice/docker.service
├─1532 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=do...
└─1545 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-int...

Sep 06 04:45:19 centos7 dockerd-current[1532]: time="2020-09-06T04:45:19.906672982Z" level=warning msg="Docker could not en...ystem"
Sep 06 04:45:19 centos7 dockerd-current[1532]: time="2020-09-06T04:45:19.935201401Z" level=info msg="Graph migration to con...conds"
Sep 06 04:45:19 centos7 dockerd-current[1532]: time="2020-09-06T04:45:19.936058581Z" level=info msg="Loading containers: start."
Sep 06 04:45:20 centos7 dockerd-current[1532]: time="2020-09-06T04:45:20.077597010Z" level=info msg="Firewalld running: false"
Sep 06 04:45:20 centos7 dockerd-current[1532]: time="2020-09-06T04:45:20.246261411Z" level=info msg="Default bridge (docker...dress"
Sep 06 04:45:20 centos7 dockerd-current[1532]: time="2020-09-06T04:45:20.307628249Z" level=info msg="Loading containers: done."
Sep 06 04:45:20 centos7 dockerd-current[1532]: time="2020-09-06T04:45:20.324019711Z" level=info msg="Daemon has completed i...ation"
Sep 06 04:45:20 centos7 dockerd-current[1532]: time="2020-09-06T04:45:20.324139460Z" level=info msg="Docker daemon" commit=...1.13.1
Sep 06 04:45:20 centos7 dockerd-current[1532]: time="2020-09-06T04:45:20.330828761Z" level=info msg="API listen on /var/run....sock"
Sep 06 04:45:20 centos7 systemd[1]: Started Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full

-Ansible Version,

[root@centos7 installer]# ansible --version
ansible 2.9.10
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Apr 2 2020, 13:16:51) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

Seems Python3 is not installed

@faabiancab
Copy link

Hi Dasgoll

Thanks for your valuable input, I have installed Python 3 with SCL to start the download and installation of ansible. now I see the containers in Docker and load the Ansible web page. but what happens is that it stays loading and never finishes updating. analyzing the log I see the following. I appreciate you can help me.

-Log:

[root@centos7 ~]# docker logs -f awx_task
Traceback (most recent call last):
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedTable: relation "main_instance" does not exist
LINE 1: SELECT (1) AS "a" FROM "main_instance" WHERE "main_instance"...
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/bin/awx-manage", line 8, in
sys.exit(manage())
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/init.py", line 154, in manage
execute_from_command_line(sys.argv)
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/core/management/init.py", line 381, in execute_from_command_line
utility.execute()
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/core/management/init.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/management/commands/run_dispatcher.py", line 55, in handle
reaper.reap()
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/dispatch/reaper.py", line 38, in reap
(changed, me) = Instance.objects.get_or_register()
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/managers.py", line 144, in get_or_register
return (False, self.me())
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/managers.py", line 100, in me
if node.exists():
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/query.py", line 766, in exists
return self.query.has_results(using=self.db)
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/sql/query.py", line 522, in has_results
return compiler.has_results()
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1110, in has_results
return bool(self.execute_sql(SINGLE))
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1140, in execute_sql
cursor.execute(sql, params)
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
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/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "main_instance" does not exist
LINE 1: SELECT (1) AS "a" FROM "main_instance" WHERE "main_instance"...
^
2020-09-07 08:56:41,654 INFO exited: dispatcher (exit status 1; not expected)
2020-09-07 08:56:41,654 INFO exited: dispatcher (exit status 1; not expected)
2020-09-07 08:56:42,657 INFO spawned: 'dispatcher' with pid 15325
2020-09-07 08:56:42,657 INFO spawned: 'dispatcher' with pid 15325
2020-09-07 08:56:43,659 INFO success: dispatcher entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2020-09-07 08:56:43,659 INFO success: dispatcher entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2020-09-07 08:56:45,417 WARNING awx.main.dispatch.periodic periodic beat started
Traceback (most recent call last):
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedTable: relation "main_instance" does not exist
LINE 1: SELECT (1) AS "a" FROM "main_instance" WHERE "main_instance"...
^
The above exception was the direct cause of the following exception:

Thank you.

Ansible_AWX_Load_Page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment