|
2 | 2 |
|
3 | 3 | You will need to do some customization to NetBox to define the underlying Proxmox VM configuration(s). This section covers the custom field choices and custom fields that you'll need to create in NetBox -- in order for you to facilitate automation.
|
4 | 4 |
|
5 |
| -### Custom Field Choices (for Proxmox VM templates and storage) |
| 5 | +### Custom Field Choices (for Proxmox VM and LXC automation) |
6 | 6 |
|
7 |
| -In the NetBox UI, you will need to create the following custom field choices |
| 7 | +You will need to perform some customization in NetBox before you can start automating Proxmox VMs and LXCs. |
8 | 8 |
|
9 |
| -1. `proxmox-node` will be used to correlate a Proxmox node to the Proxmox VM that you will provision |
10 |
| -2. `proxmox-vm-templates` will be used to correlate a Proxmox VM template with the Proxmox VM that you will provision |
11 |
| -3. `proxmox-vm-storage` will be used to correlate an underlying Proxmox VM storage volume with the Proxmox VM you will provision |
12 |
| - |
13 |
| -#### Automated NetBox Objects and Custom Fields Creation |
14 |
| - |
15 |
| -If you'd prefer to manually create the webhook and event rules in NetBox, you can skip to the next section. Otherwise, proceed with the following to automate the creation of the webhook and event rules in NetBox. |
| 9 | +#### Automated NetBox Objects and the Creation of Custom Field Choices and Custom Fields |
16 | 10 |
|
17 | 11 | `netbox-proxmox-automation` version 1.1.0 and newer ships with a convenience script, `netbox_setup_objects_and_custom_fields.py`, that when used alongside a configuration file of your choice, will greatly simplify this process. In the case of AWX/Tower/AAP, `netbox_setup_objects_and_custom_fields.py` will query your AWX/Tower/AAP instance for project and template(s) information; this information will then be used to create the corresponding webhooks and event rules in NetBox.
|
18 | 12 |
|
@@ -56,92 +50,65 @@ shell$ source venv/bin/activate
|
56 | 50 | (venv) shell$ ./netbox_setup_objects_and_custom_fields.py --config /path/to/your/configuration.yml
|
57 | 51 | ```
|
58 | 52 |
|
59 |
| -Then verify that everything has been created. You can skip the rest of this document if so. |
60 |
| - |
61 |
| - |
62 |
| -If *not* using automation, in the NetBox UI, navigate to Customization > Custom Field Choices |
63 |
| - |
64 |
| -#### proxmox-node |
65 |
| - |
66 |
| -Create custom field choices for Proxmox VM Node(s). When you click the '+' button, you will be presented with an Edit screen. Fill the form as shown below. Note that your choices will represent a list of Proxmox cluster nodes. You will need to login to the Proxmox UI to get the list of Proxmox cluster nodes. |
67 |
| - |
68 |
| - |
69 |
| - |
70 |
| -When you are done, your Custom Field Choices for Proxmox VM node(s) should look like this. |
71 |
| - |
72 |
| - |
73 |
| - |
74 |
| - |
75 |
| -#### proxmox-vm-templates |
76 |
| - |
77 |
| -Create custom field choices for Proxmox VM Templates. When you click the '+' button, you will be presented with an Edit screen. Fill the form as shown below. Note that your choices will have a (Proxmox) VMID to name-of-template mapping. You will need to login to the Proxmox UI to get the VMID to name-of-template mappings. |
78 |
| - |
79 |
| - |
80 |
| - |
81 |
| -When you are done, your Custom Field Choices for Proxmox VM templates should look like this. |
82 |
| - |
83 |
| - |
84 |
| - |
85 |
| - |
86 |
| -#### proxmox-vm-storage |
87 |
| - |
88 |
| -Create custom field choices for Proxmox VM Storage. When you click the '+' button, you will be presented with an Edit screen. Fill the form as shown below. Note that your choices will represent the name/value of each Proxmox storage volume. You will need to login to the Proxmox UI to get a list of Proxmox storage volumes. |
89 |
| - |
90 |
| - |
91 |
| - |
92 |
| -When you are done, your Custom Field Choices for Proxmox VM storage should look like this. |
93 |
| - |
94 |
| - |
95 |
| - |
96 |
| - |
97 |
| -### NetBox Customization: Custom Fields (for Proxmox VMs) |
98 |
| - |
99 |
| -In the NetBox UI, you will need to create a series of custom fields, as noted below. |
100 |
| - |
101 |
| -1. `proxmox_node` will be used to correlate a Proxmox cluster node with the Proxmox VM that you want to create |
102 |
| -2. `proxmox_vm_template` will be used to correlate a Proxmox VM template with the Proxmox VM that you want to create |
103 |
| -3. `proxmox_vm_storage` will be used to correlate a Proxmox VM storage volume with the Proxmox VM that you want to create |
104 |
| -4. `proxmox_disk_storage_volume` will be used to correlate a Proxmox VM storage volume with each Proxmox VM disk that you want to create |
105 |
| -5. `proxmox_public_ssh_key` will be used to assign a public SSH key that you will use to login to a Proxmox VM |
106 |
| -6. `proxmox_vmid` will be used to document the Proxmox `vmid` that was created when the Proxmox VM was created |
107 |
| - |
108 |
| -In the NetBox UI, navigate to Customization > Custom Fields |
109 |
| - |
110 |
| - |
111 |
| -#### proxmox_node |
112 |
| - |
113 |
| -Create a custom field for Proxmox Node. It will be called `proxmox_node`. Here is what `proxmox_node` should look like after you've made your changes. |
114 |
| - |
115 |
| - |
116 |
| - |
117 |
| - |
118 |
| -#### proxmox_vm_template |
119 |
| - |
120 |
| -Create a custom field for Proxmox VM template. It will be called `proxmox_vm_template`. Here is what `proxmox_vm_template` should look like after you've made your changes. |
121 |
| - |
122 |
| - |
123 |
| - |
124 |
| -#### proxmox_vm_storage |
125 |
| - |
126 |
| -Create a custom field for Proxmox VM storage. It will be called `proxmox_vm_storage`. Here is what `proxmox_vm_storage` should look like after you've made your changes. |
127 |
| - |
128 |
| - |
129 |
| - |
130 |
| -#### proxmox_disk_storage_volume |
131 |
| - |
132 |
| -Create a custom field for Proxmox disk storage volume. It will be called `proxmox_disk_storage_volume`. Here is what `proxmox_disk_storage_volume` should look like after you've made your changes. |
133 |
| - |
134 |
| - |
135 |
| - |
136 |
| -#### proxmox_public_ssh_key |
137 |
| - |
138 |
| -Create a custom field for Proxmox VM public SSH key. It will be called `proxmox_public_ssh_key`. Here is what `proxmox_public_ssh_key` should look like after you've made your changes. |
139 |
| - |
140 |
| - |
141 |
| - |
142 |
| -#### proxmox_vmid |
143 |
| - |
144 |
| -Create a custom field for Proxmox VMID. It will be called `proxmox_vmid`. Here is what `proxmox_vmid` should look like after you've made your changes. *Note that `proxmox_vmid` is set automatically during the Proxmox VM provisioning process. Any VMID that you specified will be discarded.* |
| 53 | +Then verify that everything has been created. In the end, you should have Custom Fields for the following. |
| 54 | + |
| 55 | + - proxmox_node: |
| 56 | + - Object types: Virtual Machine |
| 57 | + - Label: Proxmox node |
| 58 | + - Group name: Proxmox (common) |
| 59 | + - Type: Selection |
| 60 | + - proxmox_vm_type: |
| 61 | + - Object types: Virtual Machine |
| 62 | + - Label: Proxmox VM Type |
| 63 | + - Group name: Proxmox (common) |
| 64 | + - Type: Selection |
| 65 | + - proxmox_vmid: |
| 66 | + - Object types: Virtual Machine |
| 67 | + - Label: Proxmox Virtual machine ID (vmid) |
| 68 | + - Group name: Proxmox (common) |
| 69 | + - Type: Text |
| 70 | + - proxmox_vm_storage: |
| 71 | + - Object types: Virtual Machine |
| 72 | + - Label: Proxmox VM Storage |
| 73 | + - Group name: Proxmox (common) |
| 74 | + - Type: Selection |
| 75 | + - proxmox_public_ssh_key: |
| 76 | + - Object types: Virtual Machine |
| 77 | + - Label: Proxmox public SSH key |
| 78 | + - Group name: Proxmox (common) |
| 79 | + - Type: Text (long) |
| 80 | + - proxmox_lxc_templates: |
| 81 | + - Object types: Virtual Machine |
| 82 | + - Label: Proxmox LXC Templates |
| 83 | + - Group name: Proxmox LXC |
| 84 | + - Type: Selection |
| 85 | + - proxmox_disk_storage_volume: |
| 86 | + - Object types: Virtual Disk |
| 87 | + - Label: Proxmox Disk Storage Volume |
| 88 | + - Group name: Proxmox VM |
| 89 | + - Type: Selection |
| 90 | + - proxmox_vm_templates: |
| 91 | + - Object types: Virtual Machine |
| 92 | + - Label: Proxmox VM Templates |
| 93 | + - Group name: Proxmox VM |
| 94 | + - Type: Selection |
| 95 | + |
| 96 | +And you have Custom Field Choices for the following: |
| 97 | + |
| 98 | + - proxmox-cluster-nodes: used by `proxmox_node` custom field |
| 99 | + - Choices: available Proxmox nodes |
| 100 | + - Default: first "discovered" Proxmox node |
| 101 | + - proxmox-lxc-templates: used by `proxmox_lxc_templates` custom field |
| 102 | + - Choices: "discovered" available Proxmox LXC images |
| 103 | + - Default: first "discovered" Proxmox LXC image |
| 104 | + - proxmox-vm-storage: used by `proxmox_vm_storage` custom field |
| 105 | + - Choices: "discovered" Proxmox storage volumes |
| 106 | + - Default: first "discovered" Proxmox storage volume |
| 107 | + - proxmox-vm-templates: used by `proxmox_vm_templates` custom field |
| 108 | + - Choices: "discovered" Proxmox VM templates |
| 109 | + - Default: first "discovered" Proxmox VM template, based on lowest discovered vmid |
| 110 | + - proxmox-vm-type: used by `proxmox_vm_type` |
| 111 | + - Choices: Virtual Machine, LXC Container |
| 112 | + - Default: Virtual Machine |
145 | 113 |
|
146 |
| - |
147 | 114 |
|
0 commit comments