AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. This tutorial will walk you through the steps to set up Ansible AWX in a Docker container on CentOS/RHEL 7/8.
Please note that these instructions are applicable for AWX version 17.x only.
Prerequisites
To follow this tutorial along, you will need one (physical or virtual) installed with CentOS/RHEL 7/8, must have root user privileges.
We have also created a quick video tutorial to avoid any confusion while performing these installation steps.
Configure SELinux
By default, SELinux is enforcing in CentOS/RHEL 7/8. It is recommended to change SELINUX=enforcing to SELINUX=disabled to run Ansible AWX error free:
nano /etc/sysconfig/selinux
Replace the value "enforcing" with "disabled":
SELINUX=disabled
Save and close the file.
Reboot your machine to apply changes, when reboot complete, proceed with the below.
reboot
Install EPEL Repository
You will need to install the extra packages for enterprise Linux (EPEL) repository on your CentOS/RHEL 7/8:
Type below command if you are running CentOS/RHEL 8:
dnf -y install epel-release dnf -y update reboot
Type below command if you are running CentOS/RHEL 7:
yum -y install epel-release yum -y update reboot
Install Required Packages
Type below to install these additional packages if you are running a CentOS/RHEL 8:
This will take several minutes to complete, so don't get panic rather enjoy tea or coffee. Once the process successfully complete, you will see the output on your screen similar to the following:
Turncated output:
You can verify the running containers with the following command:
docker ps
Add Firewall Rules
You will need to add following rules to allow http and https service to pass through firewalld:
[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
I understand, but if I have it installed but not as the main language in my OS CentOs. I'm going to make a new attempt and share my results with you, thanks for the contribution.
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: ^ 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:
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.
hi, is there any solution for this error? TASK [local_docker : Start the containers] ************************************************************************************************************************************************** fatal: [localhost]: FAILED! => {"changed": false, "msg": "Configuration error - Named volume \"var/lib/pgdocker/10/data:/var/lib/postgresql/data:Z\" is used in service \"postgres\" but no declaration was found in the volumes section."}
TASK [local_docker : Start the containers] ****************************************************************************************************************** fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)) on imp02test's Python /usr/local/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter, for example via `pip install docker` or `pip install docker-py` (Python 2.6). The error was: No module named 'requests'"}
TASK [local_docker : Start the containers] ****************************************************************************************************************** fatal: [localhost]: FAILED! => {"changed": false, "msg": "Configuration error - yaml.scanner.ScannerError: while scanning for the next token\nfound character '@' that cannot start any token\n in \"/var/lib/awxcompose/docker-compose.yml\" line 83, column 26"
Verify your inventory file changes you made and correct if you mistyped anything. For example, error shows /var/lib/awxcompose which should be /var/lib/awx/awxcompose
Can i install AWX on RHEL 7.9 on OS layer not in docker containers ?
I tried on a server before and i was stuck with awx-migrate command in some django python packages although AWX is installed on OS. but could not migrate database to postgres
So i had to go to Docker approach for AWX
So I have AWX running on RHEL 7.9 i have the four containers awx_web, awx_task, awx_postgres and awx_redis and awx web interface is accessible on host OS
Im already running ansible and rundeck from another server and i am automating windows 2003,2008,2012,2016 servers and and this is with kerberos
on awx i tried to execute agaisnt kerberos A.D but my container does not have KRB LIB, KRB workstation packages and also i need to register to satellite with subscription-manager.
Is there anyway to run my awx playbooks from HOST OS or i have to get awx_web and awx_tasks public IP to the network and issue kerberos tickets from the container itself ?
Thanks for the time guys and i would appreciate the valuable responses.
while i'm trying to install 17.1.0 on rhel8.3 got the following error messages while running ansible-playbook. Any idea what could be wrong? Thanks in advance.
i follow your instructions but when i run ansible-plabook igot error:
[root@ansible-controller ~]# ansible-playbook -i awx/installer/inventory awx/installer/install.yml -v Using /etc/ansible/ansible.cfg as config file ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in '/root/awx/installer/roles/local_docker/tasks/upgrade_postgres.yml': line 39, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Stop AWX before upgrading postgres ^ here
The error appears to have been in '/root/awx/installer/roles/local_docker/tasks/upgrade_postgres.yml': line 39, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Stop AWX before upgrading postgres ^ here
exception type: exception: no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in '/root/awx/installer/roles/local_docker/tasks/upgrade_postgres.yml': line 39, column 3, but may be elsewhere in the file depending on the exact syntax problem.
TASK [check_vars : admin_password should be defined] *************************************************************************************** fatal: [localhost]: FAILED! => { "assertion": "admin_password is defined and admin_password != ''", "changed": false, "evaluated_to": false, "msg": "Set the value of 'admin_password' in the inventory file." }
admin_password is already set
# containerized postgres deployment on OpenShift pg_admin_password=Password#123
# This will create or update a default admin (superuser) account in AWX, if not provided # then these default values are used admin_user=admin admin_password=Password#123
Please note that, these instructions works with AWX 17.x version only. AWX 18.x or later release comes with different installation method. Probably you have AWX version other than 17.x and that is why installer directory is missing.
Hello @muhammad, I have the same issue that I cant find an installation directory. So I safely presume that I have somehow installed a new AWX after following your procedure. I have some questions. 1. Is there a way to install a new Ansible with the same procedure you've provided up to this point? 2. if not what would be the way to uninstall the current config and reinstall the new one? 3. Do you have an article/video on the procedure of new Ansible installation?
I am getting this error: fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unable to load docker-compose. Try `pip install docker-compose`. Error: Traceback (most recent call last):\n File \"/tmp/ansible_docker _compose_payload_lu_ionz3/ansible_docker_compose_payload.zip/ansible/modules/cloud/docker/docker_ compose.py\", line 482, in \nModuleNotFoundError: No module named 'compose'\n"}
But I have docker composed installed: docker-compose version docker-compose version 1.29.2, build 5becea4c docker-py version: 5.0.0 CPython version: 3.7.10 OpenSSL version: OpenSSL 1.1.0l 10 Sep 2019
Thank you for your rely, I installed compose as you suggested now it telling that docker-compose is not installed.
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unable to load docker-compose. Try `pip install docker-compose`. Error: Traceback (most recent call last):\n File \"/tmp/ansible_docker_compose_payload_bronmzhf/ansible_docker_compose_payload.zip/ansible/modules/cloud/docker/docker_compose.py\", line 483, in \nModuleNotFoundError: No module named 'compose.cli'; 'compose' is not a package\n"}
I tried a fresh install still get this error i also tried to install docker-compose without pip, any suggestions?
I'm getting below error in another server. can you suggest.
prdansible ~]# ansible-playbook -i ~/awx/installer/inventory ~/awx/installer/install.yml -v Using /etc/ansible/ansible.cfg as config file ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in '/root/awx/installer/roles/local_docker/tasks/upgrade_postgres.yml': line 39, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Stop AWX before upgrading postgres ^ here
The error appears to have been in '/root/awx/installer/roles/local_docker/tasks/upgrade_postgres.yml': line 39, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Stop AWX before upgrading postgres ^ here
exception type: exception: no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in '/root/awx/installer/roles/local_docker/tasks/upgrade_postgres.yml': line 39, column 3, but may be elsewhere in the file depending on the exact syntax problem.
Hi I'm getting bellow error, seems python version issue, i have pytho3 installed. how can I mitigate this error.
TASK [local_docker : Remove AWX containers before migrating postgres so that the old postgres container does not get used] ******************************************************** fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)) on stgansible's Python /usr/bin/python3. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter, for example via `pip install docker` or `pip install docker-py` (Python 2.6). The error was: No module named 'docker'"} ...ignoring
Thank you!, it was resolved but, I could not connect to server using http:ip:port8052 says not able to connect some times does not exist.
only error I encountered while installing ansible was git clone.
Git clone error: ------------------ Note: checking out 'c1ab815c80cac96508d9779d92bc1280d0347627'.
You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
However, I did modified inventory file , but no luck.
My AWX UI is getting up but I cannot access it, username or password incorrect and also I am getting the following error! Any idea? how to fix it?
TASK [local_docker : Check for existing Postgres data (run from inside the container for access to file)] **************************************************************************************************** fatal: [localhost]: FAILED! => {"changed": true, "cmd": "docker run --rm -v '/var/lib/awx/pgdocker:/var/lib/postgresql' centos:8 bash -c \"[[ -f /var/lib/postgresql/10/data/PG_VERSION ]] && echo 'exists'\"\n", "delta": "0:00:01.202883", "end": "2023-08-14 00:44:46.245625", "msg": "non-zero return code", "rc": 1, "start": "2023-08-14 00:44:45.042742", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []} ...ignoring
TASK [local_docker : Remove AWX containers before migrating postgres so that the old postgres container does not get used] *********************************************************************************** fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)) on master's Python /usr/bin/python3. Please read module documentation and install in the appropriate location, for example via `pip install docker` or `pip install docker-py` (Python 2.6). The error was: No module named 'docker'"} ...ignoring
TASK [local_docker : Run migrations in task container] ******************************************************************************************************************************************************* changed: [localhost] => {"changed": true, "cmd": "docker-compose run --rm --service-ports task awx-manage migrate --no-input", "delta": "0:00:07.483128", "end": "2023-08-14 00:45:02.051101", "rc": 0, "start": "2023-08-14 00:44:54.567973", "stderr": "Creating awxcompose_task_run ... \r\nCreating awxcompose_task_run ... done", "stderr_lines": ["Creating awxcompose_task_run ... ", "Creating awxcompose_task_run ... done"], "stdout": "Operations to perform:\n Apply all migrations: auth, conf, contenttypes, main, oauth2_provider, sessions, sites, social_django, sso, taggit\nRunning migrations:\n No migrations to apply.", "stdout_lines": ["Operations to perform:", " Apply all migrations: auth, conf, contenttypes, main, oauth2_provider, sessions, sites, social_django, sso, taggit", "Running migrations:", " No migrations to apply."]}
TASK [local_docker : Start the containers] ******************************************************************************************************************************************************************* fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)) on master's Python /usr/bin/python3. Please read module documentation and install in the appropriate location, for example via `pip install docker` or `pip install docker-py` (Python 2.6). The error was: No module named 'docker'"}
Awesome job and well explained!
ReplyDeleteA novice with no linux expertise could do it.
could you please help me with this error?
ReplyDelete[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)]
You need to Install python3 to fix this issue.
DeleteI understand, but if I have it installed but not as the main language in my OS CentOs. I'm going to make a new attempt and share my results with you, thanks for the contribution.
DeleteHi Friend.
DeleteThanks 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: ^
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:
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.
Thank you.
Pay attention to this (psycopg2.error) and try to fix it. Most probably you are missing psycopg2 package.
DeleteThank you very much friend. now AWX is running without problem. it's time to automate some things.
ReplyDeleteFollow this link to solve:
https://stackoverflow.com/questions/41611551/python-cant-install-psycopg2-on-centos-7
hi, is there any solution for this error?
ReplyDeleteTASK [local_docker : Start the containers] **************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Configuration error - Named volume \"var/lib/pgdocker/10/data:/var/lib/postgresql/data:Z\" is used in service \"postgres\" but no declaration was found in the volumes section."}
You have to declare ./var/lib/pgdocker/10/data in .yml file under volume section. Follow the link for reference:
Deletehttps://docs.docker.com/compose/compose-file/#volume-configuration-reference
did you run this command? alternatives --set python /usr/bin/python3
ReplyDeleteYes we did
DeleteTASK [local_docker : Start the containers] ******************************************************************************************************************
ReplyDeletefatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)) on imp02test's Python /usr/local/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter, for example via `pip install docker` or `pip install docker-py` (Python 2.6). The error was: No module named 'requests'"}
PLAY RECAP **************************************************************************************************************************************************
localhost : ok=12 changed=2 unreachable=0 failed=1 skipped=91 rescued=0 ignored=0
It appears that you don't have the docker module installed.
DeleteYou will need to install it via your system package manager (apt install python-docker, for example), or using pip.
If you have multiple Python versions, make sure that you've installed the docker module into the version that Ansible is using.
pip3 install docker
OR
pip install docker
Good job my friend. Can you help with this error
ReplyDeleteTASK [local_docker : Start the containers] ******************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Configuration error - yaml.scanner.ScannerError: while scanning for the next token\nfound character '@' that cannot start any token\n in \"/var/lib/awxcompose/docker-compose.yml\" line 83, column 26"
PLAY RECAP **************************************************************************************************************************************************
localhost : ok=12 changed=4 unreachable=0 failed=1 skipped=91 rescued=0 ignored=0
Verify your inventory file changes you made and correct if you mistyped anything. For example, error shows /var/lib/awxcompose which should be /var/lib/awx/awxcompose
DeleteAfter modification, rerun the process
TASK [local_docker : Create Preload data] this step failed what happen bro plz ?
ReplyDeleteCheck logs
DeleteHi Guys,
ReplyDeleteMy first question is
Can i install AWX on RHEL 7.9 on OS layer not in docker containers ?
I tried on a server before and i was stuck with awx-migrate command in some django python packages although AWX is installed on OS. but could not migrate database to postgres
So i had to go to Docker approach for AWX
So I have AWX running on RHEL 7.9 i have the four containers awx_web, awx_task, awx_postgres and awx_redis and awx web interface is accessible on host OS
Im already running ansible and rundeck from another server and i am automating windows 2003,2008,2012,2016 servers and and this is with kerberos
on awx i tried to execute agaisnt kerberos A.D but my container does not have KRB LIB, KRB workstation packages and also i need to register to satellite with subscription-manager.
Is there anyway to run my awx playbooks from HOST OS or i have to get awx_web and awx_tasks public IP to the network and issue kerberos tickets from the container itself ?
Thanks for the time guys and i would appreciate the valuable responses.
A.T
Did anyone ever reply to this? I am having the same issue
DeleteI would suggest you to post your query on AWX GitHUb page to let the community answer/suggest you a solution.
Deletewhile i'm trying to install 17.1.0 on rhel8.3 got the following error messages while running ansible-playbook. Any idea what could be wrong? Thanks in advance.
ReplyDeleteTASK [local_docker : Register temporary docker container] *******************************************************************************************************************************
ok: [localhost] => {"ansible_facts": {"container_command": "docker run --rm -v '/var/lib/awx/pgdocker:/var/lib/postgresql' centos:8 bash -c "}, "changed": false}
TASK [local_docker : Check for existing Postgres data (run from inside the container for access to file)] *******************************************************************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": "docker run --rm -v '/var/lib/awx/pgdocker:/var/lib/postgresql' centos:8 bash -c \"[[ -f /var/lib/postgresql/10/data/PG_VERSION ]] && echo 'exists'\"\n", "delta": "0:00:01.258900", "end": "2021-05-20 17:34:46.588540", "msg": "non-zero return code", "rc": 1, "start": "2021-05-20 17:34:45.329640", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
...ignoring
...
.
TASK [local_docker : Run migrations in task container] **********************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": "docker-compose run --rm --service-ports task awx-manage migrate --no-input", "delta": "0:00:00.003101", "end": "2021-05-20 17:34:51.913194", "msg": "non-zero return code", "rc": 127, "start": "2021-05-20 17:34:51.910093", "stderr": "/bin/sh: docker-compose: command not found", "stderr_lines": ["/bin/sh: docker-compose: command not found"], "stdout": "", "stdout_lines": []}
PLAY RECAP ******************************************************************************************************************************************************************************
localhost : ok=15 changed=3 unreachable=0 failed=1 skipped=73 rescued=0 ignored=1
you are missing docker-compose, install it with below command:
Deletepip3 install docker-compose
Thanks! it's working now.
Deletei did this again iam getting this same error can you please help
Deletefatal: [localhost]: FAILED! => {"changed": true, "cmd": "docker-compose run --rm --service-ports task awx-manage migrate --no-input", "delta": "0:00:00.004451", "end": "2022-04-27 12:38:36.755175", "msg": "non-zero return code", "rc": 127, "start": "2022-04-27 12:38:36.750724", "stderr": "/bin/sh: docker-compose: command not found", "stderr_lines": ["/bin/sh: docker-compose: command not found"], "stdout": "", "stdout_lines": []}
After awx installation there's no https. Any quick guide to turn on ssl on awx 17.1.0? Thanks
ReplyDeleteI tried installing the same on Amazon Linux 2 and getting below error while browsing
ReplyDeleteHello,
ReplyDeletei follow your instructions but when i run ansible-plabook igot error:
[root@ansible-controller ~]# ansible-playbook -i awx/installer/inventory awx/installer/install.yml -v
Using /etc/ansible/ansible.cfg as config file
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in '/root/awx/installer/roles/local_docker/tasks/upgrade_postgres.yml': line 39, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Stop AWX before upgrading postgres
^ here
The error appears to have been in '/root/awx/installer/roles/local_docker/tasks/upgrade_postgres.yml': line 39, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Stop AWX before upgrading postgres
^ here
exception type:
exception: no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in '/root/awx/installer/roles/local_docker/tasks/upgrade_postgres.yml': line 39, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Stop AWX before upgrading postgres
^ here
12
DeleteSeems you incorrectly modified awx/installer/inventory and it cases indentation errors...
ReplyDeletethat is not a indentation error since the file has not been modified at all
ReplyDeletePlease how to upgrade Ansible AWS to the latest version
ReplyDeleteYou can not upgrade from 17.x version to latest but you can migrate existing data to latest one.
DeleteCan you please help on below error.?
ReplyDeleteTASK [Gathering Facts] *********************************************************************************************************************
ok: [localhost]
TASK [check_vars : admin_password should be defined] ***************************************************************************************
fatal: [localhost]: FAILED! => {
"assertion": "admin_password is defined and admin_password != ''",
"changed": false,
"evaluated_to": false,
"msg": "Set the value of 'admin_password' in the inventory file."
}
admin_password is already set
# containerized postgres deployment on OpenShift
pg_admin_password=Password#123
# This will create or update a default admin (superuser) account in AWX, if not provided
# then these default values are used
admin_user=admin
admin_password=Password#123
Make sure you uncomment the line and define strong password, not some random password
DeleteThanks for your quick response.
DeleteHowever, issue is yet not resolved.
I have it uncommented and tried multiple strong passwords.
Any other thoughts.?
Post it at Ansible github page if you are done playing around.
DeleteHello @muhammad anwar, thanks alot brother for your help, when installed, I can't find the installer directory under awx, any suggestions?
ReplyDeletePlease note that, these instructions works with AWX 17.x version only. AWX 18.x or later release comes with different installation method. Probably you have AWX version other than 17.x and that is why installer directory is missing.
DeleteHello @muhammad, I have the same issue that I cant find an installation directory. So I safely presume that I have somehow installed a new AWX after following your procedure. I have some questions.
Delete1. Is there a way to install a new Ansible with the same procedure you've provided up to this point?
2. if not what would be the way to uninstall the current config and reinstall the new one?
3. Do you have an article/video on the procedure of new Ansible installation?
Thank you. _/\_
I am getting this error:
ReplyDeletefatal: [localhost]: FAILED! => {"changed": false, "msg": "Unable to load docker-compose. Try `pip install docker-compose`. Error: Traceback (most recent call last):\n File \"/tmp/ansible_docker _compose_payload_lu_ionz3/ansible_docker_compose_payload.zip/ansible/modules/cloud/docker/docker_ compose.py\", line 482, in \nModuleNotFoundError: No module named 'compose'\n"}
But I have docker composed installed:
docker-compose version
docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
CPython version: 3.7.10
OpenSSL version: OpenSSL 1.1.0l 10 Sep 2019
Has anyone run into this issue?
You need to install compose module with below command:
Deletepip install compose
Thank you for your rely, I installed compose as you suggested now it telling that docker-compose is not installed.
Deletefatal: [localhost]: FAILED! => {"changed": false, "msg": "Unable to load docker-compose. Try `pip install docker-compose`. Error: Traceback (most recent call last):\n File \"/tmp/ansible_docker_compose_payload_bronmzhf/ansible_docker_compose_payload.zip/ansible/modules/cloud/docker/docker_compose.py\", line 483, in \nModuleNotFoundError: No module named 'compose.cli'; 'compose' is not a package\n"}
I tried a fresh install still get this error i also tried to install docker-compose without pip, any suggestions?
Hey so I figured out the issue once you install docker-compose you need to run
Deleteln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
Thanks for your help!
Hi Neend your help, we tried to install AWX on CentOS 7.7 multiple times but it is failing at below task, can you suggest what needs to be done.
ReplyDeleteTASK [local_docker : Run migrations in task container] ***************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": "docker-compose run --rm --service-ports task awx-manage migrate --no-input", "delta": "0:00:00.227195", "end": "2022-03-15 02:54:06.004376", "msg": "non-zero return code", "rc": 1, "start": "2022-03-15 02:54:05.777181", "stderr": "Traceback (most recent call last):\n File \"/usr/bin/docker-compose\", line 11, in \n sys.exit(main())\n File \"/usr/lib/python2.7/site-packages/compose/cli/main.py\", line 71, in main\n command()\n File \"/usr/lib/python2.7/site-packages/compose/cli/main.py\", line 124, in perform_command\n project = project_from_options('.', options)\n File \"/usr/lib/python2.7/site-packages/compose/cli/command.py\", line 42, in project_from_options\n compatibility=options.get('--compatibility'),\n File \"/usr/lib/python2.7/site-packages/compose/cli/command.py\", line 123, in get_project\n host=host, environment=environment\n File \"/usr/lib/python2.7/site-packages/compose/cli/command.py\", line 94, in get_client\n environment=environment, tls_version=get_tls_version(environment)\n File \"/usr/lib/python2.7/site-packages/compose/cli/docker_client.py\", line 127, in docker_client\n client = APIClient(**kwargs)\n File \"/usr/lib/python2.7/site-packages/docker/api/client.py\", line 128, in __init__\n config_dict=self._general_configs, credstore_env=credstore_env,\nTypeError: load_config() got an unexpected keyword argument 'config_dict'", "stderr_lines": ["Traceback (most recent call last):", " File \"/usr/bin/docker-compose\", line 11, in ", " sys.exit(main())", " File \"/usr/lib/python2.7/site-packages/compose/cli/main.py\", line 71, in main", " command()", " File \"/usr/lib/python2.7/site-packages/compose/cli/main.py\", line 124, in perform_command", " project = project_from_options('.', options)", " File \"/usr/lib/python2.7/site-packages/compose/cli/command.py\", line 42, in project_from_options", " compatibility=options.get('--compatibility'),", " File \"/usr/lib/python2.7/site-packages/compose/cli/command.py\", line 123, in get_project", " host=host, environment=environment", " File \"/usr/lib/python2.7/site-packages/compose/cli/command.py\", line 94, in get_client", " environment=environment, tls_version=get_tls_version(environment)", " File \"/usr/lib/python2.7/site-packages/compose/cli/docker_client.py\", line 127, in docker_client", " client = APIClient(**kwargs)", " File \"/usr/lib/python2.7/site-packages/docker/api/client.py\", line 128, in __init__", " config_dict=self._general_configs, credstore_env=credstore_env,", "TypeError: load_config() got an unexpected keyword argument 'config_dict'"], "stdout": "", "stdout_lines": []}
PLAY RECAP ***********************************************************************************************************************************************************************
localhost : ok=15 changed=3 unreachable=0 failed=1 skipped=73 rescued=0 ignored=2
Make sure docker-compose exist in /usr/bin and /usr/sbin
DeleteGreat doc, i could install successfully after upgrading the pip.
ReplyDeleteI'm getting below error in another server. can you suggest.
ReplyDeleteprdansible ~]# ansible-playbook -i ~/awx/installer/inventory ~/awx/installer/install.yml -v
Using /etc/ansible/ansible.cfg as config file
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in '/root/awx/installer/roles/local_docker/tasks/upgrade_postgres.yml': line 39, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Stop AWX before upgrading postgres
^ here
The error appears to have been in '/root/awx/installer/roles/local_docker/tasks/upgrade_postgres.yml': line 39, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Stop AWX before upgrading postgres
^ here
exception type:
exception: no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in '/root/awx/installer/roles/local_docker/tasks/upgrade_postgres.yml': line 39, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Stop AWX before upgrading postgres
^ here
Hi I'm getting bellow error, seems python version issue, i have pytho3 installed. how can I mitigate this error.
ReplyDeleteTASK [local_docker : Remove AWX containers before migrating postgres so that the old postgres container does not get used] ********************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)) on stgansible's Python /usr/bin/python3. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter, for example via `pip install docker` or `pip install docker-py` (Python 2.6). The error was: No module named 'docker'"}
...ignoring
TASK [local_docker : Run migrations in task container] ****************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": "docker-compose run --rm --service-ports task awx-manage migrate --no-input", "delta": "0:00:00.005780", "end": "2022-04-01 16:44:05.770280", "msg": "non-zero return code", "rc": 127, "start": "2022-04-01 16:44:05.764500", "stderr": "/bin/sh: docker-compose: command not found", "stderr_lines": ["/bin/sh: docker-compose: command not found"], "stdout": "", "stdout_lines": []}
PLAY RECAP ************************************************************************************************************************************************************************
localhost : ok=15 changed=3 unreachable=0 failed=1 skipped=73 rescued=0 ignored=2
Its not python issue, it says “docker-compose: command not found” in the output.
DeleteMake sure docker-compose binary is available within /usr/bin/ and /usr/sbin/
Thank you!, it was resolved but, I could not connect to server using http:ip:port8052 says not able to connect some times does not exist.
ReplyDeleteonly error I encountered while installing ansible was git clone.
Git clone error:
------------------
Note: checking out 'c1ab815c80cac96508d9779d92bc1280d0347627'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
However, I did modified inventory file , but no luck.
can you suggest.
here is docker status.
----------------------------
Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: [1;32mactive (running) [0m since Fri 2022-04-01 17:29:27 GMT; 1min 19s ago
Docs: https://docs.docker.com
Main PID: 1434 (dockerd)
Tasks: 27
Memory: 116.2M
CGroup: /system.slice/docker.service
├─1434 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
└─2163 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8052 -container-ip 172.18.0.5 -container-port 8052
Apr 01 17:29:25 stgansible dockerd[1434]: time="2022-04-01T17:29:25.707407462Z" level=error msg="failed to start container" container=58d96c02b8dd2428fb386f2982688124c18cb9fba0...
Apr 01 17:29:26 stgansible dockerd[1434]: time="2022-04-01T17:29:26Z" level=warning msg="file does not exist: /proc/sys/net/ipv6/conf/all/disable_ipv6 : stat /proc/s...'s kernel?"
Apr 01 17:29:26 stgansible dockerd[1434]: time="2022-04-01T17:29:26Z" level=warning msg="file does not exist: /proc/sys/net/ipv6/conf/all/disable_ipv6 : stat /proc/s...'s kernel?"
Apr 01 17:29:26 stgansible dockerd[1434]: time="2022-04-01T17:29:26Z" level=warning msg="file does not exist: /proc/sys/net/ipv6/conf/all/disable_ipv6 : stat /proc/s...'s kernel?"
Apr 01 17:29:27 stgansible dockerd[1434]: time="2022-04-01T17:29:27Z" level=warning msg="file does not exist: /proc/sys/net/ipv6/conf/all/disable_ipv6 : stat /proc/s...'s kernel?"
Apr 01 17:29:27 stgansible dockerd[1434]: time="2022-04-01T17:29:27.656685817Z" level=info msg="Loading containers: done."
Apr 01 17:29:27 stgansible dockerd[1434]: time="2022-04-01T17:29:27.732888198Z" level=info msg="Docker daemon" commit=87a90dc graphdriver(s)=overlay2 version=20.10.14
Apr 01 17:29:27 stgansible dockerd[1434]: time="2022-04-01T17:29:27.736775329Z" level=info msg="Daemon has completed initialization"
Apr 01 17:29:27 stgansible systemd[1]: Started Docker Application Container Engine.
Apr 01 17:29:27 stgansible dockerd[1434]: time="2022-04-01T17:29:27.914319854Z" level=info msg="API listen on /var/run/docker.sock"
Hi these all steps works for centos 7.9 or not...I am having centos7.9
ReplyDeleteTASK [local_docker : Check for existing Postgres data (run from inside the container for access to file)] **************************************************************
ReplyDeletefatal: [localhost]: FAILED! => {"changed": true, "cmd": "docker run --rm -v '/var/lib/awx/pgdocker:/var/lib/postgresql' centos:8 bash -c \"[[ -f /var/lib/postgresql/10/data/PG_VERSION ]] && echo 'exists'\"\n", "delta": "0:00:08.637637", "end": "2022-06-10 12:32:36.107230", "msg": "non-zero return code", "rc": 125, "start": "2022-06-10 12:32:27.469593", "stderr": "Unable to find image 'centos:8' locally\ndocker: Error response from daemon: Get \"https://registry-1.docker.io/v2/\": dial tcp: lookup registry-1.docker.io on 10.78.28.82:53: server misbehaving.\nSee 'docker run --help'.", "stderr_lines": ["Unable to find image 'centos:8' locally", "docker: Error response from daemon: Get \"https://registry-1.docker.io/v2/\": dial tcp: lookup registry-1.docker.io on 10.78.28.82:53: server misbehaving.", "See 'docker run --help'."], "stdout": "", "stdout_lines": []}
Kindly help to resolve the issue
My AWX UI is getting up but I cannot access it, username or password incorrect and also I am getting the following error! Any idea? how to fix it?
ReplyDeleteTASK [local_docker : Check for existing Postgres data (run from inside the container for access to file)] ****************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": "docker run --rm -v '/var/lib/awx/pgdocker:/var/lib/postgresql' centos:8 bash -c \"[[ -f /var/lib/postgresql/10/data/PG_VERSION ]] && echo 'exists'\"\n", "delta": "0:00:01.202883", "end": "2023-08-14 00:44:46.245625", "msg": "non-zero return code", "rc": 1, "start": "2023-08-14 00:44:45.042742", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
...ignoring
TASK [local_docker : Remove AWX containers before migrating postgres so that the old postgres container does not get used] ***********************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)) on master's Python /usr/bin/python3. Please read module documentation and install in the appropriate location, for example via `pip install docker` or `pip install docker-py` (Python 2.6). The error was: No module named 'docker'"}
...ignoring
TASK [local_docker : Run migrations in task container] *******************************************************************************************************************************************************
changed: [localhost] => {"changed": true, "cmd": "docker-compose run --rm --service-ports task awx-manage migrate --no-input", "delta": "0:00:07.483128", "end": "2023-08-14 00:45:02.051101", "rc": 0, "start": "2023-08-14 00:44:54.567973", "stderr": "Creating awxcompose_task_run ... \r\nCreating awxcompose_task_run ... done", "stderr_lines": ["Creating awxcompose_task_run ... ", "Creating awxcompose_task_run ... done"], "stdout": "Operations to perform:\n Apply all migrations: auth, conf, contenttypes, main, oauth2_provider, sessions, sites, social_django, sso, taggit\nRunning migrations:\n No migrations to apply.", "stdout_lines": ["Operations to perform:", " Apply all migrations: auth, conf, contenttypes, main, oauth2_provider, sessions, sites, social_django, sso, taggit", "Running migrations:", " No migrations to apply."]}
TASK [local_docker : Start the containers] *******************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)) on master's Python /usr/bin/python3. Please read module documentation and install in the appropriate location, for example via `pip install docker` or `pip install docker-py` (Python 2.6). The error was: No module named 'docker'"}
PLAY RECAP ***************************************************************************************************************************************************************************************************
localhost : ok=16 changed=8 unreachable=0 failed=1 skipped=73 rescued=0 ignored=2
[root@master ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5ce2a8a26291 ansible/awx:17.1.0 "/usr/bin/tini -- /b…" 11 hours ago Up 24 minutes 0.0.0.0:80->8052/tcp, :::80->8052/tcp awx_web
1a0896f794bb postgres:12 "docker-entrypoint.s…" 11 hours ago Up 24 minutes 5432/tcp awx_postgres
6742cc91f2bd redis "docker-entrypoint.s…" 11 hours ago Up 24 minutes 6379/tcp awx_redis
Still I am getting server error as I have followd all stedps, docker are running perfectly
ReplyDeleteCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1f7a451a04b8 ansible/awx:17.1.0 "/usr/bin/tini -- /b…" 7 minutes ago Up 2 minutes 0.0.0.0:80->8052/tcp, :::80->8052/tcp awx_web
9e9f354dd0de postgres:12 "docker-entrypoint.s…" 7 minutes ago Up 2 minutes 5432/tcp awx_postgres
c7fe1d40f30b redis "docker-entrypoint.s…" 7 minutes ago Up 2 minutes 6379/tcp awx_redis
[root@controller ~]#