lvg/jinja issue

49 views
Skip to first unread message

Mikael Sandström

unread,
Jul 20, 2016, 2:29:37 AM7/20/16
to Ansible Project
Hi,

ansible --version 


ansible 2.1.0.0

  config file = /Users/miksan/.ansible.cfg

  configured module search path = Default w/o overrides


I've got this gist where I'm attempting to create a volumegroup with multiple devices.

If I just debug the output it looks ok, 

"msg": "vg=vgtest pvs=/dev/sdb1,/dev/sdc1,/dev/sdd1 "


and if I copy-paste the debug message and run that as-is, it works as intended and the volume group is created ( I removed parts of the -vvv output).

ansible hostfs -m lvg -a "vg=vgtest pvs=/dev/sdb1,/dev/sdc1,/dev/sdd1 state=present" -s -i ~miksan/Applications/vagrant/hostfs/inventory -vvv



hostfs1 | SUCCESS => {


    "changed": true,


    "invocation": {


        "module_args": {


            "force": false,


            "pesize": 4,


            "pvs": [


                "/dev/sdb1",


                "/dev/sdc1",


                "/dev/sdd1"


            ],


            "state": "present",


            "vg": "vgtest",


            "vg_options": ""


        },


        "module_name": "lvg"


    }


}




But if I run the playbook, it fails at the lvg step with the following error.

TASK [filesystem | Create vg] **************************************************


failed: [hostfs1] (item={u'vgname': u'vgtest', u'disk': [{u'device': u'/dev/sdb', u'pvname': u'/dev/sdb1'}, {u'device': u'/dev/sdc', u'pvname': u'/dev/sdc1'}, {u'device': u'/dev/sdd', u'pvname': u'/dev/sdd1'}], u'filesystem': [{u'mntp': u'/vgtest', u'fstype': u'ext4', u'lvname': u'lvtest'}]}) => {"failed": true, "item": {"disk": [{"device": "/dev/sdb", "pvname": "/dev/sdb1"}, {"device": "/dev/sdc", "pvname": "/dev/sdc1"}, {"device": "/dev/sdd", "pvname": "/dev/sdd1"}], "filesystem": [{"fstype": "ext4", "lvname": "lvtest", "mntp": "/vgtest"}], "vgname": "vgtest"}, "msg": "Device /dev/sdd1  not found."}


It doesn't matter if I just use 1 device as well, the result is the same.

So, I'm not sure if the jinja-part does something to the string that I can't see or if there is something else going on.

Any ideas?

regards
/M

Kai Stian Olstad

unread,
Jul 20, 2016, 4:13:02 AM7/20/16
to ansible...@googlegroups.com
On 20.07.2016 08:29, Mikael Sandström wrote:
> TASK [filesystem | Create vg]
> **************************************************
>
> failed: [hostfs1] (item={u'vgname': u'vgtest', u'disk': [{u'device': u
> '/dev/sdb', u'pvname': u'/dev/sdb1'}, {u'device': u'/dev/sdc',
> u'pvname': u
> '/dev/sdc1'}, {u'device': u'/dev/sdd', u'pvname': u'/dev/sdd1'}], u
> 'filesystem': [{u'mntp': u'/vgtest', u'fstype': u'ext4', u'lvname': u
> 'lvtest'}]}) => {"failed": true, "item": {"disk": [{"device":
> "/dev/sdb",
> "pvname": "/dev/sdb1"}, {"device": "/dev/sdc", "pvname": "/dev/sdc1"},
> {
> "device": "/dev/sdd", "pvname": "/dev/sdd1"}], "filesystem":
> [{"fstype":
> "ext4", "lvname": "lvtest", "mntp": "/vgtest"}], "vgname": "vgtest"},
> "msg": *"Device
> /dev/sdd1 not found."}*

I seems to be a spaces at the end of /dev/sdd1


> It doesn't matter if I just use 1 device as well, the result is the
> same.
>
> So, I'm not sure if the jinja-part does something to the string that I
> can't see or if there is something else going on.
>
> Any ideas?

Try removing the space at the end of host_fs_layout_vgdisks under vars.

--
Kai Stian Olstad

Mikael Sandström

unread,
Jul 20, 2016, 3:12:48 PM7/20/16
to Ansible Project, ansible-pr...@olstad.com
Yep - that did the trick. 

Thanks for the extra set of eyes!

/M
Reply all
Reply to author
Forward
0 new messages