{"id":5168,"date":"2021-03-18T10:13:48","date_gmt":"2021-03-18T10:13:48","guid":{"rendered":"https:\/\/linuxways.net\/?p=5168"},"modified":"2021-06-27T00:59:42","modified_gmt":"2021-06-27T00:59:42","slug":"how-to-install-awx-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-awx-on-ubuntu-20-04\/","title":{"rendered":"How to Install AWX on Ubuntu 20.04"},"content":{"rendered":"<h2><strong>Introduction<\/strong><\/h2>\n<p>Ansible AWX is an open-source project which is easy to use UI, Rest API and provides an easier way to manage your ansible project in IT environments. AWX facilitates you to centrally manage Ansible playbooks, inventories and secrets, and scheduled jobs using a web interface. Ansible AWX is an upstream project which is sponsored by Red hat from which the Red Hat Ansible Tower project is derived. In this article, you are going to learn how to set up Ansible AWX on ubuntu 20.04<\/p>\n<h2><strong>Prerequisites<\/strong><\/h2>\n<ul>\n<li>Ubuntu Server 20.04<\/li>\n<li>Proper internet connection to install packages<\/li>\n<li>A user account with sudo privileges.<\/li>\n<li>At Least 4GB Memory and 2 core CPU<\/li>\n<\/ul>\n<h2><strong>Update Ubuntu System<\/strong><\/h2>\n<p>Before installation of any packages, perform a system update to update repositories index to the latest.<\/p>\n<pre>$ sudo apt update -y<\/pre>\n<p>Use the following command to upgrade the Ubuntu system.<\/p>\n<pre>$ sudo apt upgrade -y<\/pre>\n<p>After updating and upgrading, run the following command to reboot the system.<\/p>\n<pre>$ sudo reboot now<\/pre>\n<h2><strong>Install Ansible on Ubuntu<\/strong><\/h2>\n<p><strong>I<\/strong>nstall extra packages <strong>python-setuptools <\/strong>and <strong>python3-pip<\/strong> to install the latest version of ansible using <strong>pip3<\/strong> . Use the following command to install required python packages and dependencies.<\/p>\n<pre>$ sudo apt install python-setuptools -y<\/pre>\n<pre>$ sudo apt install python3-pip -y<\/pre>\n<p>Now run the following command to install ansible using <strong>pip3<\/strong>.<\/p>\n<pre>$ sudo pip3 install ansible<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1087\" height=\"239\" class=\"wp-image-5169\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-255.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-255.png 1087w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-255-300x66.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-255-1024x225.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-255-768x169.png 768w\" sizes=\"auto, (max-width: 1087px) 100vw, 1087px\" \/><\/p>\n<p>After completing the installation, you can use <strong>ansible &#8211;version<\/strong> command to check the ansible version installed on your system.<\/p>\n<pre>$ ansible --version<\/pre>\n<p>You will get the following output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1040\" height=\"131\" class=\"wp-image-5170\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-256.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-256.png 1040w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-256-300x38.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-256-1024x129.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-256-768x97.png 768w\" sizes=\"auto, (max-width: 1040px) 100vw, 1040px\" \/><\/p>\n<p>The output shows that the installed ansible version is 2.10.6<\/p>\n<h2><strong>Install docker and docker-compose<\/strong><\/h2>\n<p>Ansible AWX runs as a container so you need to install docker to host container applications. You can install docker using some other ways on Ubuntu 20.04. For reference, you can take the following links.<\/p>\n<pre><a href=\"https:\/\/docs.docker.com\/engine\/install\/ubuntu\/\">https:\/\/docs.docker.com\/engine\/install\/ubuntu\/<\/a><\/pre>\n<p>Use the following command to install docker-engine.<\/p>\n<pre>$ sudo apt install docker docker.io -y<\/pre>\n<p>Check docker version using the following command:<\/p>\n<pre>$ docker version<\/pre>\n<p>You will have output similar as:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"820\" height=\"531\" class=\"wp-image-5171\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-257.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-257.png 820w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-257-300x194.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-257-768x497.png 768w\" sizes=\"auto, (max-width: 820px) 100vw, 820px\" \/><\/p>\n<p>To install docker compose you can take the following link as reference.<\/p>\n<pre><a href=\"https:\/\/linuxconfig.org\/how-to-install-docker-compose-on-ubuntu-20-04-focal-fossa-linux\">https:\/\/linuxconfig.org\/how-to-install-docker-compose-on-ubuntu-20-04-focal-fossa-linux<\/a><\/pre>\n<p>To install docker-compose using pip3, run the following command:<\/p>\n<pre>$ sudo pip3 install docker-compose<\/pre>\n<p>To check docker-compose version run the command:<\/p>\n<pre>$ docker-compose version<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"814\" height=\"210\" class=\"wp-image-5172\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-258.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-258.png 814w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-258-300x77.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-258-768x198.png 768w\" sizes=\"auto, (max-width: 814px) 100vw, 814px\" \/><\/p>\n<p>The output shows that installed docker-compose version is 1.28.5<\/p>\n<p>Now you need to give access to the docker group for currently logged-in users. Execute the following command in your terminal:<\/p>\n<pre>$ sudo usermod -aG docker $USER<\/pre>\n<p>You may need to install some extra packaged <strong>vim<\/strong>, <strong>git<\/strong> and <strong>pwgen.<\/strong> Execute the following command to install additional required packages:<\/p>\n<pre>$ sudo apt install git vim pwgen -y<\/pre>\n<p>Git -&gt; Git client is used to pull source code and packages from git repositories.<\/p>\n<p>Vim -&gt; Vim is used as text editor<\/p>\n<p>Pwgen &#8211; &gt; pwgen is used to create random passwords.<\/p>\n<p>Now you need to download Ansible AWX source code from github repository. Download source code\/scripts to the local machine using the following command:<\/p>\n<pre>$ sudo git clone <a href=\"https:\/\/github.com\/ansible\/awx.git\">https:\/\/github.com\/ansible\/awx.git<\/a><\/pre>\n<p>You will get the output as:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"933\" height=\"208\" class=\"wp-image-5173\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-259.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-259.png 933w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-259-300x67.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-259-768x171.png 768w\" sizes=\"auto, (max-width: 933px) 100vw, 933px\" \/><\/p>\n<p>Now change the directory to awx\/installer as:<\/p>\n<pre>$ cd awx\/installer<\/pre>\n<p>Generate a secret key using pwgen as :<\/p>\n<pre>$ pwgen -N 1 -s 30<\/pre>\n<p>You will have generated secret key similar as :<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"84\" class=\"wp-image-5174\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-260.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-260.png 720w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-260-300x35.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/p>\n<p>Now modify the inventory file with a text editor replacing <strong>admin_password<\/strong> and <strong>secret_key <\/strong>create before. Remember <strong>admin_password<\/strong> as it is needed to login in AWX web interface later.<\/p>\n<pre>$ sudo vi inventory<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1009\" height=\"532\" class=\"wp-image-5175\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-261.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-261.png 1009w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-261-300x158.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-261-768x405.png 768w\" sizes=\"auto, (max-width: 1009px) 100vw, 1009px\" \/><\/p>\n<p>Save the file and exit.<\/p>\n<p>Now implement yml playbook which downloads docker container images and sets them up accordingly. Run the following command to apply ansible playbook.<\/p>\n<pre>$ ansible-playbook -i inventory install.yml<\/pre>\n<p>The playbook pulls necessary AWX containers and runs as container service. Run the following command to find running AWX containers:<\/p>\n<pre>$ sudo docker ps -a<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1281\" height=\"140\" class=\"wp-image-5176\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-262.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-262.png 1281w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-262-300x33.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-262-1024x112.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-262-768x84.png 768w\" sizes=\"auto, (max-width: 1281px) 100vw, 1281px\" \/><\/p>\n<p>AWX web is running in port 80. Now you can navigate to your browser and type <a href=\"http:\/\/your-awx-server-ip\">http:\/\/your-awx-server-ip<\/a> to access AWX GUI.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1063\" height=\"679\" class=\"wp-image-5177\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-263.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-263.png 1063w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-263-300x192.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-263-1024x654.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-263-768x491.png 768w\" sizes=\"auto, (max-width: 1063px) 100vw, 1063px\" \/><\/p>\n<p>Submit username as \u201cadmin\u201d and admin_password you have set in inventory file. You will find UI of AWX as:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1355\" height=\"564\" class=\"wp-image-5178\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-264.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-264.png 1355w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-264-300x125.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-264-1024x426.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-264-768x320.png 768w\" sizes=\"auto, (max-width: 1355px) 100vw, 1355px\" \/><\/p>\n<p>You can manage hosts, inventories, and projects from the dashboard.<\/p>\n<p><strong>Conclusion <\/strong>:<\/p>\n<p>In this article, you have learned how to install ansible AWX on Ubuntu 20.04. You have got a basic idea about managing hosts, inventories, and projects from AWX ansible.<\/p>","protected":false},"excerpt":{"rendered":"<p>Introduction Ansible AWX is an open-source project which is easy to use UI, Rest API and provides an easier way to manage your ansible project in IT environments.&hellip;<\/p>","protected":false},"author":1,"featured_media":5265,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[230,229,100],"class_list":["post-5168","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-ansible","tag-awx","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/5168","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=5168"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/5168\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/5265"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=5168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=5168"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=5168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}