Using the F5OS collectionΒΆ
This example demonstrates using the F5OS collection to configure and deploy images in the VELOS platform.
Specifically:
- Create a partition
- Change a password on a partition
- Configure the partition
Example velos_example.yaml
---
- name: Create Partition
connection: httpapi
hosts: velos-controller[0]
collections:
- f5networks.f5os
any_errors_fatal: true
vars:
ansible_user: "admin"
ansible_httpapi_password: "password" # VELOS Controller Password
ansible_network_os: "f5networks.f5os.f5os"
ansible_httpapi_use_ssl: true
ansible_httpapi_use_proxy: false
ansible_httpapi_validate_certs: "no"
ansible_httpapi_port: 8888
ansible_command_timeout: 1800
persistent_log_messages: true
partition_name: DemoPartition
tasks:
- name: Create DEMO partition in running state
velos_partition:
name: "{{ partition_name }}"
os_version: 1.3.1-5968
ipv4_mgmt_address: 10.144.140.116/24
ipv4_mgmt_gateway: 10.144.140.254
slots: [2]
state: enabled
- name: Wait a maximum of 900 seconds for partition to reach running state.
velos_partition_wait:
name: "{{ partition_name }}"
state: running
timeout: 900
- name: Change Password on Partition
connection: httpapi
hosts: velos-partition[0]
collections:
- f5networks.f5os
any_errors_fatal: true
vars:
ansible_user: "admin"
ansible_httpapi_password: "admin" # This is the default password for admin user on a partition
ansible_network_os: "f5networks.f5os.f5os"
ansible_httpapi_use_ssl: true
ansible_httpapi_use_proxy: false
ansible_httpapi_validate_certs: "no"
ansible_httpapi_port: 8888
ansible_command_timeout: 1800
persistent_log_messages: true
tasks:
- name: pause for 30 seconds
pause:
seconds: 30
- name: Change password on Demo partition
velos_partition_change_password:
user_name: "admin"
old_password: "old_password" # for the very first time this will probably be admin
new_password: "new_password"
- name: Configure Partition
connection: httpapi
hosts: velos-partition[0]
collections:
- f5networks.f5os
any_errors_fatal: true
tasks:
- name: Attach Trunk-vlans to LAG to interface
f5os_lag:
name: "Olive"
trunk_vlans: [1,2]
state: present
config_members:
- '2/1.0'
- name: Create multiple vlans on Demo partition
f5os_vlan:
name: "{{ item.name }}"
vlan_id: "{{ item.id }}"
with_items:
- { name: 'Arista', id: '3' }
- { name: 'Candor', id: '4' }
- name: Associate VLANS with Interfaces
f5os_interface:
name: "2/2.0"
trunk_vlans: [1,3]
- name: Import tenant image onto the Velos partition
f5os_tenant_image:
image_name: "{{ image_name_1 }}"
remote_host: "{{ server }}"
remote_user: "{{ server_user }}"
remote_password: "{{ server_pass }}"
remote_path: "{{ image_path }}"
protocol: "https"
state: import
- name: Check the status of the image import
f5os_tenant_image:
image_name: "{{ image_name_1 }}"
timeout: 600
state: present
- name: Create DEMO tenant in running state
f5os_tenant:
name: "{{ tenant_1 }}"
image_name: "{{ image_name_1 }}"
nodes: "{{ nodes_2 }}"
mgmt_ip: "{{ mgmt_ip_2 }}"
mgmt_prefix: 24
mgmt_gateway: "{{ mgmt_gw }}"
vlans: "{{ vlans_1 }}"
cpu_cores: "{{ cpu_2 }}"
memory: "{{ mem_2 }}"
running_state: "{{ state_2 }}"
- name: Wait a maximum of 600 seconds for tenant to reach running state.
f5os_tenant_wait:
name: "{{ tenant_1 }}"
state: "{{ state_2 }}"
timeout: 600
The vars.yaml shows the configuration options we use in the velos_example.yaml file.
---
tenant_1: tenant1
image_name_1: "BIGIP-15.1.5-0.0.10.ALL-F5OS.qcow2.zip.bundle"
nodes_2: 2
mgmt_ip_2: <-IP-ADDR->
mgmt_gw: <-IP-ADDR->
state_2: deployed
mem_2: 12096
cpu_2: 2
vlans_1: [1]
image_path: "/v15.1.5/daily/build10.0/VM/"
server_user: "root"
server_pass: "XXXXXXXXX"
server: "example.f5velos.com"
...
See also
- Learn more about Ansible collections.
- F5OS modules Ansible collection