Error in Integration of Ansible Tower with Scalr

91 views
Skip to first unread message

Amit Saini

unread,
Nov 8, 2016, 3:44:30 PM11/8/16
to scalr-discuss

Hi Team,

While Integration of Ansible Tower with Scalr and I configure the custom script ansible tower's Inventory (Refer Image 1) and try to Sync-up with Scalr but got the error  ( Refer text file job_419) with message '/var/lib/awx/scalr/inventory.py': [Errno 2] No such file or directory


While I have SSH ansible tower machine and found that there is not inventory.py file available on the following path /var/lib/awx/scalr/  (Refer Image3). I found scalr-ansible-tower file over there

Please help me!!!

Image 2.jpg
Image1.png
Image3.jpg
job_419.txt

Marc O'Brien

unread,
Nov 8, 2016, 4:05:04 PM11/8/16
to scalr-discuss
Hi Amit,

Are you following our Ansible Tower with Scalr Tutorial?  If so, it appears that when you run "git clone https://github.com/scalr-tutorials/scalr-ansible-tower.git" there is an additional level in the directory tree.  Do you see any change to behavior if you move the contents of scalr-ansible-tower to /var/lib/awx/scalr, or update the path in the Ansible script to include the
scalr-ansible-tower folder in the directory path to inventory.py?  This should resolve the "no such file" error that you are experiencing.

Many thanks,
Wm. Marc O'Brien
Scalr Technical Support



Amit Saini

unread,
Nov 9, 2016, 11:45:52 AM11/9/16
to scalr-...@googlegroups.com

Thanks Marc for replying

Yes I am following Scalr document. I have copy the content of scalr-ansible-tower to /var/lib/awx/scalr  ( Refer the Image4 ) but still I am getting the same error ( Refer job_477.txt )

 

 Please help me!!!

job_477.txt
Image4.jpg

Amit Saini

unread,
Nov 10, 2016, 12:17:59 PM11/10/16
to scalr-discuss

Hi Marc,

I did change in first line ( marked bold) of following script. Now not getting this error

 failed (rc=2) with output: python: can't open file [Errno 2] No such file or directory

***************************************

#!usr/bin/bash/python2.7

if [ "$1" == "--list" ]; then

   python /var/lib/awx/scalr/scalr-ansible-tower/inventory.py $SCALR_API_URL $SCALR_API_KEY_ID $SCALR_API_KEY_SECRET $SCALR_ENV_ID $SCALR_FARM_ID

else

   echo '{}'

fi

************************************

 

But  New Error is came  :(

2.248 INFO Updating inventory 4: Scalr Inventory 2.277 INFO Reading executable JSON source: /tmp/ansible_tower_launch_8bq4Ga/tmpy0MuDU 2.301 ERROR Failed to load JSON from: Traceback (most recent call last): File "/usr/bin/tower-manage", line 9, in <module> load_entry_point('ansible-tower==3.0.3', 'console_scripts', 'tower-manage')() File "/lib/python2.7/site-packages/awx/__init__.py", line 103, in manage File "/var/lib/awx/venv/tower/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line utility.execute() File "/var/lib/awx/venv/tower/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/var/lib/awx/venv/tower/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv self.execute(*args, **cmd_options) File "/var/lib/awx/venv/tower/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute output = self.handle(*args, **options) File "/var/lib/awx/venv/tower/lib/python2.7/site-packages/django/core/management/base.py", line 661, in handle return self.handle_noargs(**options) File "/lib/python2.7/site-packages/awx/main/management/commands/inventory_import.py", line 1285, in handle_noargs File "/lib/python2.7/site-packages/awx/main/management/commands/inventory_import.py", line 499, in load_inventory_source File "/lib/python2.7/site-packages/awx/main/management/commands/inventory_import.py", line 503, in load_inventory_source File "/lib/python2.7/site-packages/awx/main/management/commands/inventory_import.py", line 393, in load File "/lib/python2.7/site-packages/awx/main/management/commands/inventory_import.py", line 381, in command_to_json RuntimeError: ['proot', '-v', '0', '-r', '/', '-b', '/tmp/ansible_tower_launch_8bq4Ga/tmp_P6tYy:/etc/tower', '-b', '/tmp/ansible_tower_launch_8bq4Ga/tmpI8YWHM:/tmp', '-b', '/tmp/ansible_tower_launch_8bq4Ga/tmpzmar2T:/var/lib/awx', '-b', '/tmp/ansible_tower_launch_8bq4Ga/tmp91ioqa:/var/lib/awx/job_status', '-b', '/tmp/ansible_tower_launch_8bq4Ga/tmpAB66lA:/var/lib/awx/projects', '-b', '/tmp/ansible_tower_launch_8bq4Ga/tmp0gB6tg:/var/log', '-b', '/tmp/ansible_tower_launch_8bq4Ga:/tmp/ansible_tower_launch_8bq4Ga', '-b', '/var/lib/awx/venv/ansible:/var/lib/awx/venv/ansible', '-b', '/var/lib/awx/venv/tower:/var/lib/awx/venv/tower', '-w', '/tmp/ansible_tower_launch_8bq4Ga', '/tmp/ansible_tower_launch_8bq4Ga/tmpy0MuDU', '--list'] failed (rc=1) with output: proot error: execve("/tmp/ansible_tower_launch_8bq4Ga/tmpy0MuDU"): No such file or directory proot info: possible causes: * the program is a script but its interpreter (eg. /bin/sh) was not found; * the program is an ELF but its interpreter (eg. ld-linux.so) was not found; * the program is a foreign binary but qemu was not specified; * qemu does not work correctly (if specified); * the loader was not found or doesn't work. fatal error: see `proot --help`. proot error: can't chmod '/tmp/proot-14165-FKg5i0': No such file or directory

Marc O'Brien

unread,
Nov 10, 2016, 3:03:13 PM11/10/16
to scalr-discuss
Hi Amit,

This issue is likely due to multiple tenant security being enabled on the tower server. The custom inventory script (few lines of bash) gets executed in a proot, which hides most of the filesystem, and that’s why Python can’t open inventory.py.

Could you please replace the contents of the custom inventory script in tower with the contents of the all-in-one.py file attached here? Current content that will need to be replace should be:
#!/bin/bash


if [ "$1" == "--list" ]; then
   python /var/lib/awx/scalr/inventory.py $SCALR_API_URL $SCALR_API_KEY_ID $SCALR_API_KEY_SECRET $SCALR_ENV_ID $SCALR_FARM_ID
else
   echo '{}'
fi
)

Many thanks,
Wm. Marc O'Brien
Scalr Technical Support


all-in-one.py
Reply all
Reply to author
Forward
0 new messages