{"action":"created","issue":{"url":"https://api.github.com/repos/solita/ansible-role-solita.jenkins/issues/14","repository_url":"https://api.github.com/repos/solita/ansible-role-solita.jenkins","labels_url":"https://api.github.com/repos/solita/ansible-role-solita.jenkins/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/solita/ansible-role-solita.jenkins/issues/14/comments","events_url":"https://api.github.com/repos/solita/ansible-role-solita.jenkins/issues/14/events","html_url":"https://github.com/solita/ansible-role-solita.jenkins/issues/14","id":165023354,"number":14,"title":"AnsibleError: Unexpected templating type error occurred in solita_jenkins_security_realm.groovy.j2","user":{"login":"bery","id":1456931,"avatar_url":"https://avatars.githubusercontent.com/u/1456931?v=3","gravatar_id":"","url":"https://api.github.com/users/bery","html_url":"https://github.com/bery","followers_url":"https://api.github.com/users/bery/followers","following_url":"https://api.github.com/users/bery/following{/other_user}","gists_url":"https://api.github.com/users/bery/gists{/gist_id}","starred_url":"https://api.github.com/users/bery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bery/subscriptions","organizations_url":"https://api.github.com/users/bery/orgs","repos_url":"https://api.github.com/users/bery/repos","events_url":"https://api.github.com/users/bery/events{/privacy}","received_events_url":"https://api.github.com/users/bery/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-12T08:39:15Z","updated_at":"2016-07-14T09:11:52Z","closed_at":null,"body":"Hi,\r\n\r\nI am trying to install solita jenkins on linode and got this error for some reason:\r\n\r\n```\r\nTASK [solita.jenkins : Copy Jenkins security realm configuration] **************\r\ntask path: /etc/ansible/roles/solita.jenkins/tasks/security.yml:40\r\nfatal: [localhost]: FAILED! => {\"changed\": false, \"failed\": true, \"invocation\": {\"module_args\": {\"dest\": \"/var/lib/jenkins/init.groovy.d/solita_jenkins_security_realm.groovy\", \"group\": \"jenkins\", \"mode\": 493, \"owner\": \"jenkins\", \"src\": \"solita_jenkins_security_realm.groovy.j2\"}, \"module_name\": \"template\"}, \"msg\": \"AnsibleError: Unexpected templating type error occurred on (import jenkins.model.*\\nimport hudson.security.*\\nimport org.jenkinsci.main.modules.cli.auth.ssh.UserPropertyImpl\\n\\ndef solita_jenkins_security_realm = '{{ solita_jenkins_security_realm }}'\\n\\ndef jenkins = Jenkins.getInstance()\\n\\nif (solita_jenkins_security_realm == 'jenkins') {\\n    if (!(jenkins.getSecurityRealm() instanceof HudsonPrivateSecurityRealm)) {\\n        jenkins.setSecurityRealm(new HudsonPrivateSecurityRealm(false))\\n    }\\n\\n    if (!(jenkins.getAuthorizationStrategy() instanceof GlobalMatrixAuthorizationStrategy)) {\\n        jenkins.setAuthorizationStrategy(new GlobalMatrixAuthorizationStrategy())\\n    }\\n\\n    def currentUsers = jenkins.getSecurityRealm().getAllUsers().collect { it.getId() }\\n\\n    if (!('solita_jenkins' in currentUsers)) {\\n        def user = jenkins.getSecurityRealm().createAccount('solita_jenkins', '{{ lookup(\\\"password\\\", inventory_dir + \\\"/solita_jenkins_default_password/solita_jenkins\\\") }}')\\n        user.addProperty(new UserPropertyImpl('{{ solita_jenkins_public_key }}'));\\n        user.save()\\n\\n        jenkins.getAuthorizationStrategy().add(Jenkins.ADMINISTER, 'solita_jenkins')\\n    }\\n} else if (solita_jenkins_security_realm == 'none') {\\n    // If we leave the user, further attempts to use jenkins-cli.jar with\\n    // key-based authentication enabled fail for some reason. Clearing the\\n    // user's SSH key wasn't enough to solve the problem.\\n    jenkins.getUser('solita_jenkins').delete()\\n    jenkins.disableSecurity()\\n}\\njenkins.save()\\n): unsupported operand type(s) for +: 'NoneType' and 'str'\"}\r\n```\r\nand I am unable to find the cause - appears with both security realm set to \"jenkins\" and \"none\".\r\n\r\nAnsible version 2.1.0.0\r\n"},"comment":{"url":"https://api.github.com/repos/solita/ansible-role-solita.jenkins/issues/comments/232610452","html_url":"https://github.com/solita/ansible-role-solita.jenkins/issues/14#issuecomment-232610452","issue_url":"https://api.github.com/repos/solita/ansible-role-solita.jenkins/issues/14","id":232610452,"user":{"login":"noidi","id":173242,"avatar_url":"https://avatars.githubusercontent.com/u/173242?v=3","gravatar_id":"","url":"https://api.github.com/users/noidi","html_url":"https://github.com/noidi","followers_url":"https://api.github.com/users/noidi/followers","following_url":"https://api.github.com/users/noidi/following{/other_user}","gists_url":"https://api.github.com/users/noidi/gists{/gist_id}","starred_url":"https://api.github.com/users/noidi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noidi/subscriptions","organizations_url":"https://api.github.com/users/noidi/orgs","repos_url":"https://api.github.com/users/noidi/repos","events_url":"https://api.github.com/users/noidi/events{/privacy}","received_events_url":"https://api.github.com/users/noidi/received_events","type":"User","site_admin":false},"created_at":"2016-07-14T09:11:52Z","updated_at":"2016-07-14T09:11:52Z","body":"Using the password-based authentication is a bit trickier than I thought due to [JENKINS-12543](https://issues.jenkins-ci.org/browse/JENKINS-12543). It will take me at least until tomorrow to come up with a workaround.\r\n"}}
{"actor":{"display_login":"noidi"}}