jonjozwiak.bluecat-ipam-rest

Role Name

=========

This role interacts with the Bluecat Address Manager (Proteus) REST API to acquire and release IP addresses and their related DNS names. It performs a quick deployment instead of a full one. You need to provide a target hostname as input, and while acquiring an IP address, it sets the following variables for later use:

  • ipAddress
  • ipNetmask
  • ipGateway

This role has been tested with Bluecat Address Manager version 8.1.0.

Requirements


This role uses the 'ipaddr' filter to get the subnet mask for the specified CIDR. To use it, you need the Python netaddr module (available from python-netaddr or python3-netaddr RPM). If you don't want to use this, you can remove the ipNetmask part from the role.

Role Variables


You can set the variables at the top of the playbook or inside the include_role section, as shown in the example. Variables set at the top take priority over those in the tasks section.

# Bluecat Address Manager API user credentials
bluecat_username: "apiuser"
bluecat_password: "apipassword"
bluecat_url: "https://bcn_proteus.example.com"

# Configuration and view details from Bluecat
bluecat_configuration_name: "Example"
bluecat_dns_view: "internal"

# Properties to define the IP acquire API call (only one can be set)
address_properties: "offset=192.168.30.15"          # Start from this address
address_properties: "skip=192.168.30.1-192.168.30.15"  # Skip these addresses
address_properties: "|excludeDHCPRange=true"        # Skip DHCP range
address_properties: "skip=10.10.10.128-10.10.11.200,10.10.11.210|offset=10.10.10.100|excludeDHCPRange=true|" # All in one

# Choose 'no' for self-signed certs, 'yes' for valid certs
validate_certs: "no"

# Choose whether to acquire or release an IP/DNS name. Default is to acquire (present). Options:
# Create/acquire IP/DNS: present, acquire 
# Lookup IP by hostname: get, lookup
# Release IP/DNS: absent, release
state: "present"

# Hostname to acquire or release 
target_hostname: "host.example.com"

# The CIDR of the network to acquire an IP
bluecat_network_cidr: "192.168.30.0/24"

Dependencies


No specific dependencies mentioned.

Example Playbook


Note: Variables set at the top will override those in the include_role. If you define a variable in the include_role task, do not declare it at the top.

- name: Deploy and retire IP addresses
  hosts: localhost
  vars:
    bluecat_username: "apiuser"
    bluecat_password: "apipassword"
    bluecat_url: "https://bcn_proteus.example.com"
    bluecat_configuration_name: "Example"
    bluecat_network_cidr: "192.168.30.0/24"     # The CIDR of the network to acquire an IP
    bluecat_dns_view: "internal"
    address_properties: "offset=192.168.30.15"          # Start from this address
    #address_properties: "skip=192.168.30.1-192.168.30.15"        # Skip these addresses
    #address_properties: "|excludeDHCPRange=true"        # Skip DHCP range
    validate_certs: "no"        # Choose 'no' for self-signed certs.. 
  gather_facts: false
  tasks:
    - name: Get IP Address 
      include_role: 
        name: jonjozwiak.bluecat-ipam-rest 
      vars: 
        target_hostname: "ansibletest.example.com"

    - name: Do something with the IP address returned 
      debug: var=ipAddress

    - name: Get IP Address
      include_role:
        name: jonjozwiak.bluecat-ipam-rest
      vars:
        target_hostname: "ansibletest2.example.com"

    - name: Do something with the IP address returned 
      debug: msg="IP address: <{{ipAddress}}>.  Netmask: <{{ipNetmask}}>. Gateway: <{{ipGateway}}>."

    - name: Release IP Address 
      include_role:
        name: jonjozwiak.bluecat-ipam-rest
      vars:
        target_hostname: "ansibletest.example.com"
        state: absent

    - name: Release IP Address 
      include_role:
        name: jonjozwiak.bluecat-ipam-rest
      vars:
        target_hostname: "ansibletest2.example.com"
        state: absent

License


GPLv3

Author Information


Jon Jozwiak

Informazioni sul progetto

Bluecat IPAM role using the REST API

Installa
ansible-galaxy install jonjozwiak.bluecat-ipam-rest
Licenza
gpl-3.0
Download
20.7k
Proprietario