Forum Discussion
Unable to use ansible playbook to upgrade BIGIP - VE to 15.1.6.1 from 15.1.5.1
- Oct 27, 2022
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
Hey vkrishna91
So i just tested out the code in a 17.x box and seemed to work ill have to deploy out a 15.1.x like you had to confirm that its still working but this is what i have.
---
- name: Upgrade BIG-IP software
hosts: bigip_hosts
gather_facts: False
vars_files:
- vars/vars.yml
vars:
provider:
password: "{{ f5_pass }}"
server: "{{ ansible_host }}"
user: "{{ f5_user }}"
validate_certs: False
tasks:
- name: Get available volume number to use
ansible.builtin.script: "{{ playbook_dir }}/files/cal_vol.sh"
register: vol
- debug:
var: vol
Directory Layout
[root@DS9 test]# ls -AlFh
total 8.0K
-rw-r--r--. 1 root root 262 Oct 11 14:35 ansible.cfg
drwxr-xr-x. 2 root root 24 Oct 11 14:44 files/
drwxr-xr-x. 2 root root 27 Oct 11 14:45 inventory/
-rw-r--r--. 1 root root 435 Oct 11 14:45 upgrade.yaml
drwxr-xr-x. 2 root root 22 Oct 11 14:39 vars/
[root@DS9 test]# ls -AlFh files/
total 4.0K
-rw-r--r--. 1 root root 382 Oct 11 14:43 cal_vol.sh
[root@DS9 test]# cat inventory/inventory.yml
[bigip_hosts]
test-bip ansible_host=10.192.1.10 ansible_user=root ansible_password=xxxxxxxxx
[root@DS9 test]# cat vars/vars.yml
---
###F5_ENV
#BIG-IP
f5_user: admin
f5_pass: "xxxxxxxxx"
f5_admin_port: 443
[root@DS9 test]# cat files/cal_vol.sh
#!/bin/bash
OLDIFS="$IFS"
IFS=$'\n'
disk=$(/bin/tmsh show sys sof status | awk '/.D[1-9]/{print substr($1,1,4)}' | head -n1)
maxvnumber=0
for vnumber in $(/bin/tmsh show sys sof status | grep complete)
do
vnumber=${vnumber:4:2}
vnumber=${vnumber// /}
if (( vnumber > maxvnumber )); then
maxvnumber=$vnumber
fi
done
volume=$disk$((maxvnumber + 3))
echo -n $volume
IFS="$OLDIFS"
[root@DS9 test]# cat ansible.cfg
[defaults]
host_key_checking = False
library = library:/usr/share/ansible/plugins/modules
module_utils = module_utils:/usr/share/ansible/plugins/modules/ansible-for-nsxt/module_utils
ansible_python_interpreter=/usr/bin/python3
inventory = inventory/inventory.yml
Execution of the Code
[root@DS9 test]# ansible-playbook upgrade.yaml
PLAY [Upgrade BIG-IP software] ***************************************************************************************************************************************************
TASK [Get available volume number to use] ****************************************************************************************************************************************
changed: [test-bip]
TASK [debug] *********************************************************************************************************************************************************************
ok: [test-bip] => {
"vol": {
"changed": true,
"failed": false,
"rc": 0,
"stderr": "Shared connection to 10.192.1.10 closed.\r\n",
"stderr_lines": [
"Shared connection to 10.192.1.10 closed."
],
"stdout": "HD1.5",
"stdout_lines": [
"HD1.5"
]
}
}
PLAY RECAP ***********************************************************************************************************************************************************************
test-bip : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Here is my ansible build info
[root@DS9 test]# ansible --vers
ansible [core 2.12.4]
config file = /git/test/ansible.cfg
configured module search path = ['/git/test/library', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.9.6 (default, Nov 9 2021, 13:31:27) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
jinja version = 3.1.1
libyaml = True
in your code you wont need the HD.{{vol.stdout}} you can just use {{vol.stdout}}
Let me try a 15.x build but i dont think there would be a difference...
- vkrishna91Oct 11, 2022Nimbostratus
Hi Matt_Mabis,
Thank you for testing. Sure, I will also compare the configuration with my playbook and see if something stands out.
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