Hello, this is @dz_ this and Ohira Kazumi.
For configuration management, I prefer Ansible. This time, I wanted to specify the inventory dynamically, so when I tried Dynamic Inventory ... I got stuck in the following error for a while. I was able to deal with it, so write down the memorandum.
For Dynamic Inventory, I referred to the following documents.
Here is the error I encountered.
ERROR! Attempted to execute "./dynamic-inventory.py" as inventory script: problem running ./dynamic-inventory.py --list ([Errno 8] Exec format error)
Attempted to read "./dynamic-inventory.py" as ini file: ./dynamic-inventory.py:1: Expected key=value host variable assignment, got:
"I tried to run the script, but I got an error. I also read it as an ini file, but it doesn't work."
After a lot of trial and error, I found this issue!
That file needs a shebang line.
I see, I need a shebang line
! shebang?
A shebang or shebang is the first line of a UNIX script that starts with # !.
I see! !!
So, referring to Python's Shebang line
, if you write the following shebang in my operating environment It looks good.
#!/usr/bin/env python
When I set this, it worked smoothly! (・ Ε ・;)
Shebang didn't usually care so much, so it was an unexpected pitfall!
Recommended Posts