initial commit, work on opendoor
This commit is contained in:
47
README.md
Normal file
47
README.md
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
Role Name
|
||||||
|
=========
|
||||||
|
|
||||||
|
Create ldap account for opendoor
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
keepass entry for opendoor/collidine_ldap_password
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
org: no default
|
||||||
|
ldap_base - from group variables
|
||||||
|
binddn - from group variables
|
||||||
|
bindpwd - from group variables
|
||||||
|
file : default account.csv csv file containing user to create:
|
||||||
|
|
||||||
|
```csv
|
||||||
|
org,firstname,lastname,email,password
|
||||||
|
```
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||||
|
|
||||||
|
- hosts: collidine
|
||||||
|
user: tom
|
||||||
|
become: false
|
||||||
|
roles:
|
||||||
|
- { role: tco.new_ldap_user, file: ~/Documents/Opendoor/Clients/Plop/account.csv }
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
BSD
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Thomas C <thomas@opendoor.fr>
|
||||||
2
defaults/main.yml
Normal file
2
defaults/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# defaults file for tco.new_ldap_user
|
||||||
2
handlers/main.yml
Normal file
2
handlers/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# handlers file for tco.new_ldap_user
|
||||||
52
meta/main.yml
Normal file
52
meta/main.yml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
galaxy_info:
|
||||||
|
author: your name
|
||||||
|
description: your role description
|
||||||
|
company: your company (optional)
|
||||||
|
|
||||||
|
# If the issue tracker for your role is not on github, uncomment the
|
||||||
|
# next line and provide a value
|
||||||
|
# issue_tracker_url: http://example.com/issue/tracker
|
||||||
|
|
||||||
|
# Choose a valid license ID from https://spdx.org - some suggested licenses:
|
||||||
|
# - BSD-3-Clause (default)
|
||||||
|
# - MIT
|
||||||
|
# - GPL-2.0-or-later
|
||||||
|
# - GPL-3.0-only
|
||||||
|
# - Apache-2.0
|
||||||
|
# - CC-BY-4.0
|
||||||
|
license: license (GPL-2.0-or-later, MIT, etc)
|
||||||
|
|
||||||
|
min_ansible_version: 2.1
|
||||||
|
|
||||||
|
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||||
|
# min_ansible_container_version:
|
||||||
|
|
||||||
|
#
|
||||||
|
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||||
|
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||||
|
# To view available platforms and versions (or releases), visit:
|
||||||
|
# https://galaxy.ansible.com/api/v1/platforms/
|
||||||
|
#
|
||||||
|
# platforms:
|
||||||
|
# - name: Fedora
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 25
|
||||||
|
# - name: SomePlatform
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 1.0
|
||||||
|
# - 7
|
||||||
|
# - 99.99
|
||||||
|
|
||||||
|
galaxy_tags: []
|
||||||
|
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||||
|
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||||
|
# remove the '[]' above, if you add tags to this list.
|
||||||
|
#
|
||||||
|
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||||
|
# Maximum 20 tags per role.
|
||||||
|
|
||||||
|
dependencies: []
|
||||||
|
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||||
|
# if you add dependencies to this list.
|
||||||
33
tasks/ldap_user_inc.yml
Normal file
33
tasks/ldap_user_inc.yml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
- name: add ldap ou
|
||||||
|
community.general.ldap_entry:
|
||||||
|
dn: "ou={{ org }},{{ ldap_base }}"
|
||||||
|
bind_dn: "{{ binddn }}"
|
||||||
|
bind_pw: "{{ bindpwd }}"
|
||||||
|
objectClass:
|
||||||
|
- organizationalUnit
|
||||||
|
- top
|
||||||
|
|
||||||
|
- name: add ldap account
|
||||||
|
vars:
|
||||||
|
firstname: "{{ item.firstname }}"
|
||||||
|
lastname: "{{ item.lastname }}"
|
||||||
|
email: "{{ item.email }}"
|
||||||
|
password: "{{ item.password }}"
|
||||||
|
community.general.ldap_entry:
|
||||||
|
bind_dn: "{{ binddn }}"
|
||||||
|
bind_pw: "{{ bindpwd }}"
|
||||||
|
dn: "uid={{ firstname |lower }}, ou={{ org }},{{ ldap_base }}"
|
||||||
|
state: present
|
||||||
|
objectClass:
|
||||||
|
- inetorgperson
|
||||||
|
- inetLocalMailRecipient
|
||||||
|
attributes:
|
||||||
|
givenName: "{{ firstname }}"
|
||||||
|
sn: "{{ lastname | default( firstname ) }}"
|
||||||
|
cn: "{{ firstname }}"
|
||||||
|
mail: "{{ email }}"
|
||||||
|
uid: "{{ firstname | lower }}"
|
||||||
|
PreferredDeliveryMethod: any
|
||||||
|
displayName: "{{ firstname }} {{ lastname }}"
|
||||||
|
userPassword: "{{ password }}"
|
||||||
20
tasks/main.yml
Normal file
20
tasks/main.yml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
# ansible-playbook /etc/ansible/Playbooks/new_ldap_user.yml -K --ask-vault-pass
|
||||||
|
# --extra-vars="file=account.csv"
|
||||||
|
- name: set some vars
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
binddn: "{{ lookup( 'viczem.keepass.keepass', 'opendoor/collidine_ldap_password', 'username' ) }}"
|
||||||
|
bindpwd: "{{ lookup( 'viczem.keepass.keepass', 'opendoor/collidine_ldap_password', 'password' ) }}"
|
||||||
|
tags: always
|
||||||
|
when: binddn is not defined
|
||||||
|
|
||||||
|
- name: read csv file
|
||||||
|
community.general.read_csv:
|
||||||
|
path: '{{ file|default( "account.csv" ) }}'
|
||||||
|
register: users
|
||||||
|
delegate_to: localhost
|
||||||
|
|
||||||
|
- include_tasks: ldap_user_inc.yml
|
||||||
|
loop: "{{ users.list }}"
|
||||||
|
|
||||||
|
|
||||||
2
tests/inventory
Normal file
2
tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
||||||
5
tests/test.yml
Normal file
5
tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- tco.new_ldap_user
|
||||||
2
vars/main.yml
Normal file
2
vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# vars file for tco.new_ldap_user
|
||||||
Reference in New Issue
Block a user