ansible-owncloud icon indicating copy to clipboard operation
ansible-owncloud copied to clipboard

debops owncloud: KeyError: 'undefined variable: 0'"

Open jbicha opened this issue 8 years ago • 3 comments

If I list my Ubuntu server under [debops_service_nginx] and run $ debops , the run completes successfully. If I add it to [debops_service_owncloud], it fails. Errors posted below.

TASK [debops.nginx : Create global webroot directories if allowed] *************
task path: /home/jeremy/.local/share/debops/debops-playbooks/roles/debops.nginx/tasks/nginx_servers.yml:3
ok: [example.bicha.net] => (item={u'welcome_domain': u'bicha.net', u'welcome': True, u'enabled': True, u'name': [u'welcome']}) => {
    "changed": false, 
    "diff": {
        "after": {
            "path": "/srv/www/sites/welcome/public"
        }, 
        "before": {
            "path": "/srv/www/sites/welcome/public"
        }
    }, 
    "gid": 0, 
    "group": "root", 
    "invocation": {
        "module_args": {
            "backup": null, 
            "content": null, 
            "delimiter": null, 
            "diff_peek": null, 
            "directory_mode": null, 
            "follow": false, 
            "force": false, 
            "group": "root", 
            "mode": "0755", 
            "original_basename": null, 
            "owner": "root", 
            "path": "/srv/www/sites/welcome/public", 
            "recurse": false, 
            "regexp": null, 
            "remote_src": null, 
            "selevel": null, 
            "serole": null, 
            "setype": null, 
            "seuser": null, 
            "src": null, 
            "state": "directory", 
            "unsafe_writes": null, 
            "validate": null
        }, 
        "module_name": "file"
    }, 
    "item": {
        "enabled": true, 
        "name": [
            "welcome"
        ], 
        "welcome": true, 
        "welcome_domain": "bicha.net"
    }, 
    "mode": "0755", 
    "owner": "root", 
    "path": "/srv/www/sites/welcome/public", 
    "size": 2, 
    "state": "directory", 
    "uid": 0
}
ok: [example.bicha.net] => (item={u'name': [u'localhost', u'127.0.0.1', u'[::1]'], u'acme': False, u'welcome': True, u'enabled': True, u'ssl': False, u'welcome_css': False}) => {
    "changed": false, 
    "diff": {
        "after": {
            "path": "/srv/www/sites/localhost/public"
        }, 
        "before": {
            "path": "/srv/www/sites/localhost/public"
        }
    }, 
    "gid": 0, 
    "group": "root", 
    "invocation": {
        "module_args": {
            "backup": null, 
            "content": null, 
            "delimiter": null, 
            "diff_peek": null, 
            "directory_mode": null, 
            "follow": false, 
            "force": false, 
            "group": "root", 
            "mode": "0755", 
            "original_basename": null, 
            "owner": "root", 
            "path": "/srv/www/sites/localhost/public", 
            "recurse": false, 
            "regexp": null, 
            "remote_src": null, 
            "selevel": null, 
            "serole": null, 
            "setype": null, 
            "seuser": null, 
            "src": null, 
            "state": "directory", 
            "unsafe_writes": null, 
            "validate": null
        }, 
        "module_name": "file"
    }, 
    "item": {
        "acme": false, 
        "enabled": true, 
        "name": [
            "localhost", 
            "127.0.0.1", 
            "[::1]"
        ], 
        "ssl": false, 
        "welcome": true, 
        "welcome_css": false
    }, 
    "mode": "0755", 
    "owner": "root", 
    "path": "/srv/www/sites/localhost/public", 
    "size": 3, 
    "state": "directory", 
    "uid": 0
}

TASK [debops.nginx : Create default welcome page if enabled] *******************
task path: /home/jeremy/.local/share/debops/debops-playbooks/roles/debops.nginx/tasks/nginx_servers.yml:22
failed: [example.bicha.net] (item={u'welcome_domain': u'bicha.net', u'welcome': True, u'enabled': True, u'name': [u'welcome']}) => {
    "failed": true, 
    "invocation": {
        "module_args": {
            "dest": "/srv/www/sites/welcome/public/index.html", 
            "force": false, 
            "group": "root", 
            "owner": "root", 
            "src": "srv/www/sites/welcome/public/index.html.j2"
        }, 
        "module_name": "template"
    }, 
    "item": {
        "enabled": true, 
        "name": [
            "welcome"
        ], 
        "welcome": true, 
        "welcome_domain": "bicha.net"
    }, 
    "msg": "KeyError: 'undefined variable: 0'"
}

jbicha avatar Jan 13 '17 03:01 jbicha

I think I was able to work around this by setting nginx_webroot_create: False

jbicha avatar Jan 14 '17 06:01 jbicha

Thanks for reporting. Wired. The ownCloud role should not effect the "Create default welcome page if enabled" task. Can you try with Ansible 2.1.3? Also, the role versions I test can be found here: https://github.com/ypid/ypid-ansible-common/ or refer to the CI tests for a working test case.

ypid avatar Jan 14 '17 07:01 ypid

Not a user of owncloud but found this issue when looking for the solution to a bug with the same dependency.

Can confirm that upgrading to ansible 2.2.1 resolve the error.

splitice avatar Feb 22 '17 05:02 splitice