Dig deeper into Ansible and F5 integration
Basics of Ansible and F5 integration were covered in a joint webinar held earlier in March 2017. To learn more about the integration and current F5 module support along with some use cases view the w...
Published Apr 05, 2017
Version 1.0Payal_S
Ret. Employee
Joined May 16, 2019
Payal_S
Ret. Employee
Joined May 16, 2019
Payal_S
Nov 15, 2017Ret. Employee
Alright let's give this another try. Let's keep it real simple. Let's look at the three files to get this to work
1) The host file, which is be default placed at /etc/ansible/hosts (this file will have the IP Address of your bigip)
[bigip]
10.XX.XX.XX
2) The variable file is the same directory as your playbook, the values from this variable file will be substituted when the playbook is run
username: admin
password: admin
banner_text: "--------Welcome to Onboarding BIGIP----------"
hostname: 'ansibleManaged-bigip.local'
ntp_servers:
- '172.27.1.1'
- '172.27.1.2'
dns_servers:
- '8.8.8.8'
- '4.4.4.4'
dns_search_domains:
- 'local'
- 'localhost'
ip_version: 4
bind_servers:
- '192.168.2.1'
- '192.168.2.2'
vlan_information:
- name: 'External'
tag: '10'
interface: '1.1'
- name: 'Internal'
tag: '11'
interface: '1.2'
selfip_information:
- name: 'External-SelfIP'
address: '10.168.68.5'
netmask: '255.255.255.0'
vlan: 'External'
allow_service: 'default'
- name: 'Internal-SelfIP'
address: '192.168.68.5'
netmask: '255.255.255.0'
vlan: 'Internal'
allow_service: 'default'
module_provisioning:
- name: 'asm'
level: 'nominal'
3) The playbook
- name: Onboarding BIG-IP
hosts: bigip
gather_facts: false
vars_files:
- var-onboard-network_file.yml
tasks:
- name: Configure NTP server on BIG-IP
bigip_device_ntp:
server: "{{ inventory_hostname }}"
user: "{{ username }}"
password: "{{ password }}"
ntp_servers: "{{ ntp_servers }}"
validate_certs: False
delegate_to: localhost
- name: Configure BIG-IP hostname
bigip_hostname:
server: "{{ inventory_hostname }}"
user: "{{ username }}"
password: "{{ password }}"
validate_certs: False
hostname: "{{ hostname }}"
delegate_to: localhost
- name: Manage SSHD setting on BIG-IP
bigip_device_sshd:
server: "{{ inventory_hostname }}"
user: "{{ username }}"
password: "{{ password }}"
banner: "enabled"
banner_text: " {{ banner_text }}"
validate_certs: False
delegate_to: localhost
- name: Manage BIG-IP DNS settings
bigip_device_dns:
server: "{{ inventory_hostname }}"
user: "{{ username }}"
password: "{{ password }}"
name_servers: "{{ dns_servers }}"
search: "{{ dns_search_domains }}"
forwarders: "{{ bind_servers }}"
ip_version: "{{ ip_version }}"
validate_certs: False
delegate_to: localhost
- name: Provision BIG-IP with appropriate modules
bigip_provision:
server: "{{ inventory_hostname }}"
user: "{{ username }}"
password: "{{ password }}"
validate_certs: False
module: "{{ item.name }}"
level: "{{ item.level }}"
with_items: "{{ module_provisioning }}"
tags: provision
delegate_to: localhost
- name: Configure VLANs on the BIG-IP
bigip_vlan:
server: "{{ inventory_hostname }}"
user: "{{ username }}"
password: "{{ password }}"
validate_certs: False
name: "{{ item.name }}"
tag: "{{ item.tag }}"
tagged_interface: "{{ item.interface }}"
with_items: "{{ vlan_information }}"
delegate_to: localhost
- name: Configure SELF-IPs on the BIG-IP
bigip_selfip:
server: "{{ inventory_hostname }}"
user: "{{ username }}"
password: "{{ password }}"
validate_certs: False
name: "{{ item.name }}"
address: "{{ item.address }}"
netmask: "{{ item.netmask }}"
vlan: "{{ item.vlan }}"
allow_service: "{{item.allow_service}}"
with_items: "{{ selfip_information }}"
delegate_to: localhost