Exercise 1.7: Using the bigip_config module

Read this in other languages: uk English, japan 日本語.

Table of Contents

Objective

Demonstrate use of the BIG-IP config module to save the running configuration to disk

Guide

Step 1:

Using your text editor of choice create a new file called bigip-config.yml.

[student1@ansible ~]$ nano bigip-config.yml

vim and nano are available on the control node, as well as Visual Studio and Atom via RDP

Step 2:

Ansible playbooks are YAML files. YAML is a structured encoding format that is also extremely human readable (unlike it’s subset - the JSON format).

Enter the following play definition into bigip-config.yml:

---
- name: BIG-IP SETUP
  hosts: lb
  connection: local
  gather_facts: false

Do not exit the editor yet.

Step 3

Next, add the task. This task will use the bigip-config to save the running configuration to disk

  tasks:
    - name: SAVE RUNNING CONFIG ON BIG-IP
      f5networks.f5_modules.bigip_config:
        provider:
          server: "{{private_ip}}"
          user: "{{ansible_user}}"
          password: "{{ansible_password}}"
          server_port: 8443
          validate_certs: false
        save: true

A play is a list of tasks. Tasks and modules have a 1:1 correlation. Ansible modules are reusable, standalone scripts that can be used by the Ansible API, or by the ansible or ansible-playbook programs. They return information to ansible by printing a JSON string to stdout before exiting.

Save File and exit out of editor.

Step 4

Run the playbook - exit back into the command line of the control host and execute the following:

[student1@ansible ~]$ ansible-playbook bigip-config.yml

Playbook Output

[student1@ansible]$ ansible-playbook bigip-config.yml

PLAY [BIG-IP SETUP] *******************************************************************************

TASK [SAVE RUNNING CONFIG ON BIG-IP] *******************************************************************************
changed: [f5]

PLAY RECAP ********************************************************************
f5                         : ok=1    changed=1    unreachable=0    failed=0

Solution

The finished Ansible Playbook is provided here for an Answer key. Click here: bigip-config.yml.

You have finished this exercise. Click here to return to the lab guide