https://github.com/selcukcosan/f5-bigip_as3_declaration
F5 BIG-IP AS3 Declaration to make changes via Ansible
https://github.com/selcukcosan/f5-bigip_as3_declaration
ansible ansible-playbook as3 as3yaml declarative f5 f5-bigip f5networks
Last synced: 12 months ago
JSON representation
F5 BIG-IP AS3 Declaration to make changes via Ansible
- Host: GitHub
- URL: https://github.com/selcukcosan/f5-bigip_as3_declaration
- Owner: selcukcosan
- Created: 2024-06-19T10:18:55.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-19T13:05:31.000Z (about 2 years ago)
- Last Synced: 2025-01-11T21:36:13.113Z (over 1 year ago)
- Topics: ansible, ansible-playbook, as3, as3yaml, declarative, f5, f5-bigip, f5networks
- Homepage:
- Size: 29.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# f5-bigip_as3_declaration
This Ansible script writes AS3 Declaration json file into F5 BIG-IP devices via REST. The script uses the official f5networks.f5_bigip Ansible modules on [https://galaxy.ansible.com/ui/repo/published/f5networks/f5_modules/](https://galaxy.ansible.com/ui/repo/published/f5networks/f5_bigip/)
The inventory yaml format is simple as below.
```yml
---
all:
children:
all_f5:
hosts:
bigip1:
inventory_network_os: f5.bigip
inventory_host: 192.168.1.245
inventory_port: 443
inventory_user: admin
inventory_pass: password
bigip2:
inventory_network_os: f5.bigip
inventory_host: 192.168.1.246
inventory_port: 443
inventory_user: admin
inventory_pass: password
bigip11:
inventory_network_os: f5.bigip
inventory_host: 192.168.1.231
inventory_port: 443
inventory_user: admin
inventory_pass: password
```
## Prerequisite
F5 Ansible Declarative Modules must be installed before running the script.
```bash
ansible-galaxy collection install f5networks.f5_bigip==3.2.2
```
## Usage:
```bash
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -vvvv --vault-password-file vault_pass.yaml -i inventory-vault.yaml bigip11_as3_basics.yaml --extra-vars="bigip=bigip11"
```
## Files
- bigip11_as3_basics.yaml >> Ansible script file
- declarations/bigip11_as3.json >> AS3 Declaration File
- vault_pass.yaml >> Inventory vault password information
- inventory-vault.yaml >> Inventory vault file encrypted by "Inventory vault password"
## Variables
- `bigip` variable shows which F5 device will be connected.The value can be "bigip1", "bigip11" or "all_f5" as per the example inventory file above.
## Deploying AS3 Changes in bigip11_as3_basics.yaml
- name: 01-Deploy AS3 Virtual Servers >> this task loads declarations/bigip11_as3.json file and create Partition, Folder, Virtual Servers, Pools and nodes etc.
```yml
---
- name: PLAY - AS3
hosts: "{{ bigip }}"
connection: httpapi
vars:
ansible_host: "{{ inventory_host }}"
ansible_httpapi_port: "{{ inventory_port }}"
ansible_user: "{{ inventory_user }}"
ansible_httpapi_password: "{{ inventory_pass }}"
ansible_network_os: f5networks.f5_bigip.bigip
ansible_httpapi_use_ssl: yes
ansible_httpapi_validate_certs: no
ansible_command_timeout: 1800
ansible_httpapi_use_proxy: false
f5_telemetry: false
gather_facts: false
tasks:
- name: 01-Deploy AS3 Virtual Servers
f5networks.f5_bigip.bigip_as3_deploy:
content: "{{ lookup('file', 'declarations/bigip11_as3.json') }}"
#tenant: "Partition-1"
state: present
timeout: 300
```
## Removing AS3 Changes in bigip11_as3_basics.yaml
If you want to remove the declaration from the F5, change the task as below and run it again. This time all configurations related with this AS3 will be deleted.
```yml
tasks:
- name: 01-Deploy AS3 Virtual Servers
f5networks.f5_bigip.bigip_as3_deploy:
content: "{{ lookup('file', 'declarations/bigip11_as3.json') }}"
tenant: "Partition-1"
state: absent
timeout: 300
```