Git Product home page Git Product logo

ansible-ad-inventory's Introduction

ansible-ad-inventory

Active Directory dynamic inventory plugins for Ansible

  • ad: Inventory based on LDAP filter
  • adgroup: Inventory based on Active Directory group membership

Installation

See Ansible Documentation on installing plugins.

Requirements are ldap3. For Kerberos authentication, gssapi is required. For LDAP server auto-detection, dnspython is required.

Usage

See ansible-doc -t inventory ad for more details.

If server is not set, a DNS lookup for LDAP servers (provided dnspython is installed) and an LDAP ping are performed to find the closest server.

Configuration

Common configuration

Attribute Type Required Choices/Default Description
server str No if dnspython is installed; Yes otherwise. null Active Directory server name
port int No 389 Active Directory Port; using port 636 enables SSL
base str No null Starting port of the search. If null, the default naming context will be used.
scope str No choices: ['base', 'level', subtree']; default: subtree Scope of the search
username str No null Username to bind as. It can the distinguished name of the user, or "SHORTDOMAIN\user". If null, Kerberos + GSSAPI authentication will be used.
password str No null Username's password. Must be defined if username is also defined.

ad

The ad plugin uses the LDAP filter to populate Ansible inventory.

Attribute Type Required Choices/Default Description
plugin str Yes choices: ['ad']; default: ad Marks this as an instance of the 'ad' plugin
filter str No '' LDAP query filter. objectClass=computer is automatically appended.
ansible group str No N/A Ansible group name to assign hosts to
var attribute str No null LDAP attribute to load as YAML for host-specific Ansible variables.

Create ad.yml with the contents:

plugin: ad
server: dc.example.com
port: 636
base: DC=example,DC=com
username: EXAMPLE\ExampleUser  # or distinguishedname
password: hunter2
filter: "(operatingSystem='Debian GNU/Linux')"
ansible group: Debian
var attribute: info

Run ansible-playbook -i ad.yml playbook.yml

adgroup

The adgroup plugin uses group memberships to populate Ansible inventory.

Attribute Type Required Choices/Default Description
plugin str Yes choices: ['adgroup']; default: adgroup Marks this as an instance of the 'adgroup' plugin
root group str No ansible-roles Active Directory group that contains all other groups. It can be a distinguished name or the account name. If account name, it will be searched under base using scope as the search scope. Any computer objects found in this group will be added to all.
group marker str No ansible-role- Marker that will be removed from group name (e.g. ansible-role-http becomes http)
var attribute str No null LDAP attribute to load as YAML for group or host-specific Ansible variables.

Create adgroup.yml with the contents:

plugin: adgroup
server: ad.example.com
port: 636
base ou: OU=Groups,DC=example,DC=com
username: EXAMPLE\user
password: hunter2
root group: ansible-roles
group marker: ansible-role-
var attribute: info

Run ansible-playbook -i adgroup.yml playbook.yml

TODO

  • Create inventory groups based on object attributes (e.g. location, os, etc)
  • Recursively resolve group memberships

ansible-ad-inventory's People

Contributors

mdhowle avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.