Forum Discussion

vkrishna91's avatar
Icon for Nimbostratus rankNimbostratus
Oct 10, 2022

Unable to use ansible playbook to upgrade BIGIP - VE to from

Hi Team,

I'm trying to utilize ansible playbook to automate our F5 upgrade.
Current version:
New version:

I'm trying to utilize a bash script to dynamically identify the partition, create the partition if not available and install image and reboot. 
It looks like the bash script doesn't seem to work via ansible but works directly on the F5. 

bash script:

disk=$(/bin/tmsh show sys sof status | awk '/.D[1-9]/{print substr($1,1,4)}' | head -n1)

for vnumber in $(/bin/tmsh show sys sof status | grep complete)

vnumber=${vnumber// /}

if (( vnumber > maxvnumber )); then

volume=$disk$((maxvnumber + 3))
echo -n $volume

I have tried to use tmsh and /bin/tmsh - both seems to fail:
 "vol": {
        "changed": true,
        "failed": false,
        "rc": 0,
        "stderr": "/home/user/.ansible/tmp/ansible-local-61301srclvb76/ansible-tmp-1665415837.2614715-24184-40420301589164/ line 4: tmsh: command not found\n/home/user/.ansible/tmp/ansible-local-61301srclvb76/ansible-tmp-1665415837.2614715-24184-40420301589164/ line 16: tmsh: command not found\n",
        "stderr_lines": [
            "/home/user/.ansible/tmp/ansible-local-61301srclvb76/ansible-tmp-1665415837.2614715-24184-40420301589164/ line 4: tmsh: command not found",
            "/home/user/.ansible/tmp/ansible-local-61301srclvb76/ansible-tmp-1665415837.2614715-24184-40420301589164/ line 16: tmsh: command not found"
        "stdout": "3",
        "stdout_lines": [

I have tried to use the root account to login and still seem to throw the same error:

- name: Upload image
provider: "{{ f5_provider }}"
image: "{{ new_image_dir }}/{{ new_image }}"

- name: Get available volume number to use
register: vol
- debug:
var: vol

- name: Install Image and reboot
provider: "{{ f5_provider }}"
image: "{{ new_image }}"
state: activated
volume: "HD1.{{ vol.stdout }}"
async: 45
poll: 0
any_errors_fatal: true

when: wants_upgrade

- name: Group 1 Upgrades

- ansible.builtin.import_tasks: checks.yaml
stage: "pre"
when: check_virts or check_pools or check_ver

- name: Pausing execution to give device time to reboot (first time)
minutes: 10
when: wants_upgrade

- name: wait for ssh to come up
connect_timeout: 120
sleep: 5
delay: 5
timeout: 300
when: wants_upgrade

Could someone assist us to resolve the issue?
We have close to 200 F5s, would not prefer to upgrade them manually. 

  • Just for anyone else who read this, the issue was a local execution 


      connection: local


    this causes the system to SSH to itself and there is no tmsh on the ansible host.   removing this line and then adding delegate_to: localhost when calling a BIG-IP module solved this issue.  it allows the playbook to remote execute the code via SSH


    After removing it and fixing a few code tweaks we were able to launch the code 

29 Replies