Forum Discussion

Robert_Stenger_'s avatar
Robert_Stenger_
Icon for Nimbostratus rankNimbostratus
Oct 19, 2018

Problems with Ansible connecting to i4600

Hello, I am new to F5 and to Ansible. I am trying to use Ansible to do a first time configuration of an i4600 in our lab. I can connect to the Big-IP via SSH and GUI, my playbook gathers facts but still fails to connect to devices to run modules.

 

Code

[user.name@sl7jump2 playbooks]$ ansible-playbook -i hosts onboard2.yaml

PLAY [Onboard Playbook] ************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************
ok: [10.12.118.173]
ok: [10.12.118.174]

TASK [Manage SSHD setting on BIG-IP] ***********************************************************************************************
[DEPRECATION WARNING]: Param 'server' is deprecated. See the module docs for more information. This feature will be removed in 
version 2.9. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
[DEPRECATION WARNING]: Param 'user' is deprecated. See the module docs for more information. This feature will be removed in 
version 2.9. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
[DEPRECATION WARNING]: Param 'password' is deprecated. See the module docs for more information. This feature will be removed in 
version 2.9. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
[DEPRECATION WARNING]: Param 'validate_certs' is deprecated. See the module docs for more information. This feature will be removed
 in version 2.9. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
fatal: [10.12.118.173 -> localhost]: FAILED! => {"changed": false, "msg": "Unable to connect to ['10.12.118.173', '10.12.118.174'] on port 443. The reported error was \"HTTPSConnectionPool(host=\"'10.12.118.173',%20'10.12.118.174'\", port=443): Max retries exceeded with url: /mgmt/shared/authn/login (Caused by ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 503 Service Unavailable',)))\"."}
fatal: [10.12.118.174 -> localhost]: FAILED! => {"changed": false, "msg": "Unable to connect to ['10.12.118.173', '10.12.118.174'] on port 443. The reported error was \"HTTPSConnectionPool(host=\"'10.12.118.173',%20'10.12.118.174'\", port=443): Max retries exceeded with url: /mgmt/shared/authn/login (Caused by ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 503 Service Unavailable',)))\"."}
        to retry, use: --limit @/home/userdir/ansible/playbooks/onboard2.retry

PLAY RECAP *************************************************************************************************************************
10.12.118.173              : ok=1    changed=0    unreachable=0    failed=1   
10.12.118.174              : ok=1    changed=0    unreachable=0    failed=1   
  • My playbook:

    ---
    
    - name: Onboard Playbook  
      hosts: i4600
       gather_facts: false
      vars_files:
          - /home//ansible/playbooks/bigip_vars
      connection: local
    
      tasks:
    
        - name: Manage SSHD setting on BIG-IP
          bigip_device_sshd:
            user: "{{ username }}"
            password: "{{ password }}"
            allow: all
            login: enabled
            banner: "enabled"
            banner_text: " {{ banner_text }}"
            server: "{{ inventory_hostname }}"
            validate_certs: no
          delegate_to: localhost
    
        - name: Configure NTP server on BIG-IP
          bigip_device_ntp:
            server: "{{ inventory_hostname }}"
            user: root
            password: default
            ntp_servers: "{{ ntp_servers }}"
            validate_certs: False
          delegate_to: localhost
    
        - name: Configure BIG-IP hostname
          bigip_hostname:
            user: "{{ username }}"
            password: "{{ password }}"
            validate_certs: False
            hostname: "{{ hostname }}"
          delegate_to: localhost
    
        - name: Manage BIG-IP DNS settings
          bigip_device_dns:
            user: "{{ username }}"
            password: "{{ password }}"
            name_servers: "{{ dns_servers }}"
            search: "{{ dns_search_domains }}"
            ip_version: "{{ ip_version }}"
            validate_certs: False
          delegate_to: localhost
    

    My bigip_vars file:

    username: 
     - 'root'
    
    password: 
     - 'default'
    
    banner_text: "This computer system and associated networks are intended for the business use of  and its authorized users. The Company's computers and proprietary data and information stored on them remain at all times the property of .  Subject to applicable laws and regulations, users have no right to privacy as to any information transmitted or stored in, by or through any portion of this system."
    
    ntp_servers:
     - '10.12.132.2'
     - '10.12.132.3'
    
    dns_servers:
     - '10.12.59.40'
     - '10.12.59.41'
    
    dns_search_domains:
     - 'local'
     - 'localhost'
    
    ip_version: 4
    
    hostname:
     - 'fna-lb01_ansible'
     - 'fna-lb02_ansible'
    
    item.name: ltm
    
    inventory_hostname:
     - '10.12.118.173'
     - '10.12.118.174'
    

    My Host file:

      LAB Big IP Host file 
    
    
    [i2600]
    10.12.118.171
    10.12.118.172
    
    [i4600]
    10.12.118.173
    10.12.118.174
    
  • I can't see anything glaringly wrong with your playbook, does it work for hosts [i2600]? It does however look like a proxy issue, do you have one configured? It it possible to by-pass the proxy?

     

  • madhu's avatar
    madhu
    Icon for Nimbostratus rankNimbostratus

    Hello Robert - Were you able to figure this out? i have the same issue but with different end devices.