try this:

- name: mount filesystem
  mount:
    name="{{ item.name}}"
    src="{{ item.src}}"
    fstype="{{ item.fstype}}"

etc ...

On Tue, Jan 5, 2016 at 4:13 AM, Marten Bauer
<[email protected]> wrote:
> Hey,
>
> I create the following local facts file in /etc/ansible/facts.d/mount.fact:
>
> [
>       {
>          "name": "/mastersystem",
>          "src": "/dev/sda1",
>          "fstype": "ext3",
>          "state": "mounted",
>          "opts": "defaults"
>        }
>
> ]
>
> when I try to use this facts for the mount module like
>
>
> - name: mount filesystem
>   mount:
>     name="{{ item }}.name"
>     src="{{ item }}.src"
>     fstype="{{ item }}.fstype"
>     state="{{ item }}.state"
>     opts="{{ item }}.opts"
>   with_items:
>     "{{ ansible_local.mount }}"
>
>
> I got an error like
>
>
> failed: [127.0.0.1] => (item={u'src': u'/dev/sda1', u'state': u'mounted',
> u'name': u'/mastersystem', u'opts': u'defaults', u'fstype': u'ext3'}) =>
> {"failed": true, "item": {"fstype": "ext3", "name": "/mastersystem", "opts":
> "defaults", "src": "/dev/sda1", "state": "mounted"}} msg: value of state
> must be one of: present,absent,mounted,unmounted, got: {u'src':
> u'/dev/sda1', u'state': u'mounted', u'name': u'/mastersystem', u'opts':
> u'defaults', u'fstype': u'ext3'}.state
>
> Any other tries are resulting in similar errors. Any idea what I did wrong?
>
> - debug: var=ansible_local.mount before the task above results in:
>
>  TASK: [system_init_stage_2 | debug var=ansible_local]
> *************************
> ok: [127.0.0.1] => {
>     "var": {
>         "ansible_local": {
>             "grub": {
>                 "install_device": "/dev/sda"
>             },
>             "mount": [
>                 {
>                     "fstype": "ext3",
>                     "name": "/mastersystem",
>                     "opts": "defaults",
>                     "src": "/dev/sda1",
>                     "state": "mounted"
>                 }
>             ],
>             "system": [
>                 "backupsystem"
>             ]
>         }
>     }
> }
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/448971bf-3acb-48a5-8779-902e300b86d7%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Brian Coca

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAJ5XC8%3DFHzjYfKOg8gpsZFmBTsZLnYGXUanO_Hc%2B7_ydYhz84g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to