<div dir="ltr">Hi Aimee,<div><br></div><div>My guess is that your error is due to your use of sudo when running ansible-playbook. Without passing '-E' to sudo, the calling user's environment will be lost, including $BIFROST_INVENTORY_SOURCE. You shouldn't need to run ansible using sudo, it has its own mechanisms[1] for obtaining superuser privileges. I'd suggest trying to get it to work without sudo.</div><div class="gmail_extra"><br></div><div class="gmail_extra">[1] <a href="https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwiFt4-50rrVAhVDDcAKHbggDR0QFggpMAA&url=http%3A%2F%2Fdocs.ansible.com%2Fbecome.html&usg=AFQjCNHPX27H9cPC6KUoYmVunC5GBa2FdA">https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwiFt4-50rrVAhVDDcAKHbggDR0QFggpMAA&url=http%3A%2F%2Fdocs.ansible.com%2Fbecome.html&usg=AFQjCNHPX27H9cPC6KUoYmVunC5GBa2FdA</a></div><div class="gmail_extra"><br></div><div class="gmail_extra">Cheers,</div><div class="gmail_extra">Mark</div><div class="gmail_extra"><br><div class="gmail_quote">On 2 August 2017 at 23:40, Aimee Ukasick <span dir="ltr"><<a href="mailto:aimeeu.opensource@gmail.com" target="_blank">aimeeu.opensource@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Bifrost Gurus!  I'm following the Brifost docs and am stuck trying<br>
to enroll inventory.<br>
I have only a passing familiarity with ansible,ironic, and python,<br>
which puts me firmly in the "complete ignoramous" category.<br>
<br>
OS: Ubuntu 16.04.2 LTS desktop (fresh install)<br>
Sudo User: bifrost<br>
Ansibile: 2.3.1.0<br>
Python: 2.7.12<br>
pip 9.0.1<br>
bifrost: cloned from master on 2 Aug 2017<br>
<br>
1. modified the files in bifrost/playbooks/inventory/<wbr>group_vars<br>
--  network_interface, mysql_password, dnsmasq_router, and dnsmasq_dns_servers<br>
2. install reqs:  sudo pip install -r requirements.txt<br>
3. run installation playbook: sudo ansible-playbook -K -vvvv -i<br>
inventory/target install.yaml<br>
4. source env-vars<br>
5. ironic node-list to check ironic installation<br>
6. created baremetal.yml and baremetal.json based on the examples<br>
7. export BIFROST_INVENTORY_SOURCE=/<wbr>home/bifrost/osgit/baremetal.<wbr>json<br>
8. sudo ansible-playbook -K -vvvv -i inventory/bifrost_inventory.py<br>
enroll-dynamic.yaml<br>
<br>
#8 threw this error:<br>
ERROR! Attempted to execute "inventory/bifrost_inventory.<wbr>py" as<br>
inventory script:<br>
Inventory script (inventory/bifrost_inventory.<wbr>py) had an execution error:<br>
<br>
No error was printed out and I couldn't find any logs, so I hopped onto IRC.<br>
TheJulia suggested passing the environment variable and directly<br>
executing the script to troubleshoot.<br>
<br>
So after looking at the code, I executed bifrost/inventory.py and<br>
saved the output in baremetal2.json.<br>
Then export BIFROST_INVENTORY_SOURCE=/<wbr>home/bifrost/osgit/baremetal2.<wbr>json<br>
Then sudo ansible-playbook -K -vvvv -i inventory/bifrost_inventory.py<br>
enroll-dynamic.yaml<br>
Same error as above.<br>
<br>
Then:<br>
sudo ansible-playbook -K -vvvv -i /home/bifrost/osgit/<wbr>baremetal2.json<br>
enroll-dynamic.yaml<br>
which threw:<br>
ERROR! Attempted to read "/home/bifrost/osgit/<wbr>baremetal2.json" as YAML:<br>
list indices must be integers, not unicode<br>
Attempted to read "/home/bifrost/osgit/<wbr>baremetal2.json" as ini file:<br>
 /home/bifrost/osgit/<wbr>baremetal2.json:2: Expected key=value host<br>
variable assignment, got: {<br>
<br>
Then:<br>
sudo ansible-playbook -K -vvvv -i /home/bifrost/osgit/baremetal.<wbr>yml<br>
enroll-dynamic.yaml<br>
which provided this output:<br>
 [WARNING]: provided hosts list is empty, only localhost is available<br>
Loading callback plugin default of type stdout, v2.0 from<br>
/usr/lib/python2.7/dist-<wbr>packages/ansible/plugins/<wbr>callback/__init__.pyc<br>
PLAYBOOK: enroll-dynamic.yaml<br>
******************************<wbr>******************************<wbr>****************************<br>
1 plays in enroll-dynamic.yaml<br>
PLAY [Enroll hardware from inventory into Ironic]<br>
******************************<wbr>******************************<wbr>********<br>
skipping: no hosts matched<br>
PLAY RECAP ****************<br>
<br>
<br>
<br>
The issues I'm having must be user error, so I'd appreciate extra sets<br>
of eyes and suggestions.<br>
YAML, JSON, and terminal output: <a href="http://paste.openstack.org/show/617344/" rel="noreferrer" target="_blank">http://paste.openstack.org/<wbr>show/617344/</a><br>
<br>
I'm prototyping  using a NUC and 2 Super Micro servers with the goal of using<br>
bifrost and ansible to manage the server lab that somehow landed in my lap.<br>
<br>
Thanks in advance for any help you can give me!<br>
<br>
Aimee Ukasick<br>
IRC: aimeeu<br>
<br>
______________________________<wbr>______________________________<wbr>______________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.<wbr>openstack.org?subject:<wbr>unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack-dev</a><br>
</blockquote></div><br></div></div>