-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
\"bash\" unexpected argument #2452
Comments
Hi @akashombase7, I tested the following with success with ansible-core version 2.15 and 2.17 so I think there is an issue in your environment:
$ ansible-playbook -i hosts save.yml
PLAY [all] **********************************************************************************************************************************************************************************
TASK [Gathering Facts] **********************************************************************************************************************************************************************
ok: [10.1.1.9]
TASK [Save the running configuration of the BIG-IP] *****************************************************************************************************************************************
changed: [10.1.1.9 -> localhost]
TASK [Collect BIG-IP information] ***********************************************************************************************************************************************************
ok: [10.1.1.9 -> localhost]
TASK [run show version on remote devices] ***************************************************************************************************************************************************
ok: [10.1.1.9 -> localhost]
PLAY RECAP **********************************************************************************************************************************************************************************
10.1.1.9 : ok=4 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 |
![Image](https://github.com/user-attachments/assets/e2809a5b-8f47-4599-807e-1285fdc645bb)
Hello Patrick,
I hope you are doing well.
I’m currently facing an issue and would appreciate your help. I am using
Ansible version 2.17, and I have the required F5 collection installed. My
playbook is configured with connection: local and validate_certs: no.
However, when I try to access the following URL using cURL:
curl -k https://hostnameOfF5device/mgmt/tm/sys/host
It returns an "Unauthorized" access error, which might be the cause of the
issue.
Could you help me identify the exact problem and suggest a solution?
Note: Using the same user, I am able to SSH and execute some commands like show sys version. However, it seems I don't have access via the API, so this might be the issue.
Thank you in advance.
Regards,
Akash Ombase
…On Mon, Jan 20, 2025 at 3:23 PM Patrick ***@***.***> wrote:
Hi @akashombase7 <https://github.com/akashombase7>,
I tested the following with success with ansible-core version 2.15 and
2.17 so I think there is an issue in your environment:
- hosts: all
collections:
- f5networks.f5_modules
connection: local
tasks:
- name: Save the running configuration of the BIG-IP
bigip_config:
save: true
provider:
server: 10.1.1.9
user: "admin"
password: "mypassword"
server_port: 443
validate_certs: no
no_f5_teem: yes
delegate_to: localhost
- name: Collect BIG-IP information
bigip_device_info:
gather_subset:
- all
provider:
server: 10.1.1.9
user: "admin"
password: "mypassword"
server_port: 443
validate_certs: no
no_f5_teem: yes
delegate_to: localhost
- name: run show version on remote devices
bigip_command:
commands: show sys version
provider:
server: 10.1.1.9
user: "admin"
password: "mypassword"
server_port: 443
validate_certs: no
no_f5_teem: yes
delegate_to: localhost
$ ansible-playbook -i hosts save.yml
PLAY [all] **********************************************************************************************************************************************************************************
TASK [Gathering Facts] **********************************************************************************************************************************************************************ok: [10.1.1.9]
TASK [Save the running configuration of the BIG-IP] *****************************************************************************************************************************************changed: [10.1.1.9 -> localhost]
TASK [Collect BIG-IP information] ***********************************************************************************************************************************************************ok: [10.1.1.9 -> localhost]
TASK [run show version on remote devices] ***************************************************************************************************************************************************ok: [10.1.1.9 -> localhost]
PLAY RECAP **********************************************************************************************************************************************************************************10.1.1.9 : ok=4 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
—
Reply to this email directly, view it on GitHub
<#2452 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALDB7QAHELT5MLQVZ73MM732LTBRRAVCNFSM6AAAAABVPR4SF2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMBRHEZTEMRVGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hi @akashombase7, First are you sending credentials via option "-u" on curl command? Also /host in the end doesn't seem available. |
Hello @pgouband thank for you reply. I have an idea why it's saying 'bash unexpected argument.' It seems some devices doesn't API connections from Ansible, and there is no bash access on some devices. However, could you check this new issue: why is device1 failing on the task 'run show version on remote devices,' while device2 is working fine on that task? Device1: Sys::Version Device2: Sys::Version task:
Output: TASK [run show version on remote devices] ************************************************************************************ |
Hi @akashombase7, I suggest you try to reach API endpoint of each device using curl or Postman: Ansible module is working with one device so the issue is probably in your environment. |
hello @pgouband When running curl on Device1, we received an 'Authorization Failed' error. However, the device is still getting a response from the API. Could above module failure issue be due to access permissions or anything else? fyi both device has admin role to my service account. |
Hi @akashombase7, If curl command output is Authorization failed that means an error in credentials but it's not an ansible issue so open a ticket via https://my.f5.com/manage/s/ |
ansible [core 2.16.3]
config file = /home/admin/ansible_automation/ansible.cfg
configured module search path = ['/home/admin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.12/site-packages/ansible
ansible collection location = /home/admin/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.12.6 (main, Sep 23 2024, 09:58:19) [GCC 8.5.0 20210514 (Red Hat 8.5.0-22)] (/usr/bin/python3.12)
jinja version = 3.1.2
libyaml = True
f5-icontrol-rest==1.3.13
f5-sdk==3.0.21
ansible playbook:
hosts: f5 #localhost #f5
gather_facts: False
connection: local
ignore_errors: yes
collections:
f5networks.f5_modules
vars:
tasks:
name: Save the running configuration of the BIG-IP
bigip_config:
save: true
provider:
server:
password:
user:
validate_certs: false
delegate_to: localhost
name: Fetch F5 device configuration data
bigip_device_info:
gather_subset:
- all
provider:
server:
user:
password:
validate_certs: false
transport: rest
register: f5_config
ignore_errors: yes
delegate_to: localhost
name: run show version on remote devices
bigip_command:
commands: show sys version
provider: # "{{ Creds }}"
server:
user:
password:
validate_certs: false
server_port: 443
transport: rest
register: result
delegate_to: localhost
Error:
nUsing /home/admin/ansible_automation/ansible.cfg as config file
PLAY [Fetch config data] *********************************************************************************************************
TASK [Save the running configuration of the BIG-IP] ******************************************************************************
fatal: [xxxxxxxxxxx -> localhost]: FAILED! => {"changed": false, "msg": "b'{"code":400,"message":"\\"bash\\" unexpected argument","errorStack":[],"apiError":26214401}'"}
...ignoring
TASK [Fetch F5 device configuration data] ****************************************************************************************
fatal: [xxxxxxxxxxxxxx -> localhost]: FAILED! => {"changed": false, "msg": "b'{"code":401,"message":"Authorization failed: user=https://localhost/mgmt/cm/system/authn/providers/tmos/1f44a60e-11a7-3c51-a49f-82983026b41b/users/7dcfeb41-05eb-3551-ad54-376d915052e7 resource=/mgmt/shared/iapp/global-installed-packages verb=GET uri:http://localhost:8100/mgmt/shared/iapp/global-installed-packages referrer:10.163.40.105 sender:10.163.40.105","referer":"10.163.40.105","restOperationId":151014421,"kind":":resterrorresponse"}'"}
...ignoring
TASK [run show version on remote devices] ****************************************************************************************
fatal: [xxxxxxxxxxxxx -> localhost]: FAILED! => {"changed": false, "msg": ""bash" unexpected argument"}
The text was updated successfully, but these errors were encountered: