Re: [openstack-dev] [ironic][bifrost] Unable to Enroll Inventory

2017-08-07 Thread Mark Goddard
Hi Aimee,

I suspect the reason that ansible is owned by root in your setup is that
you ran scripts/env-setup.sh using sudo. Could you paste the errors seen
when running without sudo?

Mark

On 3 August 2017 at 23:09, Aimee Ukasick 
wrote:

> Thanks Mark for pointing me in the right direction! It turned out to
> be a permissions issue with the local Ansible installation.
>
> I started over with a new user (stack, passwordless sudo) and decided
> to use the bifrost's env-setup script, which I was not able to run
> unless prefaced with sudo.
>
>
> stack@ubuntu-jumphost:~/bifrost$ sudo bash ./scripts/env-setup.sh
>
> stack@ubuntu-jumphost:~/bifrost$ source env-vars
>
> stack@ubuntu-jumphost:~/bifrost$ echo $PATH
> /home/stack/.local/bin:/home/stack/bin:/home/stack/.local/
> bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/
> sbin:/bin:/usr/games:/usr/local/games:/snap/bin
>
> stack@ubuntu-jumphost:~/bifrost/playbooks$ which ansible
> /home/stack/.local/bin/ansible
> stack@ubuntu-jumphost:~/bifrost/playbooks$ ansible-playbook - -i
> inventory/target install.yaml -e staging_drivers_include=true
> Traceback (most recent call last):
>   File "/home/stack/.local/bin/ansible-playbook", line 44, in 
> import ansible.constants as C
> ImportError: No module named ansible.constants
>
> stack@ubuntu-jumphost:~/bifrost/playbooks$ ansible --version
> Traceback (most recent call last):
>   File "/home/stack/.local/bin/ansible", line 44, in 
> import ansible.constants as C
> ImportError: No module named ansible.constants
>
> The ~/.local/bin/ansible folder was owned by root:root as was
> ~/.ansible. Once I changed the ownership to stack:stack, ansible
> worked as expected. I was able to run the ansible-playbook command
> without prefacing it with sudo. So I had a successful installation. Do
> you know why the bifrost env-setup.sh installed ansible with root
> ownership in my ~/.local directory? Is that the default Ansible
> behavior?  Is the expectation that I switch to root to install/run
> bifrost?
>
>
> I was able to enroll my servers without a hitch.
>
> Friday I plan to deploy - hopefully I've identified and fixed all the
> kinks on my system.
>
>
> Thanks again for your help!
>
> aimee
> irc:aimeeu
>
>
>
> On Thu, Aug 3, 2017 at 3:27 AM, Mark Goddard  wrote:
> > Hi Aimee,
> >
> > My guess is that your error is due to your use of sudo when running
> > ansible-playbook.
>
> __
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [ironic][bifrost] Unable to Enroll Inventory

2017-08-03 Thread Aimee Ukasick
Thanks Mark for pointing me in the right direction! It turned out to
be a permissions issue with the local Ansible installation.

I started over with a new user (stack, passwordless sudo) and decided
to use the bifrost's env-setup script, which I was not able to run
unless prefaced with sudo.


stack@ubuntu-jumphost:~/bifrost$ sudo bash ./scripts/env-setup.sh

stack@ubuntu-jumphost:~/bifrost$ source env-vars

stack@ubuntu-jumphost:~/bifrost$ echo $PATH
/home/stack/.local/bin:/home/stack/bin:/home/stack/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

stack@ubuntu-jumphost:~/bifrost/playbooks$ which ansible
/home/stack/.local/bin/ansible
stack@ubuntu-jumphost:~/bifrost/playbooks$ ansible-playbook - -i
inventory/target install.yaml -e staging_drivers_include=true
Traceback (most recent call last):
  File "/home/stack/.local/bin/ansible-playbook", line 44, in 
import ansible.constants as C
ImportError: No module named ansible.constants

stack@ubuntu-jumphost:~/bifrost/playbooks$ ansible --version
Traceback (most recent call last):
  File "/home/stack/.local/bin/ansible", line 44, in 
import ansible.constants as C
ImportError: No module named ansible.constants

The ~/.local/bin/ansible folder was owned by root:root as was
~/.ansible. Once I changed the ownership to stack:stack, ansible
worked as expected. I was able to run the ansible-playbook command
without prefacing it with sudo. So I had a successful installation. Do
you know why the bifrost env-setup.sh installed ansible with root
ownership in my ~/.local directory? Is that the default Ansible
behavior?  Is the expectation that I switch to root to install/run
bifrost?


I was able to enroll my servers without a hitch.

Friday I plan to deploy - hopefully I've identified and fixed all the
kinks on my system.


Thanks again for your help!

aimee
irc:aimeeu



On Thu, Aug 3, 2017 at 3:27 AM, Mark Goddard  wrote:
> Hi Aimee,
>
> My guess is that your error is due to your use of sudo when running
> ansible-playbook.

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


[openstack-dev] [ironic][bifrost] Unable to Enroll Inventory

2017-08-02 Thread Aimee Ukasick
Hi Bifrost Gurus!  I'm following the Brifost docs and am stuck trying
to enroll inventory.
I have only a passing familiarity with ansible,ironic, and python,
which puts me firmly in the "complete ignoramous" category.

OS: Ubuntu 16.04.2 LTS desktop (fresh install)
Sudo User: bifrost
Ansibile: 2.3.1.0
Python: 2.7.12
pip 9.0.1
bifrost: cloned from master on 2 Aug 2017

1. modified the files in bifrost/playbooks/inventory/group_vars
--  network_interface, mysql_password, dnsmasq_router, and dnsmasq_dns_servers
2. install reqs:  sudo pip install -r requirements.txt
3. run installation playbook: sudo ansible-playbook -K - -i
inventory/target install.yaml
4. source env-vars
5. ironic node-list to check ironic installation
6. created baremetal.yml and baremetal.json based on the examples
7. export BIFROST_INVENTORY_SOURCE=/home/bifrost/osgit/baremetal.json
8. sudo ansible-playbook -K - -i inventory/bifrost_inventory.py
enroll-dynamic.yaml

#8 threw this error:
ERROR! Attempted to execute "inventory/bifrost_inventory.py" as
inventory script:
Inventory script (inventory/bifrost_inventory.py) had an execution error:

No error was printed out and I couldn't find any logs, so I hopped onto IRC.
TheJulia suggested passing the environment variable and directly
executing the script to troubleshoot.

So after looking at the code, I executed bifrost/inventory.py and
saved the output in baremetal2.json.
Then export BIFROST_INVENTORY_SOURCE=/home/bifrost/osgit/baremetal2.json
Then sudo ansible-playbook -K - -i inventory/bifrost_inventory.py
enroll-dynamic.yaml
Same error as above.

Then:
sudo ansible-playbook -K - -i /home/bifrost/osgit/baremetal2.json
enroll-dynamic.yaml
which threw:
ERROR! Attempted to read "/home/bifrost/osgit/baremetal2.json" as YAML:
list indices must be integers, not unicode
Attempted to read "/home/bifrost/osgit/baremetal2.json" as ini file:
 /home/bifrost/osgit/baremetal2.json:2: Expected key=value host
variable assignment, got: {

Then:
sudo ansible-playbook -K - -i /home/bifrost/osgit/baremetal.yml
enroll-dynamic.yaml
which provided this output:
 [WARNING]: provided hosts list is empty, only localhost is available
Loading callback plugin default of type stdout, v2.0 from
/usr/lib/python2.7/dist-packages/ansible/plugins/callback/__init__.pyc
PLAYBOOK: enroll-dynamic.yaml

1 plays in enroll-dynamic.yaml
PLAY [Enroll hardware from inventory into Ironic]

skipping: no hosts matched
PLAY RECAP 



The issues I'm having must be user error, so I'd appreciate extra sets
of eyes and suggestions.
YAML, JSON, and terminal output: http://paste.openstack.org/show/617344/

I'm prototyping  using a NUC and 2 Super Micro servers with the goal of using
bifrost and ansible to manage the server lab that somehow landed in my lap.

Thanks in advance for any help you can give me!

Aimee Ukasick
IRC: aimeeu

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev