diff --git a/playbooks/integration/exercise.yaml b/playbooks/integration/exercise.yaml index 6c95993..abfbd79 100644 --- a/playbooks/integration/exercise.yaml +++ b/playbooks/integration/exercise.yaml @@ -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 diff --git a/playbooks/integration/run.yaml b/playbooks/integration/run.yaml index 0047e88..aa4feb4 100644 --- a/playbooks/integration/run.yaml +++ b/playbooks/integration/run.yaml @@ -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 diff --git a/roles/metalsmith_deployment/README.rst b/roles/metalsmith_deployment/README.rst index a110698..9d655c7 100644 --- a/roles/metalsmith_deployment/README.rst +++ b/roles/metalsmith_deployment/README.rst @@ -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: diff --git a/roles/metalsmith_deployment/defaults/main.yml b/roles/metalsmith_deployment/defaults/main.yml index 5117e34..92e8c43 100644 --- a/roles/metalsmith_deployment/defaults/main.yml +++ b/roles/metalsmith_deployment/defaults/main.yml @@ -1,6 +1,7 @@ # Optional parameters metalsmith_capabilities: {} metalsmith_extra_args: +metalsmith_netboot: false metalsmith_nics: [] metalsmith_root_size: metalsmith_ssh_public_keys: [] diff --git a/roles/metalsmith_deployment/tasks/main.yml b/roles/metalsmith_deployment/tasks/main.yml index ac8666d..2d47336 100644 --- a/roles/metalsmith_deployment/tasks/main.yml +++ b/roles/metalsmith_deployment/tasks/main.yml @@ -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) }}"