I'm confused .. does the original problem reported above still exist?
--
Walter Rowe, Chief
Infrastructure Services
Office of Information Systems Management
National Institute of Standards and Technology
United States Department of Commerce

On Friday, August 12, 2022 at 2:52:10 PM UTC-4 [email protected] wrote:

> Just an update:
>
> In trying to fix an issue for the user that reported the problem I created 
> an additional issue that I was overlooking.
>
> In haste I added the -i flag as a single string ( [..., '-i 
> /etc/ansible/inventory/routers', ...] ) in the subprocess.run() list when 
> it should have been 2 strings ( [..., '-i', 
> '/etc/ansible/inventory/routers', ...] )
>
> Now I can move on to debugging the real problem for the user and not the 
> problem that I created.
>
> On Thursday, August 11, 2022 at 11:39:24 PM UTC-4 [email protected] wrote:
>
>> On Fri, 12 Aug 2022 at 04:14, [email protected] <[email protected]> 
>> wrote:
>>
>>> I've got a very odd issue with my Ansible inventory that has just 
>>> started and I cannot find the culprit. This script is one that we've run 
>>> for years. It collects some data from the user and then runs the ansible 
>>> playbook using the python3 subprocess module.
>>>
>>> When I enable verbosity in the script I think I've found what is causing 
>>> the issues. For some reason the present working directory from where I run 
>>> the script is appended with a space ahead of the inventory file that is 
>>> defined.
>>>
>>> For example, if I'm in /etc/ansible when I run the script, then the 
>>> inventory in the output appears as:
>>> inventory: ('/etc/ansible /etc/ansible/inventory/routers')
>>>
>>> If I'm in my home directory when I run the script, then the inventory in 
>>> the output appears as:
>>> inventory: ('/home/<username> /etc/ansible/inventory/routers')
>>>
>>> However, if I run the playbook with the same variables directly, without 
>>> the script, the inventory ansible is now looking for is:
>>> inventory: ('/etc/ansible/inventory/routers')
>>>
>>> And the device I'm working on is now found in the inventory and the 
>>> playbook proceeds to run.
>>>
>>> Prior to debugging this, the inventory wasn't defined in the script (or 
>>> on the CLI) and was defined in the /etc/ansible/ansible.cfg with:
>>> inventory = /etc/ansible/inventory/
>>>
>>> But since the issue started I added the explicit inventory file to use 
>>> in an attempt to test and that still did not fix the issue.
>>>
>>> I also have verified that the ansible version and directories are all 
>>> the same both on the script run and my manual run.
>>>
>>> $ ansible --version
>>> ansible [core 2.12.6]
>>>   config file = /etc/ansible/ansible.cfg
>>>   configured module search path = 
>>> ['/home/<username>/.ansible/plugins/modules', 
>>> '/usr/share/ansible/plugins/modules']
>>>   ansible python module location = 
>>> /usr/local/lib/python3.9/site-packages/ansible
>>>   ansible collection location = 
>>> /etc/ansible/collections:/home/<username>/.ansible/collections
>>>   executable location = /usr/local/bin/ansible
>>>   python version = 3.9.7 (default, Sep 13 2021, 08:18:39) [GCC 8.5.0 
>>> 20210514 (Red Hat 8.5.0-3)]
>>>   jinja version = 3.1.2
>>>   libyaml = True
>>>
>>> Anyone have an idea on where I can look for the culprit that has 
>>> suddenly started appending the $PWD ahead of the inventory file, but only 
>>> when run from the script.
>>>
>>
>> If things work without the script, and fail with the script, then logic 
>> dictates that the script is causing the problem.
>>
>> If this mysterious script has suddenly started changed its behaviour, 
>> then you need to find out what why, for example what changed on that host, 
>> and when.
>> Perhaps run it on another host?
>> With the supplied amount information this is about as much help there is 
>> possible.
>>
>>
>>
>>
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Ansible Project" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/96538934-8f5e-4951-83d1-4f441c903624n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/ansible-project/96538934-8f5e-4951-83d1-4f441c903624n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> -- 
>> Sent from Gmail Mobile
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/84633dcd-f553-419e-af6a-3ba3ae903d0an%40googlegroups.com.

Reply via email to