Skip to content

Commit

Permalink
Merge pull request #7 from Felome/ldap-auth
Browse files Browse the repository at this point in the history
Conf for ldap simple authentification
  • Loading branch information
samherve authored Apr 28, 2017
2 parents 676d350 + 1c08701 commit 6ead6a5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ ldap_connections: []
# ldap_protocol: 'ldaps' # ldap or ldaps
# ldap_hostname: 'ldap.mycompany.com'
# ldap_port: 636
# ldap_auth: 'simple' or 'none'
# ldap_auth_username: 'username' (or DN) (optional)
# ldap_auth_password: 'password' (optional)
# ldap_search_base: 'dc=mycompany,dc=net'
# ldap_user_base_dn: 'ou=users'
# ldap_user_object_class: 'inetOrgPerson'
Expand Down
9 changes: 8 additions & 1 deletion files/groovy/setup_ldap.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ ldapConfig.setName(parsed_args.name)
// Connection
connection = new Connection()
connection.setHost(new Connection.Host(Connection.Protocol.valueOf(parsed_args.protocol), parsed_args.hostname, Integer.valueOf(parsed_args.port)))
connection.setAuthScheme("none")
if(parsed_args.auth != null && parsed_args.auth.equals("simple")){
connection.setAuthScheme("simple")
connection.setSystemUsername(parsed_args.username)
connection.setSystemPassword(parsed_args.password)
}
else {
connection.setAuthScheme("none")
}
connection.setSearchBase(parsed_args.search_base)
connection.setConnectionTimeout(30)
connection.setConnectionRetryDelay(300)
Expand Down
3 changes: 3 additions & 0 deletions tasks/setup_ldap_each.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
protocol: "{{ item.ldap_protocol }}"
hostname: "{{ item.ldap_hostname }}"
port: "{{ item.ldap_port }}"
auth: "{{ item.ldap_auth | default('none') }}"
username: "{{ item.ldap_auth_username | default('') }}"
password: "{{ item.ldap_auth_password | default('') }}"
search_base: "{{ item.ldap_search_base }}"
user_base_dn: "{{ item.ldap_user_base_dn }}"
user_object_class: "{{ item.ldap_user_object_class }}"
Expand Down

0 comments on commit 6ead6a5

Please sign in to comment.