Forum Discussion

Ankur_Mathur's avatar
Ankur_Mathur
Icon for Nimbostratus rankNimbostratus
Oct 23, 2018

Issue using Ansible BIGIP_UCS module

I am trying to upgrade the software image on a BigIP VCMP guest using ansible. While I am able to perform almost all the tasks, the installation of UCS file(module used: bigip_ucs) is not getting complete. The task gets stuck and never proceeds further. However, on checking the system the installation seems to have completed with the system waiting for sync(next task in playbook). Can someone suggest how to proceed further? Following is the sequence of tasks that I am doing.

 

  1. Fetch the master key from vm (Module: bigip_command)
  2. Set the hostname (Module: bigip_hostname)
  3. Download a new UCS file (Module: bigip_ucs_fetch)
  4. Shut down current Guest (Module: bigip_vcmp_guest)
  5. Delete the vcmp guest & delete the virtual disk (Module: bigip_vcmp_guest)
  6. Create a new guest (Module: bigip_vcmp_guest) Power Up new guest (Module: bigip_vcmp_guest)
  7. Set the hostname (Module: bigip_sys_global)
  8. Login and Disable initial config (Module: bigip_sys_global)
  9. Save the running configuration of the BIG-IP (Module: bigip_config)
  10. Provision modules (Module: bigip_provision)
  11. Reinstate the master key (Module: bigip_command)
  12. Upload & Install the UCS file (Module: bigip_ucs) ---- This is where the playbook hangs
  13. Sync Group (Module: bigip_configsync_action)
  14. Remove the uploaded UCS file (Module: bigip_ucs)

4 Replies

  • Following is my playbook:

    (f5_poc) -bash-4.2$ cat f5_upgrade.yaml
    • hosts: f5 connection: local gather_facts: False vars_files:
      • creds.yml
      • "{{upgrade_info}}"

    tasks:

      Configure User
      - name: Configure User
        tags:
           - run
        set_fact: 
           provider:
              user: "{{username}}"
              password: "{{password}}"
              validate_certs: no
           admin_user:
              user: admin 
              password: admin
              timeout: 360
              validate_certs: no
        delegate_to: localhost 
    
      Fetch the master key from the vm
      - name: Fetch the master key from vm
        tags: 
           - run
        bigip_command:
           provider: "{{provider}}"
           server: "{{ ip_addr }}"
           commands: shell f5mku -K
        register: cmd_output
        delegate_to: localhost
    
      - name : Setting the master key
        tags:
           - run
        set_fact: 
           master_key :  "{{ cmd_output.stdout | regex_replace('^..|..$', '') }}" 
    
       Download the software image on host
      - name: Upload the software image on host
        tags:
           - dont 
        bigip_software_image:
           image: /tmp/BIGIP-12.1.3.7-0.0.2.iso
           provider: "{{provider}}"
           server: 172.18.224.4 
           force: yes
           state: present  
           server_port: 443
           transport: cli
           ssh_keyfile: /afs/athena.unimelb.edu.au/user/a/ankurm/.ssh/known_hosts
        delegate_to: localhost 
    
       Set the hostname
      - name: Set the hostname 
        tags:
          - run
        bigip_hostname:
           provider: "{{provider}}"
           server: "{{ip_addr}}"
           hostname: "{{vm_to_upgrade}}.unimelb.net.au"
           validate_certs: no
        delegate_to: localhost     
    
       Create the UCS file to restore at the end
      - name: Download a new UCS file
        tags:
           - run
        bigip_ucs_fetch:
           provider: "{{provider}}"
           server: "{{server_name}}" 
           src: "{{ vm_to_upgrade }}-init.ucs"
           dest: "/tmp/{{ vm_to_upgrade }}.ucs"
        delegate_to: localhost
    
       Shut down current Guest: 
       modify vcmp guest lb1-266-1-dev state configured
      - name: Shut down current Guest
        tags:
          - run
        bigip_vcmp_guest:
           provider: "{{provider}}"
           server: "{{server_name}}" 
           name: "{{vm_to_upgrade}}" 
           state: disabled 
           mgmt_address: "{{ ip_addr }}/{{ nw_bits }}"
           mgmt_network: bridged
           mgmt_route: "{{gateway}}"
        delegate_to: localhost
    
       Delete Guest:
       delete vcmp guest lb3-396-2-dev
      - name: Delete the vcmp guest & delete the virtual disk
        tags:
           - run
        bigip_vcmp_guest:
           provider: "{{provider}}"
           server: "{{server_name}}" 
           name: "{{vm_to_upgrade}}"
           state: absent 
           delete_virtual_disk: yes
        delegate_to: localhost
    
        Create new Guest: 
      - name: Create a new guest 
        tags:
          - run
        bigip_vcmp_guest:
           provider: "{{provider}}"
           server: "{{server_name}}"
           name: "{{vm_to_upgrade}}" 
           state: configured 
           mgmt_address: "{{ ip_addr }}/{{ nw_bits }}"
           mgmt_network: bridged
           mgmt_route: "{{gateway}}" 
           allowed_slots: "{{allowed_slots}}" 
           number_of_slots: "{{number_of_slots}}"
           min_number_of_slots: "{{min_number_of_slots}}"
           cores_per_slot: "{{cores_per_slot}}"
           initial_image: "{{sw_image}}"
           vlans: "{{vlans}}"
        delegate_to: localhost
    
        Power up the Guest: 
      - name: Power Up new guest 
        tags:
          - run
        bigip_vcmp_guest:
           provider: "{{provider}}"
           server: "{{server_name}}" 
           name: "{{vm_to_upgrade}}"
           state: present 
           mgmt_address: "{{ ip_addr }}/{{ nw_bits }}"
           mgmt_network: bridged
           mgmt_route: "{{gateway}}"
        delegate_to: localhost
    
       Set the hostname
      - name: Set the hostname 
        tags:
          - run
        bigip_hostname:
           provider: "{{admin_user}}"
           server: "{{ip_addr}}"
           hostname: "{{vm_to_upgrade}}.unimelb.net.au"
        delegate_to: localhost     
    
       Disable Initial Setup of the guest
      - name: Login and Disable initial config
        tags:
          - run
        bigip_sys_global:
           provider: "{{admin_user}}"
           gui_setup: no
           server: "{{ip_addr}}"
        delegate_to: localhost
    
       Save running Config
      - name: Save the running configuration of the BIG-IP
        tags:
          - run
        bigip_config:
           provider: "{{admin_user}}"
           save: yes
           server: "{{ip_addr}}" 
        delegate_to: localhost
    
       Provision Modules
      - name: Provision modules
        tags:
          - run
        bigip_provision:
           provider: "{{admin_user}}"
           server: "{{ip_addr}}" 
           module: "{{item}}"
           state: present
           level: nominal
        loop: "{{provision_modules}}"
        delegate_to: localhost
    
      Reinstate the master key
      - name: Reinstate the master key 
        tags: 
           - run
        bigip_command:
           provider: "{{admin_user}}"
           server: "{{ip_addr}}"
           commands: "shell f5mku -r {{master_key}}"
           commands: shell f5mku -r GZIwzAaSeTu/EIcOHqT7FQ==
        delegate_to: localhost
    
       Upload and install the UCS file
      - name: Upload the UCS file
        tags:
          - run
        bigip_ucs:
           provider: "{{admin_user}}"
           server: "{{ip_addr}}" 
           force: yes 
           state: present 
           ucs: "/tmp/{{ vm_to_upgrade }}-init.ucs"
        delegate_to: localhost
    
       Upload and install the UCS file
      - name: Install the UCS file
        tags:
          - run
        bigip_ucs:
           provider: "{{admin_user}}"
           server: "{{ip_addr}}" 
           force: no 
           state: installed 
           ucs: "/tmp/{{ vm_to_upgrade }}-init.ucs"
           no_license: yes
           no_platform_check: yes
           include_chassis_level_config: no
        delegate_to: localhost
    
      - name: Sync Group
        tags:
           - run
        bigip_configsync_action:
           provider: "{{provider}}"
           device_group: "{{item}}" 
           sync_device_to_group: yes
           server: "{{sync_device}}" 
           overwrite_config: yes
        loop: "{{sync_groups}}"
        delegate_to: localhost
    
       Remove the uploaded UCS file
      - name: Remove the uploaded UCS file
        tags:
          - run
        bigip_ucs:
           provider: "{{provider}}"
           server: "{{ip_addr}}" 
           state: absent 
           ucs: "{{ vm_to_upgrade }}-init.ucs"
        delegate_to: localhost
    
  • thank you for sharing.

     

    I am facing issue with ISO-upload task. it times out after certain size of the image/ won't finish uploading entire image.

     

    I work over VPN and using wireless connection. However I am able to upload same iso via GUI. which tells me that it's not connection issue. Must be something related to upload big file using ansible over vpn and wireless connection.

     

    any idea what tunning do I need to do to make it work using ansible?

     

  • Hello Ankur,

     

    The first thing I would do is enable debug mode in ansible.

     

    More specifically, I might try is adding a timeout to your ucs upload and ucs install plays. This would let you know if your ucs plays are actually failing or if they're installing the config like it seems on the big-ip.

     

    I'd also throw a timeout on your config-sync play; if the ucs plays are actually working, then it seems like the playbook is actually hanging on the sync play, not the ucs plays.

     

    That's all I can think of for troubleshooting off the top of my head. Let me know if you figure it out!

     

    best of luck,

     

    Austin