Skip to content

Commit 2aa4eb4

Browse files
author
Josh
committed
Formatting cleanup
1 parent 684dee9 commit 2aa4eb4

File tree

1 file changed

+66
-44
lines changed

1 file changed

+66
-44
lines changed

docs/rst/extra/quickstart.rst

Lines changed: 66 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ Quickstart Guide
55
****************
66

77
This guide will walk users through a few foundational Ansible terms and
8-
concepts, introduce the HyperCore collection, and provide guidance on
9-
writing playbooks.
8+
concepts, introduce the HyperCore Collection, and provide guidance on
9+
writing Playbooks.
1010

1111
Introduction
1212
=============
1313
Scale Computing recently launched the SC//HyperCore Collection for Ansible. This exciting tool gives MSPs and distributed edge
1414
organizations the ability to implement declarative configuration
1515
management in their HyperCore fleet. Ansible is an IT automation tool
16-
designed to automate server provisioning and management via playbooks.
17-
These playbooks are similar to scripts, but have two key benefits,
16+
designed to automate server provisioning and management via Playbooks.
17+
These Playbooks are similar to scripts, but have two key benefits,
1818
namely: they are human readable and idempotent, meaning they can be run
1919
several times and are smart enough to only take actions that are
2020
required (and skip those that aren't) to put a HyperCore cluster in the
@@ -24,7 +24,7 @@ HyperCore fleets.
2424
.. note::
2525
Ansible is an open source tool maintained by Red Hat. It is
2626
completely free to install and use. ScaleCare support may
27-
provide best-effort assistance in writing playbooks and
27+
provide best-effort assistance in writing Playbooks and
2828
diagnosing issues.
2929

3030
However, the HyperCore Collection for Ansible is fully
@@ -36,7 +36,7 @@ HyperCore fleets.
3636
Overview and Terminology
3737
========================
3838

39-
Before you can begin writing playbooks and automating HyperCore
39+
Before you can begin writing Playbooks and automating HyperCore
4040
management, we must first cover a few important concepts. First, it is
4141
important to note that Ansible is a powerful tool that gives users the
4242
ability to accomplish the same task in a myriad of different ways. It
@@ -47,8 +47,8 @@ with Ansible.
4747
Second, Ansible commands need to be run from an "Ansible Server" (also
4848
called an "Ansible Control Host"). In some cases, this is actually a
4949
dedicated physical server or VM, however this is not always necessary.
50-
Users can run ansible from a workstation, this local machine contains
51-
the necessary playbooks to run against the servers being managed.
50+
Users can run Ansible from a workstation, this local machine contains
51+
the necessary Playbooks to run against the servers being managed.
5252

5353
Third, Open SSH is the default communication standard used by Ansible
5454
for remote administration. Crucially, this is not how Ansible will
@@ -60,7 +60,7 @@ Inventory
6060

6161
Ansible is incredibly useful for managing many HyperCore clusters.
6262
Ansible relies on an inventory file to establish which clusters you want
63-
to target with your playbooks. This file is most commonly formatted in
63+
to target with your Playbooks. This file is most commonly formatted in
6464
either INI or YAML and lists your clusters. For larger organizations,
6565
the inventory is also the ideal location to organize your fleet,
6666
particularly when you desire different cluster states based on different
@@ -94,7 +94,7 @@ something like this:
9494
Ansible Configuration File
9595
---------------------------
9696

97-
When running Ansible commands and writing playbooks it is important to
97+
When running Ansible commands and writing Playbooks it is important to
9898
specify where your inventory is and other configuration specifics, like
9999
your Ansible collection path. This file serves as the center to all of
100100
your server interactions.
@@ -104,13 +104,13 @@ configuration file **(ansible.cfg)**. The default configuration is a large
104104
file that you can choose to use, however it is also fine to create your
105105
own simplified version. The most important thing is to make sure your
106106
work is referencing the correct configuration file. The easiest way to
107-
achieve this is by including an ansible.cfg in the directory where you
107+
achieve this is by including an **ansible.cfg** in the directory where you
108108
are working with Ansible or setting it as an environment variable.
109109

110110
For the purposes of this guide, you need to make sure your configuration
111111
file specifies where your inventory is located. All that is required is
112-
to set ``inventory = [folder that contains your inventory in your working
113-
ansible directory]``. You can reference a specific file or an entire
112+
to set ``inventory`` = [folder that contains your inventory in your working
113+
ansible directory]. You can reference a specific file or an entire
114114
inventory folder. An example of a simple configuration file looks like
115115
this:
116116

@@ -120,11 +120,11 @@ Ansible Module
120120
--------------
121121

122122
Now that you are familiar with Ansible inventories and configuration
123-
files we can turn to the meat of Ansible and the HyperCore collection:
123+
files we can turn to the meat of Ansible and the HyperCore Collection
124124
modules. Ansible Modules are units of code that can control the servers
125125
that you are managing with Ansible. After installing Ansible, you will
126126
have access to a library of modules that give you the ability to execute
127-
specific tasks on remote servers through playbooks and individual
127+
specific tasks on remote servers through Playbooks and individual
128128
commands. Scale Computing has made managing your HyperCore fleet via
129129
Ansible possible by developing our own set of modules that call existing
130130
cluster REST API endpoints. Extensive documentation on our current
@@ -133,54 +133,61 @@ available modules can be found
133133

134134
For example: `scale_computing.hypercore.vm <https://scalecomputing.github.io/HyperCoreAnsibleCollection-docs/modules/vm.html>`_
135135
is the module that will allow you to create, update, and delete virtual
136-
machines. When you begin writing playbooks, you will reference a specific
136+
machines. When you begin writing Playbooks, you will reference a specific
137137
module when attempting to automate a task associated with that said module
138138
is equipped to handle.
139139

140140
Ansible Playbook
141141
-----------------
142142

143-
Finally, playbooks are the most important piece of Ansible. Playbooks
143+
Finally, Playbooks are the most important piece of Ansible. Playbooks
144144
allow you to automate tasks that would normally need to be done more
145145
than once across the clusters in your fleet. While similar to scripts,
146-
playbooks are much easier to write because they are human readable.
146+
Playbooks are much easier to write because they are human readable.
147147
Additionally, we have in-depth documentation about every module
148148
available in the Ansible collection, with specific examples of how each
149-
module can be written as a task that is part of a playbook.
150-
Additionally, playbooks and Ansible are idempotent, meaning that they
149+
module can be written as a task that is part of a Playbook.
150+
Additionally, Playbooks and Ansible are idempotent, meaning that they
151151
are smart enough to know if a cluster already has a desired
152152
configuration and skip tasks that do not need repeated.
153153

154-
At a high level, playbooks typically begin with the author specifying
154+
At a high level, Playbooks typically begin with the author specifying
155155
which hosts (in our case HyperCore clusters) are going to be targeted.
156156
They will then establish the method by which Ansible will connect to the
157157
remote hosts (in our case this will be ``connection:
158158
ansible.builtin.local``). Once these have been established, the author
159159
can begin writing tasks in the order in which they will be carried out;
160-
calling out the necessary ansible modules and module parameters along
160+
calling out the necessary Ansible modules and module parameters along
161161
the way.
162162

163163
In a future section, you will get an overview of how to start writing
164-
your own playbooks.
164+
your own Playbooks.
165165

166166
Ansible Installation
167167
====================
168168

169-
Now that you have a basic understanding of key Ansible concepts we can turn to installing Ansible and the HyperCore collection.
169+
Now that you have a basic understanding of key Ansible concepts we can turn to installing Ansible and the HyperCore Collection.
170170

171171
.. note::
172-
Your ansible server (where you run your commands) must be a UNIX-like machine with Python 3.8 or newer. This guide uses an
172+
Your Ansible server (where you run your commands) must be a UNIX-like machine with Python 3.8 or newer. This guide uses an
173173
Ubuntu 20.04 virtual machine to demonstrate how to install Ansible.
174174

175-
1. Install ansible ``sudo apt install ansible``
176-
a. This command will install of the ncessary packages, libraries, and bianaries needed to run Ansible.
177-
2. Now that you have installed Ansible, you need to install the HyperCored Collection with this command: ``ansible-galaxy collection install scale_computing.hypercore``
178-
a. Installing the HyperCore collection will give you access to all of the modules we have built to allow you to automate tasks within HyperCore.
179-
b. Full documentation on our collection can be found at `Ansible galaxy <https://galaxy.ansible.com/scale_computing/hypercore>`_.
175+
1. Install Ansible:
176+
``sudo apt install ansible``
177+
178+
a. This command will install of the necessary packages, libraries, and bianaries needed to run Ansible.
179+
180+
2. Now that you have installed Ansible, you need to install the HyperCore Collection with this command:
181+
``ansible-galaxy collection install scale_computing.hypercore``
182+
183+
a. Installing the HyperCore Collection will give you access to all of the modules we have built to allow you to automate tasks within HyperCore.
184+
185+
b. Full documentation on our collection can be found at `Ansible galaxy <https://galaxy.ansible.com/scale_computing/hypercore>`_.
180186

181187
.. image:: images/qs_install1.png
182188

183-
3. You are now ready to start using Ansible with your HyperCore clusters! Before turning to writing Playbooks, you can test that the collections was successfully installed by running single-module commands.
189+
3. You are now ready to start using Ansible with your HyperCore clusters! Before turning to writing Playbooks, you can test that the collection was successfully installed by running single-module commands.
190+
184191
4. Specify a HyperCore cluster to test an Ansible module against with the following commands:
185192

186193
.. code-block:: shell
@@ -191,30 +198,35 @@ Now that you have a basic understanding of key Ansible concepts we can turn to i
191198
192199
.. image:: images/qs_install2.png
193200

194-
5. You can now run your first Ansible command against the test cluster you previously specified! Enter the following command:
201+
5. You can now run your first Ansible command against the test cluster you previously specified!
202+
203+
Enter the following command:
195204
``ansible -i localhost, --connection=ansible.builtin.local all -m scale_computing.hypercore.vm_info``
196205

197206
This command is targeting your local host *(localhost)*, using the required connection protocol for HyperCore clusters instead of default ssh *(--connection=ansible.builtin.local)*, using the ``scale_computing.hypercore.vm_info`` module. If successful, this command should return information about every VM running on your target cluster.
198207

199208
.. image: images/qs_install3.png
200209
201-
Congratulations! You have successfully installed Ansible and the HyperCore collection. The next section will walk you through setting up a basic inventory file and writing a playbook.
210+
Congratulations! You have successfully installed Ansible and the HyperCore Collection. The next section will walk you through setting up a basic inventory file and writing a Playbook.
202211

203212
Getting Started with Playbooks
204213
==============================
205214

206-
With Ansible and the HyperCore collection downloaded and installed, you are now ready to start writing your own Playbooks. As mentioned earlier, playbooks are essentially scripts that automate a series of tasks to be run against your HyperCore fleet. However, playbooks are much easier to write than normal scripts because they are simply YAML-formatted text files that are interpreted by Ansible.
215+
With Ansible and the HyperCore Collection downloaded and installed, you are now ready to start writing your own Playbooks. As mentioned earlier, Playbooks are essentially scripts that automate a series of tasks to be run against your HyperCore fleet. However, Playbooks are much easier to write than normal scripts because they are simply YAML-formatted text files that are interpreted by Ansible.
207216

208217
While exporting HyperCore cluster information at the command line works perfectly fine for one-off Ansible commands (like in the previous section), Playbooks rely on an inventory file to establish which clusters are in your fleet and are automated. In order to get started writing Playbooks, you should first create an inventory file in the directory where you downloaded and installed Ansible and the HyperCore Collection.
209218

210-
1. Create a folder called ``/inventory``
211-
2. Create a file called ``inventory`` within this folder
212-
a. Inventory files can be YAML, JSON, and INI formatted.
219+
1. Create a folder called ``/inventory``.
220+
221+
2. Create a file called ``inventory`` within this folder.
222+
223+
a. Inventory files can be YAML, JSON, and INI formatted.
213224

214225
.. note:: This can be done easily via a text editor like nano or a source-code editor like Visual Studio Code (VSC).
215226

216-
b. This example includes groups (which are entirely optional), but demonstrate how an inventory file could be used to organize a larger fleet.
217-
c. Here is a handy reference for `creating more complex inventory files <https://docs.ansible.com/ansible/2.5/user_guide/intro_inventory.html>`_.
227+
b. This example includes groups (which are entirely optional), but demonstrate how an inventory file could be used to organize a larger fleet.
228+
229+
c. Here is a handy reference for `creating more complex inventory files <https://docs.ansible.com/ansible/2.5/user_guide/intro_inventory.html>`_.
218230

219231
.. code-block:: yaml
220232
@@ -238,11 +250,14 @@ In the previous section, you created an inventory that contains one cluster. Ple
238250
Due to the flexibility of Ansible, you will also need to create an Ansible Configuration file to set your defaults, like calling out which inventory Ansible should reference. For the purposes of this guide, you only need to make sure your configuration file specifies that your inventory is equal to the folder that contains your inventory in your working Ansible directory.
239251

240252
1. Create new file called ``ansible.cfg`` in the directory you are using for Ansible.
253+
241254
2. Open an editing tool and create the following:
242255

243256
.. image:: images/qs_gstarted.png
244257

245-
3. This file allows you to set basic Ansible defaults, more importantly, you are instructing Ansible to reference your "inventory" file that you created in the previous step. **Note** this can be a full file path if you are referencing a specific file or simply call out the entire folder (if you are distributing your inventory amongst several files). In this case it does not really matter since you only have one file in your inventory folder.
258+
3. This file allows you to set basic Ansible defaults, more importantly, you are instructing Ansible to reference your ``inventory`` file that you created in the previous step.
259+
260+
.. note:: This can be a full file path if you are referencing a specific file or simply call out the entire folder (if you are distributing your inventory amongst several files). In this case it does not really matter since you only have one file in your inventory folder.
246261

247262
With basic inventory and ``ansbile.cfg`` files created, we can now begin writing Playbooks.
248263

@@ -252,20 +267,26 @@ Writing Playbooks
252267
This guide will now demonstrate how to create a Playbook that will create a VM on your test cluster.
253268

254269
1. Create a new file called ``simple_vm_create.yml`` in the directory you are using for Ansible.
270+
255271
2. Open an editing tool and begin your Playbook with the following:
256272

257273
.. image:: images/qs_wplaybooks1.png
258274

259275
.. note:: All YAML files, including Playbooks, begin with "---" and the information that specifies the purpose of the Playbook. This identifies host targets, whether to gather basic facts about the target hosts, and how Ansible will communicate with those targets. Remember, SSH is the default protocol used by Ansible, so when writing Playbooks with the HyperCore Collection, you should specify ``ansible.builtin.local``.
260276

261277
3. After specifying this information, you can start adding tasks to your Playbook
262-
4. A few lines after your introduction block of test write ``tasks:``
278+
279+
4. A few lines after your introduction block of test write
280+
``tasks:``.
281+
263282
a. This line tells Ansible that the text below will outline specific actions to be performed.
283+
264284
b. ``tasks:`` should be lined up directly below ``gather_facts: False``
265285

266286
.. image:: images/qs_wplaybooks2.png
267287

268288
5. Each individual task in a Playbook shoule begin with ``- name:`` and a concise name that explains the purpose of that task. This name helps you understand what each task in a Playbook is attempting to accomplish.
289+
269290
6. The next line specifies which module you are using from the HyperCore Collecction to archieve the task. Right now the HyperCore Collection contains 19 individual modules that facilitate actions related to workload lifecycle management.
270291
The best place to start with writing and formatting tasks using these modules is our `published documentation <https://galaxy.ansible.com/scale_computing/hypercore>`_.
271292
At this link, you will find clear explanations of what each module enables and examples on how to correctly write a task with each module.
@@ -318,10 +339,11 @@ This guide will now demonstrate how to create a Playbook that will create a VM o
318339
register: result
319340
320341
8. After copying and pasting the task into your editor of choice you only need to make a few changes to run the Playbook.
321-
a. First, directly under ``scale_computing.hypercore.vm:``, insert a new code block that looks like this:
342+
343+
a. First, directly under ``scale_computing.hypercore.vm:``, insert a new code block that looks like this:
322344

323345
.. image:: images/qs_wplaybooks4.png
324-
:alt: This is how we tell the playbook to reference our inventory file and includes our target host and the variables for HyperCore user and password.
346+
:alt: This is how we tell the Playbook to reference our inventory file and includes our target host and the variables for HyperCore user and password.
325347

326348
b. Second, delete the following section entirely:
327349

@@ -365,7 +387,7 @@ b. If successful, you will see an output at the command line that looks like thi
365387
366388
11. Finally, if you want to test Ansible's idempotency you can re-run the exact same Playbook again with no changes. As long as you haven't changed anything about the VM, Ansible will be able to see that the VM you desire is already on the cluster and skip creating a new one. The result is called out as ``ok`` in the play recap.
367389

368-
.. image: images/qs_wplaybooks7.png
390+
.. image:: images/qs_wplaybooks7.png
369391

370392
Conclusion
371393
==========

0 commit comments

Comments
 (0)