debops / ansible-apache

Manage and configure the Apache HTTP Server
GNU General Public License v3.0
2 stars 6 forks source link

RepresenterError: cannot represent an object: debops.apache-status #12

Closed vgeorgio closed 7 years ago

vgeorgio commented 7 years ago

After today upgrade:

failed: [www2] (item={u'root': u'/var/www/html', u'name': u'default.erba.hu', u'filename': u'000-default'}) => { "failed": true,
"invocation": {
"module_args": {
"dest": "/etc/apache2/sites-available/000-default.conf",
"group": "root",
"mode": "0644",
"owner": "root",
"src": "etc/apache2/sites-available/default.conf.j2"
},
"module_name": "template"
},
"item": {
"filename": "000-default",
"name": "default.erba.hu",
"root": "/var/www/html"
},
"msg": "RepresenterError: cannot represent an object: 000-default"
} failed: [www2] (item={u'name': [u'localhost'], u'status_enabled': True, u'enabled': False, u'filename': u'debops.apache-status', u'status_allow_localhost': True, u'https_enabled': False, u'listen_http': [u'localhost:80']}) => {
"failed": true,
"invocation": { "module_args": { "dest": "/etc/apache2/sites-available/debops.apache-status.conf", "group": "root", "mode": "0644", "owner": "root", "src": "etc/apache2/sites-available/default.conf.j2" }, "module_name": "template" }, "item": { "enabled": false, "filename": "debops.apache-status", "https_enabled": false, "listen_http": [ "localhost:80" ], "name": [ "localhost" ], "status_allow_localhost": true, "status_enabled": true }, "msg": "RepresenterError: cannot represent an object: debops.apache-status" }

It's same with virtualhosts

$ ansible --version ansible 2.2.1.0

ypid commented 7 years ago

From which Ansible version did you upgrade and was https://github.com/debops/debops-playbooks/pull/338 helpful :wink: ? I am not using 2.2 yet. Can you try with https://github.com/ansible/ansible/tree/stable-2.2 ?

vgeorgio commented 7 years ago

I used ansible v2.2.0.0-1, but debops required ansible 2.2.1 after debops-upgrade I upgraded ansible to the last version from git too. Then it broke it the debops. After all I downgraded ansible to 2.2.0.0-1 and changed the version_compare to 2.2.0.0, and it's working now (but possibly vulnerable)

ypid commented 7 years ago

So you have tried it with https://github.com/ansible/ansible/tree/stable-2.2? Can you give me the output of ansible --version when you tried it with stable-2.2? Submodules up to date?

ypid commented 7 years ago

Ping @vgeorgio

ganto commented 7 years ago

Experienced same error today with the debops.apache role from galaxy running on Fedora towards a clean install of up-to-date Jessie:

$ rpm -q ansible
ansible-2.2.1.0-1.fc24.noarch
$ ansible --version
ansible 2.2.1.0
  config file = /home/ganto/.ansible.cfg
  configured module search path = Default w/o overrides

Error:

TASK [debops.apache : Create sites-available configuration] ********************
task path: /home/ganto/.ansible/roles/debops.apache/tasks/main.yml:100
skipping: [apache.example.com] => (item={u'comment': u'`postinst` of the `apache2` package normally tries to enable\nthe `000-default` site without checking if it 
is actually there.\nDivert the package provided `000-default` site file away, we will not need it :)\n', u'divert_filename': u'package-default', u'type': u'divert', u'na
me': u'000-default', u'divert_suffix': u''})  => {
    "changed": false, 
    "item": {
        "comment": "`postinst` of the `apache2` package normally tries to enable\nthe `000-default` site without checking if it is actually there.\nDivert the package pr
ovided `000-default` site file away, we will not need it :)\n", 
        "divert_filename": "package-default", 
        "divert_suffix": "", 
        "name": "000-default", 
        "type": "divert"
    }, 
    "skip_reason": "Conditional check failed", 
    "skipped": true
}
skipping: [apache.example.com] => (item={u'comment': u'Divert the package provided `default-ssl` site file away, we will not need it :)\n', u'divert_filename': u'p
ackage-default-https', u'type': u'divert', u'name': u'default-ssl', u'divert_suffix': u''})  => {
    "changed": false, 
    "item": {
        "comment": "Divert the package provided `default-ssl` site file away, we will not need it :)\n", 
        "divert_filename": "package-default-https", 
        "divert_suffix": "", 
        "name": "default-ssl", 
        "type": "divert"
    }, 
    "skip_reason": "Conditional check failed", 
    "skipped": true
}
looking for "etc/apache2/sites-available/default.conf.j2" at "/home/ganto/.ansible/roles/debops.apache/templates/etc/apache2/sites-available/default.conf.j2"
failed: [apache.example.com] (item={u'root': u'/var/www/html', u'name': u'default.apache', u'filename': u'000-default'}) => {
    "failed": true, 
    "invocation": {
        "module_args": {
            "dest": "/etc/apache2/sites-available/000-default.conf", 
            "group": "root", 
            "mode": "0644", 
            "owner": "root", 
            "src": "etc/apache2/sites-available/default.conf.j2"
        }, 
        "module_name": "template"
    }, 
    "item": {
        "filename": "000-default", 
        "name": "default.apache", 
        "root": "/var/www/html"
    }, 
    "msg": "RepresenterError: cannot represent an object: 000-default"
}
looking for "etc/apache2/sites-available/default.conf.j2" at "/home/ganto/.ansible/roles/debops.apache/templates/etc/apache2/sites-available/default.conf.j2"
failed: [apache.example.com] (item={u'name': [u'localhost'], u'status_enabled': True, u'enabled': False, u'filename': u'debops.apache-status', u'status_allow_locahost': True, u'https_enabled': False, u'listen_http': [u'localhost:80']}) => {
    "failed": true, 
    "invocation": {
        "module_args": {
            "dest": "/etc/apache2/sites-available/debops.apache-status.conf", 
            "group": "root", 
            "mode": "0644", 
            "owner": "root", 
            "src": "etc/apache2/sites-available/default.conf.j2"
        }, 
        "module_name": "template"
    }, 
    "item": {
        "enabled": false, 
        "filename": "debops.apache-status", 
        "https_enabled": false, 
        "listen_http": [
            "localhost:80"
        ], 
        "name": [
            "localhost"
        ], 
        "status_allow_localhost": true, 
        "status_enabled": true
    }, 
    "msg": "RepresenterError: cannot represent an object: debops.apache-status"
}
ypid commented 7 years ago

So you have tried it with https://github.com/ansible/ansible/tree/stable-2.2?

ganto commented 7 years ago

Ok, running with git stable-2.2 HEAD the issue is gone:

ansible 2.2.2.0 (stable-2.2 d45f2d3288) last updated 2017/03/01 22:35:29 (GMT +200)
  lib/ansible/modules/core: (detached HEAD 2f9a276333) last updated 2017/03/01 22:36:29 (GMT +200)
  lib/ansible/modules/extras: (detached HEAD 8f0536a874) last updated 2017/03/01 22:36:45 (GMT +200)
  config file = /home/ganto/.ansible.cfg
  configured module search path = Default w/o overrides
TASK [debops.apache : Create sites-available configuration] ********************
task path: /home/ganto/.ansible/roles/debops.apache/tasks/main.yml:100
skipping: [apache.example.com] => (item={u'comment': u'`postinst` of the `apache2` package normally tries to enable\nthe `000-default` site without checking if it 
is actually there.\nDivert the package provided `000-default` site file away, we will not need it :)\n', u'divert_filename': u'package-default', u'type': u'divert', u'na
me': u'000-default', u'divert_suffix': u''})  => {
    "changed": false, 
    "item": {
        "comment": "`postinst` of the `apache2` package normally tries to enable\nthe `000-default` site without checking if it is actually there.\nDivert the package pr
ovided `000-default` site file away, we will not need it :)\n", 
        "divert_filename": "package-default", 
        "divert_suffix": "", 
        "name": "000-default", 
        "type": "divert"
    }, 
    "skip_reason": "Conditional check failed", 
    "skipped": true
}
skipping: [apache.example.com] => (item={u'comment': u'Divert the package provided `default-ssl` site file away, we will not need it :)\n', u'divert_filename': u'p
ackage-default-https', u'type': u'divert', u'name': u'default-ssl', u'divert_suffix': u''})  => {
    "changed": false, 
    "item": {
        "comment": "Divert the package provided `default-ssl` site file away, we will not need it :)\n", 
        "divert_filename": "package-default-https", 
        "divert_suffix": "", 
        "name": "default-ssl", 
        "type": "divert"
    }, 
    "skip_reason": "Conditional check failed", 
    "skipped": true
}
changed: [apache.example.com] => (item={u'root': u'/var/www/html', u'name': u'default.apache', u'filename': u'000-default'}) => {
    "changed": true, 
    "checksum": "979acb80779c1a8c3ffa260cc8f4a909bca2dd24", 
    "dest": "/etc/apache2/sites-available/000-default.conf", 
    "gid": 0, 
    "group": "root", 
    "invocation": {
        "module_args": {
            "backup": false, 
            "content": null, 
            "delimiter": null, 
            "dest": "/etc/apache2/sites-available/000-default.conf", 
            "directory_mode": null, 
            "follow": true, 
            "force": true, 
            "group": "root", 
            "mode": "0644", 
            "original_basename": "default.conf.j2", 
            "owner": "root", 
            "regexp": null, 
            "remote_src": null, 
            "selevel": null, 
            "serole": null, 
            "setype": null, 
            "seuser": null, 
            "src": "/var/lib/debops/.ansible/tmp/ansible-tmp-1488404254.75-212172869763264/source", 
            "unsafe_writes": null, 
            "validate": null
        }
    }, 
    "item": {
        "filename": "000-default", 
        "name": "default.apache", 
        "root": "/var/www/html"
    }, 
    "md5sum": "f51a99d456f947d62ee25b0a917db906", 
    "mode": "0644", 
    "owner": "root", 
    "size": 528, 
    "src": "/var/lib/debops/.ansible/tmp/ansible-tmp-1488404254.75-212172869763264/source", 
    "state": "file", 
    "uid": 0
}
changed: [apache.example.com] => (item={u'name': [u'localhost'], u'status_enabled': True, u'enabled': False, u'filename': u'debops.apache-status', u'status_allow_l
ocalhost': True, u'https_enabled': False, u'listen_http': [u'localhost:80']}) => {
    "changed": true, 
    "checksum": "032b0a5ad733534e5708caec300b038d0bb73067", 
    "dest": "/etc/apache2/sites-available/debops.apache-status.conf", 
    "gid": 0, 
    "group": "root", 
    "invocation": {
        "module_args": {
            "backup": false, 
            "content": null, 
            "delimiter": null, 
            "dest": "/etc/apache2/sites-available/debops.apache-status.conf", 
            "directory_mode": null, 
            "directory_mode": null, 
            "follow": true, 
            "force": true, 
            "group": "root", 
            "mode": "0644", 
            "original_basename": "default.conf.j2", 
            "owner": "root", 
            "regexp": null, 
            "remote_src": null, 
            "selevel": null, 
            "serole": null, 
            "setype": null, 
            "seuser": null, 
            "src": "/var/lib/debops/.ansible/tmp/ansible-tmp-1488404255.49-132883347340363/source", 
            "unsafe_writes": null, 
            "validate": null
        }
    }, 
    "item": {
        "enabled": false, 
        "filename": "debops.apache-status", 
        "https_enabled": false, 
        "listen_http": [
            "localhost:80"
        ], 
        "name": [
            "localhost"
        ], 
        "status_allow_localhost": true, 
        "status_enabled": true
    }, 
    "md5sum": "a004b82498b1b95564318475dae7e815", 
    "mode": "0644", 
    "owner": "root", 
    "mode": "0644",                                                                                                                                           [1110/4928]
    "owner": "root", 
    "size": 728, 
    "src": "/var/lib/debops/.ansible/tmp/ansible-tmp-1488404255.49-132883347340363/source", 
    "state": "file", 
    "uid": 0
}
ypid commented 7 years ago

Thanks. I will update the min required version after v2.1.5 and v2.2.2 get released. Please use either stable2.1 or stable2.2 for now.