{"action":"created","issue":{"url":"https://api.github.com/repos/UnderGreen/ansible-role-mongodb/issues/2","labels_url":"https://api.github.com/repos/UnderGreen/ansible-role-mongodb/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/UnderGreen/ansible-role-mongodb/issues/2/comments","events_url":"https://api.github.com/repos/UnderGreen/ansible-role-mongodb/issues/2/events","html_url":"https://github.com/UnderGreen/ansible-role-mongodb/issues/2","id":58868875,"number":2,"title":"User creation fail for the first run","user":{"login":"deimosfr","id":2962805,"avatar_url":"https://avatars.githubusercontent.com/u/2962805?v=3","gravatar_id":"","url":"https://api.github.com/users/deimosfr","html_url":"https://github.com/deimosfr","followers_url":"https://api.github.com/users/deimosfr/followers","following_url":"https://api.github.com/users/deimosfr/following{/other_user}","gists_url":"https://api.github.com/users/deimosfr/gists{/gist_id}","starred_url":"https://api.github.com/users/deimosfr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deimosfr/subscriptions","organizations_url":"https://api.github.com/users/deimosfr/orgs","repos_url":"https://api.github.com/users/deimosfr/repos","events_url":"https://api.github.com/users/deimosfr/events{/privacy}","received_events_url":"https://api.github.com/users/deimosfr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-25T08:45:07Z","updated_at":"2015-02-25T13:05:36Z","closed_at":null,"body":"Hi,\r\n\r\nI encounter an issue when running user creation for the first time:\r\n```\r\nTASK: [ansible-role-mongodb | create administrative user siteRootAdmin port=yes] *** \r\nskipping: [vm] => (item={'password': u'test', 'name': u'siteRootAdmin', 'roles': 'root'})\r\n\r\nTASK: [ansible-role-mongodb | create administrative user siteUserAdmin port=yes] *** \r\nskipping: [vm] => (item={'password': u'test', 'name': u'siteUserAdmin', 'roles': 'userAdminAnyDatabase'})\r\n\r\nTASK: [ansible-role-mongodb | create normal users] **************************** \r\nskipping: [vm] => (item={'password': 'test', 'name': 'test', 'roles': 'readWrite', 'database': 'test'})\r\n\r\nTASK: [ansible-role-mongodb | create administrative user siteRootAdmin] ******* \r\nfailed: [vm] => (item={'password': u'test', 'name': u'siteRootAdmin', 'roles': 'root'}) => {\"failed\": true, \"item\": {\"name\": \"siteRootAdmin\", \"password\": \"test\", \"roles\": \"root\"}}\r\nmsg: unable to connect to database: [Errno 111] Connection refused\r\n\r\nFATAL: all hosts have already failed -- aborting\r\n```\r\n\r\nIf I relaunch the playbook just after, it works:\r\n```\r\nTASK: [ansible-role-mongodb | create administrative user siteRootAdmin port=yes] *** \r\nskipping: [vm] => (item={'password': u'test', 'name': u'siteRootAdmin', 'roles': 'root'})\r\n\r\nTASK: [ansible-role-mongodb | create administrative user siteUserAdmin port=yes] *** \r\nskipping: [vm] => (item={'password': u'test', 'name': u'siteUserAdmin', 'roles': 'userAdminAnyDatabase'})\r\n\r\nTASK: [ansible-role-mongodb | create normal users] **************************** \r\nskipping: [vm] => (item={'password': 'test', 'name': 'test', 'roles': 'readWrite', 'database': 'test'})\r\n\r\nTASK: [ansible-role-mongodb | create administrative user siteRootAdmin] ******* \r\nchanged: [vm] => (item={'password': u'test', 'name': u'siteRootAdmin', 'roles': 'root'})\r\n\r\nTASK: [ansible-role-mongodb | create administrative user siteUserAdmin] ******* \r\nchanged: [vm] => (item={'password': u'test', 'name': u'siteUserAdmin', 'roles': 'userAdminAnyDatabase'})\r\n\r\nTASK: [ansible-role-mongodb | create normal users] **************************** \r\nchanged: [vm] => (item={'password': 'test', 'name': 'test', 'roles': 'readWrite', 'database': 'test'})\r\n```\r\n\r\nAny idea ?\r\n\r\nThanks\r\n"},"comment":{"url":"https://api.github.com/repos/UnderGreen/ansible-role-mongodb/issues/comments/75956196","html_url":"https://github.com/UnderGreen/ansible-role-mongodb/issues/2#issuecomment-75956196","issue_url":"https://api.github.com/repos/UnderGreen/ansible-role-mongodb/issues/2","id":75956196,"user":{"login":"UnderGreen","id":2656737,"avatar_url":"https://avatars.githubusercontent.com/u/2656737?v=3","gravatar_id":"","url":"https://api.github.com/users/UnderGreen","html_url":"https://github.com/UnderGreen","followers_url":"https://api.github.com/users/UnderGreen/followers","following_url":"https://api.github.com/users/UnderGreen/following{/other_user}","gists_url":"https://api.github.com/users/UnderGreen/gists{/gist_id}","starred_url":"https://api.github.com/users/UnderGreen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UnderGreen/subscriptions","organizations_url":"https://api.github.com/users/UnderGreen/orgs","repos_url":"https://api.github.com/users/UnderGreen/repos","events_url":"https://api.github.com/users/UnderGreen/events{/privacy}","received_events_url":"https://api.github.com/users/UnderGreen/received_events","type":"User","site_admin":false},"created_at":"2015-02-25T13:05:36Z","updated_at":"2015-02-25T13:05:36Z","body":"A think problem is in https://github.com/UnderGreen/ansible-role-mongodb/blob/master/tasks/configure.yml#L16\r\nthis task not working for systemd service and mongo is down\r\nBut I don't see task to start mongo after this line. Maybe you can try to add wait_for: port=\"{{ mongodb_conf_port }}\" before authorization. Maybe add delay for wait_for."}}