ahuffman.sat6_create_hosts

Ansible Role

ahuffman.sat6_create_hosts

This is an Ansible role designed to create new virtual machines and physical hosts in Satellite 6.x, requiring version 2 of the Satellite6 API.

Role Variables

Variable Name Required Description Type Default
sat6_fqdn yes Full domain name of the Satellite 6 server. string ""
sat6_user yes Username for the Satellite 6 account authorized to create new hosts. string ""
sat6_pass yes Password for the Satellite 6 account authorized to create new hosts. This should be stored securely. string ""
sat6_organization yes Organization in Satellite 6 for creating hosts listed in sat6_hosts. string ""
sat6_fail_on_existing no Set to fail the playbook if any listed hosts already exist. Useful for notifications. True fails if a host exists; False summarises and allows repeated runs. boolean False
sat6_power_on_delay no Time in seconds to wait between creating and powering on a virtual machine to avoid issues. integer 30
sat6_hosts yes List of hosts to create in Satellite 6. list of dictionaries []

sat6_hosts Dictionary Fields - Common

These fields are used for creating both virtual and physical hosts.

Field Name Required Description Type
name yes Hostname for the new host. string
comment no Short description of the host's purpose. string
domain no Domain to associate with the host. Inherits from group if not specified. string
host_group yes Host Group name in Satellite 6 for this new host. Use hostgroup1/hostgroup2 for nested groups. string
ipv4 no IPv4 address to assign to the host. Inherits from group if not specified. string
location yes Location in Satellite 6 where the host will be deployed. string
partition_table no Partition table to use. Inherits from group if not specified. string
subnet no Subnet to use. Inherits from group if not specified. string
parameters no Additional parameters specific to the host for post-provisioning tasks. list of dictionaries
register_only no Create only the host entry without provisioning it. Defaults to False. boolean
manage_host no Allows Satellite 6 to manage the host's lifecycle if using register_only: True. Defaults to False. boolean
force_host_update no Update the existing host options if register_only: True. Defaults to False. boolean
provision_method no Choose build or image deployment method. Defaults to build. string

sat6_hosts Dictionary Fields - Virtual

Field Name Required Description Type
compute_profile no Compute profile for the host. Default from group if not provided. string
compute_resource yes Compute resource name for deploying the host. string

sat6_hosts Dictionary Fields - Physical

Field Name Required Description Type
mac yes MAC address of the physical host to deploy. string

sat6_hosts.parameters Dictionary Fields

Field Name Required Description Type
name yes Name of the parameter to create. string
value yes Value of the parameter to create. string

Debugging

To see detailed debug output, set verbosity to 1 in Ansible Tower or use a single -v in Ansible Core/Engine.

Example Playbook

---
- name: "Example Playbook for ahuffman.sat6_create_hosts"
  hosts: "localhost"
  vars_files:
    - "vars/myvaultedsecrets.yml"
  tasks:
    - name: "Provision Satellite 6 Hosts"
      include_role:
        name: "ahuffman.sat6_create_hosts"
      vars:
        sat6_fqdn: "mysat6server.mydomain.com"
        sat6_user: "mysat6admin"
        #sat6_pass: "this is set in the vars/myvaultedsecrets.yml file"
        sat6_organization: "my organization"
        sat6_fail_on_existing: True
        # it’s advised to input sat6_hosts as an extra variable, but you may set
        # sat6_fail_on_existing: False for a more idempotent run if you track 
        # all sat6 hosts in source control
        sat6_hosts:
          # Virtual Machine
          - name: "my-new-vm"
            host_group: "RHEL7-Virtual"
            location: "Raleigh"
            ipv4: "192.168.122.24"
            domain: "redhat.com"
            comment: "Web server for a new website"
            compute_resource: "vsphere.vmware.com" # This is your compute resource name
            compute_profile: "3-Large"
            parameters:
              - name: "build_type"
                value: "httpd"
          # Physical Host
          - name: "my-new-bare-metal"
            host_group: "RHEL7-Physical"
            location: "Raleigh"
            ipv4: "192.168.122.25"
            domain: "redhat.com"
            comment: "Database server"
            mac: "12:34:56:78:91:23"
          # Register Only (create only)
          - name: "host1"
            host_group: "RHEL7-Virtual"
            location: "Raleigh"
            ipv4: "192.168.122.26"
            domain: "redhat.com"
            comment: "Pre-registration host entry"
            register_only: True
          # Update an existing host 
          - name: "my-new-vm"
            host_group: "RHEL7-Virtual"
            location: "Armonk"
            ipv4: "192.168.122.24"
            comment: "Migrated Q3"
            domain: "ibm.com"
            parameters:
              - name: "build_type"
                value: "ihs"
            register_only: True  # means don’t provision
            force_host_update: True  # update existing host
          # Manage building (provisioning) for currently unmanaged existing host
          - name: "someoldserver"
            host_group: "RHEL7-Physical"
            mac: "32:34:56:78:91:23"
            domain: "redhat.com"
            location: "Raleigh"
            register_only: True
            force_host_update: True
            manage_host: True

License

MIT

Author Information

Andrew J. Huffman

Informazioni sul progetto

An Ansible role to create new virtual and bare-metal hosts in Satellite 6.x.

Installa
ansible-galaxy install ahuffman.sat6_create_hosts
Licenza
mit
Download
5.1k
Proprietario