Skip to content
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

Open
akashombase7 opened this issue Jan 20, 2025 · 3 comments
Open

\"bash\" unexpected argument #2452

akashombase7 opened this issue Jan 20, 2025 · 3 comments
Labels
awaiting-user-action issue awaiting user's response and/or requested action

Comments

@akashombase7
Copy link

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:

  • name: Fetch config data
    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"}

@akashombase7 akashombase7 added bug Issues that are related to bugs in the Ansible modules untriaged issue that needs an initial response from the developers labels Jan 20, 2025
@pgouband
Copy link
Contributor

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:

- 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   

@pgouband pgouband added awaiting-user-action issue awaiting user's response and/or requested action and removed bug Issues that are related to bugs in the Ansible modules untriaged issue that needs an initial response from the developers labels Jan 20, 2025
@akashombase7
Copy link
Author

akashombase7 commented Jan 20, 2025 via email

@pgouband
Copy link
Contributor

Hi @akashombase7,

First are you sending credentials via option "-u" on curl command?
So your command should look like:
curl -u admin:mypassword -k https://BIG-IPDeviceIP/mgmt/tm/sys/host-info

Also /host in the end doesn't seem available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-user-action issue awaiting user's response and/or requested action
Projects
None yet
Development

No branches or pull requests

2 participants