{"id":2129,"date":"2017-09-12T11:07:14","date_gmt":"2017-09-12T15:07:14","guid":{"rendered":"http:\/\/blog.domb.net\/?p=2129"},"modified":"2017-09-13T11:28:38","modified_gmt":"2017-09-13T15:28:38","slug":"awx-project-on-rhel7-3","status":"publish","type":"post","link":"https:\/\/blog.domb.net\/?p=2129","title":{"rendered":"awx ansible on rhel"},"content":{"rendered":"<p>As you probably read we did opensource ansible tower<\/p>\n<p><a href=\"https:\/\/github.com\/ansible\/awx\">https:\/\/github.com\/ansible\/awx<\/a> . This was a big and necessary step to follow the red hat way of being truly opensource. Thanks to Jeff Geerling we also have a role <a href=\"https:\/\/galaxy.ansible.com\/geerlingguy\/awx\/\">https:\/\/galaxy.ansible.com\/geerlingguy\/awx\/<\/a>\u00a0to install awx.<\/p>\n<p>To install AWX on RHEL (remember this is not supported by GSS) you need to do the following:<\/p>\n<p>Step1: register your host with Red Hat<\/p>\n<pre class=\"lang:default decode:true\">[root@host141 ~]# subscription-manager register<\/pre>\n<p>Step2: now add the needed channels<\/p>\n<pre class=\"lang:default decode:true \">[root@host141 ~]# subscription manager attach --pool YOURPOOLFORRHEL<\/pre>\n<p>Step3: enable the repos extras and optional<\/p>\n<pre class=\"lang:default decode:true \">[root@host141 ~]# subscription-manager repos --disable=*\r\n[root@host141 ~]# subscription-manager repos --enable=rhel-7-server-rpms --enable=rhel-7-server-extras-rpms --enable=rhel-7-server-optional-rpms<\/pre>\n<p>Step4: to be able to run the build correctly you will have to do the following<\/p>\n<pre class=\"lang:default decode:true\">[root@host141 ~]# mkdir -p \/etc\/docker<\/pre>\n<p>Step 5: add the following file. Without that you build will fail complaining that you cannot connect to github<\/p>\n<pre class=\"lang:default decode:true\">[root@host141 ~]# cat &lt;&lt; EOF &gt; \/etc\/docker\/daemon.json \r\n{\r\n    \"dns\": [\"8.8.8.8\"]\r\n}\r\nEOF<\/pre>\n<p>Step 6: install ansible<\/p>\n<pre class=\"lang:default decode:true \">[root@host141 ~]# yum install -y ansible<\/pre>\n<p>Step 7: install all the necessary roles<\/p>\n<pre class=\"lang:default decode:true\">[root@host141 ~]# cat &lt;&lt; EOF &gt; roles-for-awx.sh\r\nansible-galaxy install  geerlingguy.git\r\nansible-galaxy install geerlingguy.ansible\r\nansible-galaxy install  geerlingguy.docker\r\nansible-galaxy install  geerlingguy.pip\r\nansible-galaxy install  geerlingguy.nodejs\r\nansible-galaxy install geerlingguy.repo-epel\r\nansible-galaxy install geerlingguy.awx\r\nEOF\r\n\r\nchmod +x roles-for-awx.sh<\/pre>\n<p>Step 8: install the roles:<\/p>\n<pre class=\"lang:default decode:true\">[root@host141 ~]# .\/roles-for-awx.sh<\/pre>\n<p>Step 9: create the inventory add your host<\/p>\n<pre class=\"lang:default decode:true\">[root@host141 ~]# mkdir inventory\r\n[root@host141 ~]# touch hosts inventory\/\r\n[root@host141 ~]# echo '192.168.1.55' &gt; inventory\/hosts<\/pre>\n<p>Step 10: create the play to install awx<\/p>\n<pre class=\"lang:default decode:true\">[root@host141 ~]# echo &lt;&lt; EOF &gt; install.yml\r\n---\r\n- hosts: all\r\n  become: yes\r\n\r\n  vars:\r\n    nodejs_version: \"6.x\"\r\n    pip_install_packages:\r\n      - name: docker-py\r\n\r\n  pre_tasks:\r\n    - name: Update apt cache.\r\n      apt: update_cache=yes cache_valid_time=600\r\n      when: ansible_os_family == 'Debian'\r\n      changed_when: false\r\n\r\n  roles:\r\n    - name: geerlingguy.repo-epel\r\n      when: ansible_os_family == \"RedHat\"\r\n    - geerlingguy.git\r\n    - geerlingguy.ansible\r\n    - geerlingguy.docker\r\n    - geerlingguy.pip\r\n    - geerlingguy.nodejs\r\n    - geerlingguy.awx\r\nEOF<\/pre>\n<p>Step 11: run the playbook<\/p>\n<pre class=\"lang:default decode:true\">[root@host141 ~]# ansible-playbook -i inventory install.yml -vv<\/pre>\n<p>Step 12: If the install is successful you will see the following<\/p>\n<pre class=\"lang:default decode:true \">[root@host141 ~]# docker ps\r\nCONTAINER ID        IMAGE                COMMAND                  CREATED             STATUS              PORTS                                NAMES\r\n5bd777f861d5        awx_task:1.0.0.337   \"\/tini -- \/bin\/sh ...\"   About an hour ago   Up About an hour    8052\/tcp                             awx_task\r\nb56359a39b98        awx_web:1.0.0.337    \"\/tini -- \/bin\/sh ...\"   About an hour ago   Up About an hour    0.0.0.0:80-&gt;8052\/tcp                 awx_web\r\n243a135f35bc        memcached:alpine     \"docker-entrypoint...\"   About an hour ago   Up About an hour    11211\/tcp                            memcached\r\n19d622b223b3        rabbitmq:3           \"docker-entrypoint...\"   About an hour ago   Up About an hour    4369\/tcp, 5671-5672\/tcp, 25672\/tcp   rabbitmq\r\nf6eede4708f5        postgres:9.6         \"docker-entrypoint...\"   About an hour ago   Up About an hour    5432\/tcp                             postgres<\/pre>\n<p>Step 13: It will take a while until the instance comes up. You can check it like this<\/p>\n<pre class=\"lang:default decode:true\">[root@host141 awx]# docker logs -f awx_task\r\nUsing \/etc\/ansible\/ansible.cfg as config file\r\n127.0.0.1 | SUCCESS =&gt; {\r\n    \"changed\": true, \r\n    \"db\": \"awx\"\r\n}\r\nOperations to perform:\r\n  Synchronize unmigrated apps: solo, api, staticfiles, messages, channels, django_extensions, ui, rest_framework, polymorphic\r\n  Apply all migrations: sso, taggit, sessions, djcelery, sites, kombu_transport_django, social_auth, contenttypes, auth, conf, main\r\nSynchronizing apps without migrations:\r\n  Creating tables...\r\n    Running deferred SQL...\r\n  Installing custom SQL...\r\nRunning migrations:\r\n  Rendering model states... DONE\r\n  Applying contenttypes.0001_initial... OK\r\n  Applying contenttypes.0002_remove_content_type_name... OK\r\n  Applying auth.0001_initial... OK\r\n  Applying auth.0002_alter_permission_name_max_length... OK\r\n  Applying auth.0003_alter_user_email_max_length... OK\r\n  Applying auth.0004_alter_user_username_opts... OK\r\n  Applying auth.0005_alter_user_last_login_null... OK\r\n  Applying auth.0006_require_contenttypes_0002... OK\r\n  Applying taggit.0001_initial... OK\r\n  Applying taggit.0002_auto_20150616_2121... OK\r\n  Applying main.0001_initial... OK\r\n  Applying main.0002_squashed_v300_release... OK\r\n  Applying main.0003_squashed_v300_v303_updates... OK\r\n  Applying main.0004_squashed_v310_release... OK\r\n  Applying conf.0001_initial... OK\r\n  Applying conf.0002_v310_copy_tower_settings... OK\r\n  Applying conf.0003_v310_JSONField_changes... OK\r\n  Applying conf.0004_v320_reencrypt... OK\r\n  Applying djcelery.0001_initial... OK\r\n  Applying kombu_transport_django.0001_initial... OK\r\n  Applying main.0005_squashed_v310_v313_updates... OK\r\n  Applying main.0006_v320_release... OK\r\n2017-09-12 14:18:40,999 DEBUG    awx.main.migrations Removing all Rackspace InventorySource from database.\r\n2017-09-12 14:18:41,028 DEBUG    awx.main.migrations Removing all InventorySource that have no link to an Inventory from database.\r\n  Applying main.0007_v320_data_migrations... OK\r\n  Applying main.0008_v320_drop_v1_credential_fields... OK\r\n  Applying sessions.0001_initial... OK\r\n  Applying sites.0001_initial... OK\r\n  Applying social_auth.0001_initial... OK\r\n  Applying social_auth.0002_add_related_name... OK\r\n  Applying social_auth.0003_alter_email_max_length... OK\r\n  Applying social_auth.0004_auto_20160423_0400... OK\r\n  Applying social_auth.0005_auto_20160727_2333... OK\r\n  Applying sso.0001_initial... OK\r\n  Applying sso.0002_expand_provider_options... OK\r\nPython 2.7.5 (default, Nov  6 2016, 00:28:07) \r\n[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n(InteractiveConsole)\r\n\r\n&gt;&gt;&gt; &lt;User: admin&gt;\r\n&gt;&gt;&gt; Default organization added.\r\nDemo Credential, Inventory, and Job Template added.\r\nSuccessfully registered instance awx\r\n(changed: True)\r\nCreating instance group tower\r\nAdded instance awx to tower\r\n(changed: True)\r\n<\/pre>\n<p>Step 14: Login to tower via http:\/\/yourip (username is admin, pass is password)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2131\" src=\"http:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2017-09-12-at-11.04.34-AM.png\" alt=\"\" width=\"626\" height=\"434\" srcset=\"https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2017-09-12-at-11.04.34-AM.png 626w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2017-09-12-at-11.04.34-AM-300x208.png 300w\" sizes=\"auto, (max-width: 626px) 100vw, 626px\" \/><\/p>\n<p>Step 15: Once logged in you should see<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2130\" src=\"http:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2017-09-12-at-10.52.42-AM.png\" alt=\"\" width=\"1435\" height=\"741\" srcset=\"https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2017-09-12-at-10.52.42-AM.png 1435w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2017-09-12-at-10.52.42-AM-300x155.png 300w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2017-09-12-at-10.52.42-AM-768x397.png 768w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2017-09-12-at-10.52.42-AM-1024x529.png 1024w\" sizes=\"auto, (max-width: 1435px) 100vw, 1435px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As you probably read we did opensource ansible tower https:\/\/github.com\/ansible\/awx . This was a big and necessary step to follow the red hat way of being truly opensource. Thanks to Jeff Geerling we also have a role https:\/\/galaxy.ansible.com\/geerlingguy\/awx\/\u00a0to install awx. To install AWX on RHEL (remember this is not supported by GSS) you need to&#8230;<\/p>\n","protected":false},"author":2,"featured_media":2136,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[64],"tags":[67,124,123,92,34],"class_list":["post-2129","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ansible","tag-ansible","tag-awx","tag-awx-project","tag-docker","tag-redhat"],"_links":{"self":[{"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/posts\/2129","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.domb.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2129"}],"version-history":[{"count":5,"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/posts\/2129\/revisions"}],"predecessor-version":[{"id":2139,"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/posts\/2129\/revisions\/2139"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/media\/2136"}],"wp:attachment":[{"href":"https:\/\/blog.domb.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.domb.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.domb.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}