Skip to content

Commit

Permalink
Merge pull request #396 from ansible/devel
Browse files Browse the repository at this point in the history
Release August 21, 2019
  • Loading branch information
IPvSean authored Aug 21, 2019
2 parents b30948b + ff54a55 commit e0e6a39
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
31 changes: 19 additions & 12 deletions exercises/ansible_network/7-tower-survey/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,33 +42,40 @@ Demonstrate the use of Ansible Tower [survey feature](https://docs.ansible.com/a
Here is what the `network_banner.yml` Ansible Playbook looks like:

<!-- {% raw %} -->
```yaml
```yml
---
- name: SET ROUTER BANNERS
hosts: all
- name: set router banners
hosts: routers
gather_facts: no

tasks:

- name: LOAD BANNER ONTO NETWORK DEVICE
include_tasks: "{{ ansible_network_os }}_banner.yaml"
- name: load banner onto network device
vars:
- network_banner: "{{ net_banner | default(None) }}"
- banner_type: "{{ banner_type | default('login') }}"
- banner_type: "{{ net_type | default('login') }}"
include_role:
name: banner
```
<!-- {% endraw %} -->
> Note: You can also view the Ansible Playbook here: [https://github.com/network-automation/tower_workshop](https://github.com/network-automation/tower_workshop)
The role **banner** has a very simple `main.yml` file:

```yml
- name: configure banner
include_tasks: "{{ ansible_network_os }}.yml"
```

The `ansible_network_os` variable is being used to parameterize the network OS and create a vendor neutral playbook.

If you are working with a junos device, this playbook would call for a task file called `junos_banner.yaml`. If you are using an IOS-XE device, this playbook would call for a task file called `ios_banner.yaml`. This file will in turn contain the platform specific tasks:
If you are working with a junos device, this playbook would call for a task file called `junos.yml`. If you are using an IOS-XE device, this playbook would call for a task file called `ios.yml`. This file will in turn contain the platform specific tasks:

<!-- {% raw %} -->
```yaml
```yml
---
- name: ADD THE JUNOS BANNER
- name: add the junos banner
junos_banner:
text: "{{ network_banner }}"
banner: "{{ banner_type }}"
Expand All @@ -81,7 +88,7 @@ Also note that we are passing in 2 variables to the task file.

1. `network_banner`: This variable is populated using the `net_banner` variable

2. `banner_type`: This variable is populated by a variable named `banner_type`
2. `banner_type`: This variable is populated by a variable named `net_type`


## Step 3: Create a survey
Expand Down Expand Up @@ -119,7 +126,7 @@ In this step you will create a *"survey"* of user input form to collect input fr
|-------------------------|--------------------------------|
| Prompt | Please enter the banner type |
| Description | Please choose an option |
| Answer Variable Name | `banner_type` |
| Answer Variable Name | `net_type` |
| Answer type | Multiple Choice(single select) |
| Multiple Choice Options | login <br>motd |
| default answer | login |
Expand Down
Binary file modified exercises/ansible_network/7-tower-survey/images/survey_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion provisioner/tests/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ec2_region: us-east-1
student_total: 2
admin_password: ansible
create_login_page: false
create_login_page: true
autolicense: true
towerinstall: true
ansible_python_interpreter: '/usr/bin/env python'

0 comments on commit e0e6a39

Please sign in to comment.