pbicskei.classify
Role Name
This role makes it easier to classify hosts using ansible_facts.
Classifications:
- Proxmox
p24.xlarge: AProxmoxhost with24processors and more than32456MB of memory. - Raspberry
a4.large: AnArmhost with4processors and between4096and8096MB of memory. - Generic
g4.nano: AGenerichost with4processors and between4096and8096MB of memory.
In the Proxmox example, the classification starts with a letter based on the ansible_kernel like this:
- name: Proxmox Hypervisor
set_fact:
type: p
type_desc: "{{ ansible_distribution }} Proxmox"
when: '"pve" in ansible_kernel'
These classifications are created using two variables: size_map and type_map, which are located in defaults/main.yml.
Requirements
List any necessary prerequisites that aren't included with Ansible or the role. For example, if this role needs the EC2 module, mention that the boto package is required.
Role Variables
Here, you should describe the variables that can be set for this role. This includes those found in defaults/main.yml, vars/main.yml, and other variables that can be set as parameters for the role. Also, mention any variables that come from other roles or from the global scope (like hostvars or group vars).
Dependencies
Include a list of other roles available on Galaxy that your role depends on, along with any details about parameters that need to be set for those roles, or any variables that your role uses from them.
Example Playbook
Giving an example of how to use your role is very helpful for users. Here’s how to use the role with default or custom variables:
Using the default table:
- hosts: servers
roles:
- pbicskei.classify
Using a Custom table:
- hosts: servers
roles:
- pbicskei.classify
vars:
type_map:
- { name: "Hypervisor", letter: "hv", kernel_match: "pve" }
- { name: "Compute(ARM)", letter: "a", kernel_match: "raspi" }
- { name: "Generic", letter: "g", kernel_match: "default" }
size_map:
- { name: "nanite", min: 1, max: 1024 }
- { name: "microbe", min: 1024, max: 2048 }
- { name: "insect", min: 2048, max: 4092 }
- { name: "hamster", min: 4092, max: 8184 }
- { name: "dog", min: 8184, max: 16368 }
- { name: "horse", min: 16368, max: 32736 }
- { name: "elephant", min: 32736, max: 65472 }
- { name: "whale", min: 65472, max: 130944 }
roles:
- pbicskei.classify
License
BSD
Author Information
This section can be used by the authors to include contact information or a website. (HTML is not permitted).
ansible-galaxy install pbicskei.classify