ansible: explicit support for netboot, correct extra_args

Change-Id: Ibff5911f5a9777683cf86f7c654a58020796c00a
This commit is contained in:
Dmitry Tantsur 2018-06-12 09:33:52 +02:00
parent c91a08fb16
commit 8464fced77
5 changed files with 16 additions and 5 deletions

View File

@ -22,11 +22,13 @@
metalsmith_instances:
- hostname: test
image: "{{ image }}"
netboot: "{{ netboot }}"
nics:
- "{{ nic }}"
root_size: 9
ssh_public_keys:
- "{{ ssh_key_file }}"
extra_args: -vv
- name: Get instance info via CLI
command: metalsmith --format=json show test

View File

@ -39,18 +39,18 @@
vars:
image: test-centos-partition
precreate_port: false
extra_args: --netboot
netboot: true
- name: Test whole-disk image with local boot
include: exercise.yaml
vars:
image: test-centos-wholedisk
precreate_port: false
extra_args: ''
netboot: false
- name: Test partition image with local boot and port
include: exercise.yaml
vars:
image: test-centos-partition
precreate_port: true
extra_args: ''
netboot: false

View File

@ -19,6 +19,8 @@ The following optional variables provide the defaults for Instance_ attributes:
the default for ``image``.
``metalsmith_capabilities``
the default for ``capabilities``.
``metalsmith_netboot``
the default for ``netboot``
``metalsmith_nics``
the default for ``nics``.
``metalsmith_resource_class``
@ -39,6 +41,9 @@ Each instances has the following attributes:
UUID or name of the image to use for deployment. Mandatory.
``capabilities`` (defaults to ``metalsmith_capabilities``)
node capabilities to request when scheduling.
``netboot``
whether to boot the deployed instance from network (PXE, iPXE, etc).
The default is to use local boot (requires a bootloader on the image).
``nics`` (defaults to ``metalsmith_nics``)
list of virtual NICs to attach to node's physical NICs. Each is an object
with exactly one attribute:

View File

@ -1,6 +1,7 @@
# Optional parameters
metalsmith_capabilities: {}
metalsmith_extra_args:
metalsmith_netboot: false
metalsmith_nics: []
metalsmith_root_size:
metalsmith_ssh_public_keys: []

View File

@ -2,7 +2,7 @@
- name: Provision instances
command: >
metalsmith -vv deploy
metalsmith {{ extra_args }} deploy
{% for cap_name, cap_value in capabilities.items() %}
--capability {{ cap_name }}={{ cap_value }}
{% endfor %}
@ -19,13 +19,16 @@
{% endfor %}
--image {{ image }}
--hostname {{ instance.hostname }}
{{ extra_args }}
{% if netboot %}
--netboot
{% endif %}
{{ resource_class }}
when: state == 'present'
vars:
extra_args: "{{ instance.extra_args | default(metalsmith_extra_args) }}"
image: "{{ instance.image | default(metalsmith_image) }}"
capabilities: "{{ instance.capabilities | default(metalsmith_capabilities) }}"
netboot: "{{ instance.netboot | default(metalsmith_netboot) }}"
nics: "{{ instance.nics | default(metalsmith_nics) }}"
resource_class: "{{ instance.resource_class | default(metalsmith_resource_class) }}"
root_size: "{{ instance.root_size | default(metalsmith_root_size) }}"