1Using OpenStack Baremetal
2=========================
3
4Before working with the Bare Metal service, you'll need to create a
5connection to your OpenStack cloud by following the :doc:`connect` user
6guide. This will provide you with the ``conn`` variable used in the examples
7below.
8
9.. contents:: Table of Contents
10   :local:
11
12The primary resource of the Bare Metal service is the **node**.
13
14Below are a few usage examples. For a reference to all the available methods,
15see :doc:`/user/proxies/baremetal`.
16
17CRUD operations
18~~~~~~~~~~~~~~~
19
20List Nodes
21----------
22
23A **node** is a bare metal machine.
24
25.. literalinclude:: ../examples/baremetal/list.py
26   :pyobject: list_nodes
27
28Full example: `baremetal resource list`_
29
30Provisioning operations
31~~~~~~~~~~~~~~~~~~~~~~~
32
33Provisioning actions are the main way to manipulate the nodes. See `Bare Metal
34service states documentation`_ for details.
35
36Manage and inspect Node
37-----------------------
38
39*Managing* a node in the ``enroll`` provision state validates the management
40(IPMI, Redfish, etc) credentials and moves the node to the ``manageable``
41state. *Managing* a node in the ``available`` state moves it to the
42``manageable`` state. In this state additional actions, such as configuring
43RAID or inspecting, are available.
44
45*Inspecting* a node detects its properties by either talking to its BMC or by
46booting a special ramdisk.
47
48.. literalinclude:: ../examples/baremetal/provisioning.py
49   :pyobject: manage_and_inspect_node
50
51Full example: `baremetal provisioning`_
52
53Provide Node
54------------
55
56*Providing* a node in the ``manageable`` provision state makes it available
57for deployment.
58
59.. literalinclude:: ../examples/baremetal/provisioning.py
60   :pyobject: provide_node
61
62Full example: `baremetal provisioning`_
63
64
65.. _baremetal resource list: http://opendev.org/openstack/openstacksdk/src/branch/master/examples/baremetal/list.py
66.. _baremetal provisioning: http://opendev.org/openstack/openstacksdk/src/branch/master/examples/baremetal/provisioning.py
67.. _Bare Metal service states documentation: https://docs.openstack.org/ironic/latest/contributor/states.html
68