{"action":"closed","issue":{"url":"https://api.github.com/repos/debops-contrib/ansible-checkmk_agent/issues/22","repository_url":"https://api.github.com/repos/debops-contrib/ansible-checkmk_agent","labels_url":"https://api.github.com/repos/debops-contrib/ansible-checkmk_agent/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/debops-contrib/ansible-checkmk_agent/issues/22/comments","events_url":"https://api.github.com/repos/debops-contrib/ansible-checkmk_agent/issues/22/events","html_url":"https://github.com/debops-contrib/ansible-checkmk_agent/issues/22","id":187460304,"number":22,"title":"debops.mariadb role dependency fails on Ansible 2.2 with \"'dict object' has no attribute 'mariadb'\"","user":{"login":"ganto","id":1031031,"avatar_url":"https://avatars.githubusercontent.com/u/1031031?v=3","gravatar_id":"","url":"https://api.github.com/users/ganto","html_url":"https://github.com/ganto","followers_url":"https://api.github.com/users/ganto/followers","following_url":"https://api.github.com/users/ganto/following{/other_user}","gists_url":"https://api.github.com/users/ganto/gists{/gist_id}","starred_url":"https://api.github.com/users/ganto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ganto/subscriptions","organizations_url":"https://api.github.com/users/ganto/orgs","repos_url":"https://api.github.com/users/ganto/repos","events_url":"https://api.github.com/users/ganto/events{/privacy}","received_events_url":"https://api.github.com/users/ganto/received_events","type":"User","site_admin":false},"labels":[{"id":228224126,"url":"https://api.github.com/repos/debops-contrib/ansible-checkmk_agent/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-11-04T23:36:33Z","updated_at":"2016-11-07T10:58:14Z","closed_at":"2016-11-07T10:58:14Z","body":"That's a tricky issue...\r\n\r\nWhen running the Travis-CI test suite, the `debops.mariadb` role dependency fails with:\r\n\r\n```\r\n[...]\r\nTASK [debops.mariadb : Configure database client defaults] *********************\r\n\r\nskipping: [testing-gce-7276f8d1-9b54-4aa0-8beb-cda8341c4ec0]\r\n\r\nTASK [debops.mariadb : Make sure that local fact directory exists] *************\r\n\r\nskipping: [testing-gce-7276f8d1-9b54-4aa0-8beb-cda8341c4ec0]\r\n\r\nTASK [debops.mariadb : Save MariaDB local facts] *******************************\r\n\r\nskipping: [testing-gce-7276f8d1-9b54-4aa0-8beb-cda8341c4ec0]\r\n\r\nTASK [debops.mariadb : Re-read local facts if they have been modified] *********\r\n\r\nskipping: [testing-gce-7276f8d1-9b54-4aa0-8beb-cda8341c4ec0]\r\n\r\nTASK [debops.mariadb : Drop databases if requested] ****************************\r\n\r\nTASK [debops.mariadb : Create databases] ***************************************\r\n\r\nTASK [debops.mariadb : Copy database source file to remote host] ***************\r\n\r\nTASK [debops.mariadb : Import source file contents into database] **************\r\n\r\nTASK [debops.mariadb : Remove source files] ************************************\r\n\r\nTASK [debops.mariadb : Drop user accounts if requested] ************************\r\n\r\nfatal: [testing-gce-7276f8d1-9b54-4aa0-8beb-cda8341c4ec0]: FAILED! => {\"failed\": true, \"msg\": \"[u'{{ checkmk_agent__mariadb__users }}']: [{u'priv_default': False, u'creds_path': u'/etc/check_mk/mysql.cfg', u'append_privs': False, u'priv_aux': False, u'user': u'{{ checkmk_agent__plugin_mysql_user }}', u'owner': u'root', u'password': u'{{ checkmk_agent__plugin_mysql_password }}', u'priv': u'{{ checkmk_agent__plugin_mysql_priv }}'}]: {{ lookup('password', secret + '/mariadb/' + ansible_local.mariadb.delegate_to + '/credentials/' + checkmk_agent__plugin_mysql_user + '/password length=48') }}: 'dict object' has no attribute 'mariadb'\"}\r\n\r\n\tto retry, use: --limit @/home/travis/build/ganto/ansible-checkmk_agent/rolespec/travis/tests/ansible-checkmk_agent/playbooks/test.retry\r\n```\r\n\r\nThe reason obviously is, that the `ansible_local.mariadb` facts are not set, therefore the path for the secret cannot be constructed successfully what results in an error in Ansible 2.2. This indeed is unfortunate, as the entire role should be simply skipped as the condition for inclusion fails.\r\n\r\nThis is not really the fault of the `debops.mariadb` role, as the user (including the secrets path) is defined in the defaults of the `checkmk_agent` role.\r\n\r\nAs long as Ansible is behaving this way, I can't see any pretty solution to this problem. I guess an unreadable workaround would be, to make the definition of `mariadb__users` in the playbook also conditional.\r\n\r\n@ypid, what do you think? Any suggestions?"}}
{"actor":{"display_login":"ganto"}}