From d1a87c0e9aad6cdddf5fb6de033bc90525cdd7a5 Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Tue, 28 Mar 2017 16:10:10 +0100
Subject: [PATCH] Add README files for dell-switch and dell-switch-bmp roles

---
 ansible/group_vars/all/dell-switch-bmp  |  2 +
 ansible/roles/dell-switch-bmp/README.md | 69 ++++++++++++++++++++
 ansible/roles/dell-switch/README.md     | 86 +++++++++++++++++++++++++
 etc/kayobe/dell-switch-bmp.yml          |  2 +
 4 files changed, 159 insertions(+)
 create mode 100644 ansible/roles/dell-switch-bmp/README.md
 create mode 100644 ansible/roles/dell-switch/README.md

diff --git a/ansible/group_vars/all/dell-switch-bmp b/ansible/group_vars/all/dell-switch-bmp
index 6be98f918..8dcdced7d 100644
--- a/ansible/group_vars/all/dell-switch-bmp
+++ b/ansible/group_vars/all/dell-switch-bmp
@@ -7,4 +7,6 @@
 # dest: Name of the file to download the image to.
 # match: dnsmasq match rule to match hosts against.
 # tag: dnsmasq tag to apply to matching hosts.
+# checksum: optional checksum of image, in format required for Ansible's
+#           get_url module.
 dell_switch_bmp_images: []
diff --git a/ansible/roles/dell-switch-bmp/README.md b/ansible/roles/dell-switch-bmp/README.md
new file mode 100644
index 000000000..24b95f193
--- /dev/null
+++ b/ansible/roles/dell-switch-bmp/README.md
@@ -0,0 +1,69 @@
+Dell Switch BMP
+===============
+
+This role configures a network boot environment for Dell switches with Bare
+Metal Provisioning (BMP) functionality.
+
+Requirements
+------------
+
+The use of an OpenStack Bifrost container deployed using OpenStack
+Kolla-ansible is assumed, with the dnsmasq service providing DHCP and nginx
+serving the switch OS images.
+
+Role Variables
+--------------
+
+`dell_switch_bmp_images` is a list of images to provide a BMP configuration
+for, and defaults to an empty list.  Each item should be a dict with the
+following keys:
+`url`
+    URL of the image to download.
+`dest`
+    Name of the file to download the image to.
+`match`
+    dnsmasq match rule to match hosts against.
+`tag`
+    dnsmasq tag to apply to matching hosts.
+`checksum`
+    optional checksum of image, in format required for Ansible's `get_url`
+    module.
+
+`dell_switch_bmp_http_base_url` is the base URL of HTTP server.
+
+`dell_switch_bmp_httpboot_path` is the path to the HTTP server base directory,
+and defaults to `/httpboot`.
+
+Dependencies
+------------
+
+None
+
+Example Playbook
+----------------
+
+The following playbook configures a network boot environment in the Bifrost
+container for s6010-ON switches with the `ONIE-FTOS-9.10.0.1P25.bin` image.
+
+    ---
+    # This playbook will configure a Bare Metal Provisioning (BMP) environment for
+    # Dell switches on the Bifrost node so that they can be network booted.
+
+    - name: Ensure that a Bare Metal Provisioning (BMP) environment is configured for Dell switches
+      hosts: bifrost
+      roles:
+        - role: dell-switch-bmp
+          dell_switch_bmp_images:
+            # ONIE installer image for S6010-ON.
+            - url: "ftp://ftp.force10networks.com/releases/FTOS_Release/E9.10.0.1P25/S6010/ONIE-FTOS-S6010-9.10.0.1P25.bin"
+              checksum: "md5:f94fdfa50dc23f87bf2871ae96b6cff3"
+              dest: "onie-installer-x86_64-dell_s6010_c2538-r0"
+              match: "option:vendor-class,onie_vendor:x86_64-dell_s6010_c2538-r0"
+              tag: "onie"
+          # This is the base URL of the Nginx web server on the Bifrost node.
+          dell_switch_bmp_http_base_url: "http://10.0.0.1:8080"
+
+Author Information
+------------------
+
+- Mark Goddard (<mark@stackhpc.com>)
diff --git a/ansible/roles/dell-switch/README.md b/ansible/roles/dell-switch/README.md
new file mode 100644
index 000000000..d67701bc4
--- /dev/null
+++ b/ansible/roles/dell-switch/README.md
@@ -0,0 +1,86 @@
+Dell Switch
+===========
+
+This role configures Dell switches using the `dellos6` or `dellos9` Ansible
+modules.  It provides a fairly minimal abstraction of the configuration
+interface provided by the `dellos` modules, allowing for application of
+arbitrary switch configuration options.
+
+Requirements
+------------
+
+The switches should be configured to allow SSH access.
+
+Role Variables
+--------------
+
+`dell_switch_delegate_to` is the host on which to execute the `dellos` Ansible
+modules.
+
+`dell_switch_type` is the type of Dell switch. One of `dellos6`, `dellos9`.
+
+`dell_switch_provider` is authentication provider information passed as the
+`provider` argument to the `dellos` modules.
+
+`dell_switch_config` is a list of configuration lines to apply to the switch,
+and defaults to an empty list.
+
+`dell_switch_interface_config` contains interface configuration. It is a dict
+mapping switch interface names to configuration dicts. Each dict may contain
+the following items:
+`description`
+    A description to apply to the interface.
+`config`
+    A list of per-interface configuration.
+
+Dependencies
+------------
+
+None
+
+Example Playbook
+----------------
+
+The following playbook configures hosts in the `dell-switches` group.  It
+assumes host variables for each switch holding the host, username and
+passwords.  It applies global configuration for LLDP, and enables two
+10G ethernet interfaces as switchports.
+
+    ---
+    - name: Ensure DellOS switches are configured
+      hosts: dellos9-switches
+      gather_facts: no
+      roles:
+        - role: dell-switch
+          dell_switch_delegate_to: localhost
+          dell_switch_type: "dellos9"
+          dell_switch_provider:
+            host: "{{ switch_host }}"
+            username: "{{ switch_user }}"
+            password: "{{ switch_password }}"
+            transport: cli
+            authorize: yes
+            auth_pass: "{{ switch_auth_pass }}"
+          dell_switch_config:
+            - "protocol lldp"
+            - " advertise dot3-tlv max-frame-size"
+            - " advertise management-tlv management-address system-description system-name"
+            - " advertise interface-port-desc"
+            - " no disable"
+            - " exit"
+          dell_switch_interface_config:
+            Te1/1/1:
+              description: server-1
+              config:
+                - "no shutdown"
+                - "switchport"
+            Te1/1/2:
+              description: server-2
+              config:
+                - "no shutdown"
+                - "switchport"
+
+Author Information
+------------------
+
+- Mark Goddard (<mark@stackhpc.com>)
diff --git a/etc/kayobe/dell-switch-bmp.yml b/etc/kayobe/dell-switch-bmp.yml
index 33e04f34e..78eb73ac8 100644
--- a/etc/kayobe/dell-switch-bmp.yml
+++ b/etc/kayobe/dell-switch-bmp.yml
@@ -7,6 +7,8 @@
 # dest: Name of the file to download the image to.
 # match: dnsmasq match rule to match hosts against.
 # tag: dnsmasq tag to apply to matching hosts.
+# checksum: optional checksum of image, in format required for Ansible's
+#           get_url module.
 #dell_switch_bmp_images:
 
 ###############################################################################