Skip to content
Apr 12 / Greg

Ansible Tower/Ansible Control Survey To Template Demo

I recently had a customer ask about how you could present a user with a form they fill out, then that info would be used to complete a template for say a webserver; the simple answer is to use the survey feature in Tower(also sometimes called control in the Ansible Automation Platform).

Demo Video

Resources:

First, my playbook and template can be found here.

The template file is pretty straight forward:

There’s three variables serv_name, option1, and option2 that will be replaced at runtime with the results of the survey.

The playbook is equally simple:

There is really only a single task that really does anything and it is the template task. It calls the survey-template.conf.j2 file, does variable replacement, and then sticks it in the file_loc path.
The remaining two tasks read the file into a variable, then display it. In a real scenario the template file would push the configuration to a server, then perform a restart of the service in question.

Tower/Control:

From the templates section I create a new job template with info to my inventory, credentials, project, and playbook:

Next I click the “add survey” button:

Last I create three entries, each corresponding to a different variable. The survey info is passed at runtime as extra variables.

Now the template can be launched and the info filled out:

I can now see the output of the run in all its glory:

Conclusion:

I hope you can see how info can be gathered via a survey and easily injected into your playbooks to perform any kind of automation you can dream up.

Thanks and happy surveying.

Apr 11 / thebrotherswisp

The Brothers WISP 134 – Rogue DHCP, Unforgivable Bad Habits, Towers By Airports

This week we have Greg, Mike, and Tommy C doing a lot of discussion…which I like.

**Sponsors**
Sonar.software
Kwikbit.com
Towercoverage.com
**/Sponsors**

This week we talk about:
Prevent rogue DHCP servers
unforgivable bad wisp habits
April Fools Clearing
Starlink no plans for tiered consumer plans
DFS
Towers By Airports
Thrift created a new channel called stonks, and I couldn’t care less, but the name makes me LOL
Ubiquiti breach – again (same breach, more info)

Here’s the video:(if you don’t see it, hit refresh)

Mar 28 / thebrotherswisp

The Brothers WISP 133 – Mikrotik Spoilers, Security Practices, Bufferbloat

This week we have Greg, Mike, Nick, and the best hair in the business Andrew Thrift(AKA Little Alex Horne). Big thanks to Tommy C for taking one for the team!

**Sponsors**
Sonar.software
Kwikbit.com
Towercoverage.com
**/Sponsors**

This week we talk about:
CRS504/CRS518 and CCR2016/CCR2116 …speculations?
Thrifty thoughts on security
automation in security
IBM QRadar has a community edition appliance
I’m going to use PFSense as my workshop firewall
How internet congestion control works – bufferbloat
Midwest-IX Router Upgrade
QSFP28-100G DWDM

Here’s the video:(if you don’t see it, hit refresh)

Mar 14 / thebrotherswisp

The Brothers WISP 132 – V7 BGP Test, CRS Optic Issues, Mike Vs Ransomware

This week we have Greg, Mike, and Tommy C. Apologies in advance, I’ve not been feeling too well and the last 30 minutes or so I kinda crashed(so big thanks to T-Cent and Mike for carrying me).

**Sponsors**
Sonar.software
Kwikbit.com
Towercoverage.com
**/Sponsors**

This week we talk about:
Greg’s conversation podcast with random interesting people
Tommy’s CCR2004 V7.1 adventures
MTK CRS317 to CRS328 failure
Mikrotik newsletter 99
100G-FR?
CHR License
Core, Border, Route Reflector, etc.
Mike vs Ransomware

Here’s the video:(if you don’t see it, hit refresh)

Feb 28 / thebrotherswisp

The Brothers WISP 131 – MTK Hardware, Snowpocalypse, Demo Strategies

This week we have Greg, Mike, and the dread pirate Nick A. Ready, set, chat.

**Sponsors**
Sonar.software
Kwikbit.com
Towercoverage.com
**/Sponsors**

This week we talk about:
MTK chateau
MTK KNOT
MTK switches CRxxx line, be sure to have hardware “on” your kit to ensure maximum throughput.
The snowpocalypse was fun in Texas.
Grande lost most fiber service in Texas for about 12 hours.
Migrating Ansible Tower from centos 7 to RHEL 8…”let’s learn everything really fast shall we”
Networking foundations CLI
Demo2win! training for technical demonstrations

Here’s the video:(if you don’t see it, hit refresh)

Feb 24 / Greg

Ansible Tower Survey Textarea To List

I was recently leading an Ansible workshop when someone asked me if you could accept input from a survey in an ansible and use that as a list in a playbook. I worked out a quick solution that I figure may be useful for others too.

I first created a quick survey that would pass a text area to a playbook.

As you can see it passes the survey info over to the playbook as “test_data”. It’s important to remember that the list entries should be one per line.

Next I threw together a quick playbook that will accept the collected info(survey-list.yml):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
---
- name: test message area
  hosts: localhost
  gather_facts: false
  vars:
  tasks:
  - name: debug stuff
    debug:
      var: test_data
 
  - name: run it as a list
    debug:
      msg: "{{ item }}"
    loop: "{{ test_data.split('\n') }}"

Taking a look at the playbook tasks I’m doing two things.
In the first task I’m using the debug module to just dump the contents of the test_data variable.
In the second task I’m looping through the data and spitting out the results one at a time. Notice that I’m taking the same variable and using the split option to break them up into separate entries based on the new line character ‘\n’.

Here’s the output of the run:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
PLAY [test message area] *******************************************************
TASK [debug stuff] *************************************************************
ok: [localhost] => {
    "test_data": "one\ntwo\nthree\nfour"
}
TASK [run it as a list] ********************************************************
ok: [localhost] => (item=one) => {
    "msg": "one"
}
ok: [localhost] => (item=two) => {
    "msg": "two"
}
ok: [localhost] => (item=three) => {
    "msg": "three"
}
ok: [localhost] => (item=four) => {
    "msg": "four"
}
PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Notice in the debug stuff task it has all the entries with the “\n” new lines jammed in between them.
The second task shows the output listed in four separate entries.

So now I can successfully iterate over anything provided by the survey text area!

Thanks and happy automating.

Feb 14 / thebrotherswisp

The Brothers WISP 130 – Netonix No Load, Hotel Door Locks, Leaky Feeder Cable

This week we have Greg and Mike…we are two strong, independent people and don’t need nobody else.

**Sponsors**
Sonar.software
Kwikbit.com
Towercoverage.com
**/Sponsors**

This week we talk about:
Arizona Sunshine multiplayer is all kinds of fun
We had a chat with Simon Westlake from Sonar
Some Netonix switches will power down if there’s no load present on them…
Mikrotik V6.49beta11 – LOTs of fixes: crs3xx packet duplication bonding, pwr-line interface linking, switch fixed interface toggling
Mikrotik commands via automation that require interaction…use the execute command
Customer web interface to reboot PoE ports
Modsec
fail2ban
Speedtest introduces video test – IOS users only for now
Leaky feeder cable
UA-Hotel hotel locks hit the FCC 13MHz and bluetooth
AF60-HD
Ubiquiti Talk Conference
Starlink RIPE Atlas

Here’s the video:(if you don’t see it, hit refresh)