bug in lvg module?

Hi List,

I’m trying to create an lvg using the lvg ansible module like so:

- name: Maak een vg-tc
  lvg: vg=vg.osddata.raven pvs=/dev/xvdb,/dev/xvdc state=present

But I’m getting this error back:

failed: [10.220.225.96] => {"err": "  Device /dev/xvdb /dev/xvdc not found (or ignored by filtering).\n  Unable to add physical volume '/dev/xvdb /dev/xvdc' to volume group 'vg.osddata.raven'.\n", "failed": true, "rc": 5}

It seems like it’s looking for a device called ‘/dev/xvdb /dev/xvdc’ instead of two separate devices.

I used the example from:
http://docs.ansible.com/lvg_module.html

Am I calling it wrong or is this a bug?

Thanks,
Mark

BTW, using ansible 1.8.2.

there is current bug in = option parser, try this:

- name: Maak een vg-tc
  lvg:
   vg: vg.osddata.raven
   pvs: /dev/xvdb,/dev/xvdc
   state: present

Tried it with this:

- name: Maak een vg-tc
  lvg: 
    vg: vg.osddata.raven
    pvs: /dev/xvdb,/dev/xvdc
    state: present

But still no go:

failed: [10.220.226.90] => {"err": "  Device /dev/xvdb /dev/xvdc not found (or ignored by filtering).\n  Unable to add physical volume '/dev/xvdb /dev/xvdc' to volume group 'vg.osddata.raven'.\n", "failed": true, "rc": 5}
msg: Creating volume group 'vg.osddata.raven' failed

Thanks for looking btw!

I’ve got a bit more verbosity:

<10.220.226.90> REMOTE_MODULE lvg vg=vg.osddata.raven state=present pvs=/dev/xvdb,/dev/xvdc

looks like the module is getting the correct data?

Hi List,
I’m trying to create an lvg using the lvg ansible module like so:
- name: Maak een vg-tc

  lvg: vg=vg.osddata.raven pvs=/dev/xvdb,/dev/xvdc state=present

But I’m getting this error back:
failed: [10.220.225.96] => {"err": " Device /dev/xvdb /dev/xvdc not found (or ignored by filtering).\n Unable to add physical volume '/dev/xvdb /dev/xvdc' to volume group 'vg.osddata.raven'.\n", "failed": true, "rc": 5}

It seems like it’s looking for a device called ‘/dev/xvdb /dev/xvdc’ instead of two separate devices.

It might be because parse_pvs() function is only considering devices
that start with "/dev/dm-".

Try changing it like this in
/usr/lib/python2.7/site-packages/ansible/ansible/modules/extras/system/lvg.py:

def parse_pvs(module, data):
     pvs =
- dm_prefix = '/dev/dm-'
+ dm_prefix = '/dev/'
     for line in data.splitlines():
         parts = line.strip().split(';')
         if parts[0].startswith(dm_prefix):

I've not tested this modification. Does anyone know why it's limiting
only to dm devices?

Giovanni

It seems this was indeed a bug:
https://github.com/ansible/ansible-modules-extras/issues/50

But is was closed as fixed on the 6th of november.

So I will need to wait until this bit:
https://github.com/ansible/ansible-modules-extras/commit/664858ec20630a65bbdedbe52b79bd4e61f6ceec

Finds it’s way to 1.8.3 or something?