Forum Discussion
Ansible Deployment of Virtual Server With Profiles
Here is one way to do it with a profiles variable and string concatenation:
---
- name: Create objects on a BIG-IP
hosts: bigip14-1
gather_facts: False
connection: local
vars:
provider:
password: "{{ bigip_password }}"
server: "{{ ansible_host }}"
user: "{{ bigip_username }}"
validate_certs: False
profiles: "tcp-wan-optimized,http,wan-optimized-compression"
tasks:
- name: Create a virtual server
bigip_virtual_server:
provider: "{{ provider }}"
name: "{{ item.name }}"
destination: "{{ item.destination }}"
port: "{{ item.port }}"
snat: "Automap"
all_profiles: "{{ item.profiles }}"
pool: "example_pool"
with_items:
- { name: "server_port_80",
port: 80,
destination: 10.150.1.1,
profiles: "{{ profiles }}"
}
- { name: "server_port_443",
port: 443,
destination: 10.150.1.1,
profiles: "{{ profiles + ',example_client_ssl' }}"
}
notify:
- Save the running configuration to disk
handlers:
- name: Save the running configuration to disk
bigip_config:
save: yes
provider: "{{ provider }}"
Also this Q&A was the basis for a new AskF5 article:
K42420223: Using F5 Modules for Ansible to create HTTP and HTTPS virtual servers in a single task
If you have any feedback, you can add that to the bottom of the article.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com