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"
]
}
}
}