Skip to content

Commit

Permalink
Merge pull request #120 from f5devcentral/develop
Browse files Browse the repository at this point in the history
AppWorld updates
  • Loading branch information
russgmoore authored Feb 2, 2024
2 parents 56f49d7 + 7b478a1 commit 008e053
Show file tree
Hide file tree
Showing 76 changed files with 3,736 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ pdf/*
terraform.tfstate*
*.rpm
*.swp
docs/conf.py
.vscode/settings.json
14 changes: 14 additions & 0 deletions docs/class14/class14.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Class 14: Basic BIG-IP Configuration Management with Ansible
============================================================

During this lab you will make use of Ansible
to deploy and configure a BIG-IP instance.

Expected time to complete: **1 hour, 30 minutes**

.. toctree::
:maxdepth: 1
:caption: Contents:
:glob:

module*/module*
Binary file added docs/class14/images/ansiblef5-large.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/class14/images/ansiblef5-transparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/class14/images/ansiblef5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/class14/images/diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/class14/images/f5topology.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/class14/images/japan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/class14/images/network_diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/class14/images/networkautomation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/class14/images/rh-ansible-automation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/class14/images/uk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions docs/class14/module1/0.0-getting-started.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
.. _0.0-getting-started:

Exercise 0.0: Getting Started
#############################

During this lab Visual Studio Code will be used as the editor of choice and also provides a terminal to run Ansible playbooks and watch the logging accordingly.

Follow the steps below to start using VS Code in your local browser during this lab.

Step 1
------

If you already haven't done so. Use the UDF deployment to go to the **Documentation** section and grab the lab guide: https://clouddocs.f5.com/training/community/automation/html/class14/class14.html |labguide|

.. |labguide| image:: labguide.png

Step 2
------

In the UDF deployment, go to the **Deployment** section, search the **Ansible host** and click **Access** and select **VS Code**. |vscode_access|

.. |vscode_access| image:: vscode_access.png

Your local browser will start up VS Code.

Step 3
------

Check the box to Trust the authors and click the button **Yes, I trust...**.

**Ignore** the pop-up error windows in the bottom-right of your browser by **closing** them.

Step 4
------

Go to the left side of the screen and select the **three stripes**. Then go to **Terminal** and select **New Terminal**. |terminal|

.. |terminal| image:: terminal.png

The **Terminal Pane** section will appear at the bottom and change the view from **Output** to **Terminal**. |vscode_pane|

.. |vscode_pane| image:: vscode_pane.png


You can use the **terminal Pane** to launch **Ansible playbooks** and execute **Shell** commands during the lab.

Step 5
------
Note: There are copies of the lab scripts located under the folder "networking-workshop" in the explorer pane on the left that can be used for error checking and copy/paste needs.
..
Note 2: When you navigate to the folders and click files the Terminal may switch back to Ouput and errors may pop up on bottom right. Just click back to Terminal tab and close the error pop ups.

In order to be able to deploy those Ansible playbooks, you need to create YAML scripts which will become your ansible-playbooks.
In **VS Code Explorer** in an empty space ``right-click`` and select **New File**. You do not need to actually create a file at this time so you can just click away to close. Or you can name it testing123.yml if you wish. |new_file|

.. |new_file| image:: new_file.png

..
Note: Make sure you right-click in the 'empty' grey area. When you right-click at the height of the folder section and create a new file, that file will end up in that selected folder.

You finished the **Getting Started** section.
157 changes: 157 additions & 0 deletions docs/class14/module1/1.0-explore.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
.. _1.0-explore:

Exercise 1.0: Exploring the lab environment
###########################################

Step 1
------

In the VS Code terminal section, navigate to the ``networking-workshop`` directory.

.. code-block:: shell-session
[centos@ansible ~]$ cd networking-workshop/
[centos@ansible networking-workshop]$
Step 2
------

Run the ``ansible`` command with the ``--version`` command to look at
what is configured:

.. code-block:: shell-session
[centos@ansible networking-workshop]$ ansible --version
ansible [core 2.12.4]
config file = /home/centos/.ansible.cfg
configured module search path = ['/home/centos/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/centos/.local/lib/python3.8/site-packages/ansible
ansible collection location = /home/centos/.ansible/collections:/usr/share/ansible/collections
executable location = /home/centos/.local/bin/ansible
python version = 3.8.12 (default, Mar 31 2022, 14:42:38) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
jinja version = 3.1.1
libyaml = True
..
Note: The Ansible version you see might differ from the above output

This command gives you information about the version of Ansible,
location of the executable, version of Python, search path for the
modules and location of the ``ansible configuration file``.

Step 3
------

Use the ``cat`` command to view the contents of the ``ansible.cfg``
file.

.. code-block:: shell-session
:emphasize-lines: 5,7
[centos@ansible networking-workshop]$ cat ~/.ansible.cfg
[defaults]
connection = smart
timeout = 60
inventory = /home/centos/networking-workshop/lab_inventory/hosts
host_key_checking = False
private_key_file = /home/centos/.ssh/aws-private.pem
[centos@ansible networking-workshop]$
Note the following parameters within the ``ansible.cfg`` file:

- ``inventory``: shows the location of the ansible inventory being used
- ``private_key_file``: this shows the location of the private key used
to login to devices (this won’t be present for UDF, we will use the
default key)

Step 4
------

The scope of a ``play`` within a ``playbook`` is limited to the groups
of hosts declared within an Ansible **inventory**. Ansible supports
multiple
`inventory <http://docs.ansible.com/ansible/latest/intro_inventory.html>`__
types. An inventory could be a simple flat file with a collection of
hosts defined within it or it could be a dynamic script (potentially
querying a CMDB backend) that generates a list of devices to run the
playbook against.

In this lab you will work with a file based inventory written in the
**ini** format. Use the ``cat`` command to view the contents of your
inventory:

``[centos@ansible networking-workshop]$ cat lab_inventory/hosts``

The output will look similar to as follows:

.. code-block:: yaml
[all:vars]
ansible_user=centos
ansible_ssh_pass=f5ansible
ansible_ssh_private_key_file=/home/centos/.ssh/aws-private.pem
[lb]
f5 ansible_host=10.1.20.7 ansible_user=admin private_ip=10.1.1.7 destination_ip=10.1.20.100 ansible_ssh_pass=f5ansible
[control]
ansible ansible_host=10.1.1.4 ansible_user=centos
[webservers]
host1 ansible_host=10.1.20.5 ansible_user=centos private_ip=10.1.1.5
host2 ansible_host=10.1.20.6 ansible_user=centos private_ip=10.1.1.6
..
Note that the IP addresses will be different in your environment.

Step 5
------

In the above output every ``[ ]`` defines a group. For example
``[webservers]`` is a group that contains the hosts ``host1`` and
``host2``.

Note: A group called **all** always exists and contains all groups
and hosts defined within an inventory.

We can associate variables to groups and hosts. Host variables are
declared/defined on the same line as the host themselves. For example
for the host ``f5``:

.. code-block:: yaml
f5 ansible_host=10.1.20.7 ansible_user=admin private_ip=10.1.1.7 destination_ip=10.1.20.100 ansible_ssh_pass=f5ansible
- ``f5`` - The name that Ansible will use. This can but does not have
to rely on DNS
- ``ansible_host`` - The IP address that ansible will use, if not
configured it will default to DNS
- ``ansible_user`` - The user ansible will use to login to this host,
if not configured it will default to the user the playbook is run
from
- ``private_ip`` - This value is not reserved by ansible so it will
default to a `host
variable <http://docs.ansible.com/ansible/latest/intro_inventory.html#host-variables>`__.
This variable can be used by playbooks or ignored completely.
- ``destination_ip`` - This value is not reserved either, we are
using it to define the Virtual Server IP we want.
- ``ansible_ssh_pass`` - The password ansible will use to login to this
host, if not configured it will assume the user the playbook ran from
has access to this host through SSH keys.

..
Does the password have to be in plain text? No, Red Hat Ansible Tower
can take care of credential management in an easy to use web GUI or a
user may use
`ansible-vault <https://docs.ansible.com/ansible/latest/network/getting_started/first_inventory.html#protecting-sensitive-variables-with-ansible-vault>`__

Go back to the home directory

.. code-block:: shell-session
[centos@ansible networking-workshop]$ cd ~
You have finished this exercise.
Loading

0 comments on commit 008e053

Please sign in to comment.