Search code examples
joomlaansible

Joomla - Get Latest Version Zip Link - scrip Install


Does Joomla have a Link to the Latest Version? Wordpress for example has a link to https://wordpress.org/latest.zip , so I know I can always download that zip and get the latest version.

I am working on ansible script to automatically setup a server and install joomla and I need to keep it simple so I would like to spesify a link or api call or something to always get the latest joomla version zip.

Any help appreciated. David


Solution

  • good question - it is certainly not as easy as wordpress.

    You can download the latest version using ansible in the following way:

    Download the XML file you mentioned to your local machine:

       - name: download latest joomla packages list to local machine
         tags: joomlanew
         get_url:
           url: https://update.joomla.org/core/sts/extension_sts.xml
           dest: "{{ role_path }}/scripts/extension_sts.xml"
           force: yes
         delegate_to: 127.0.0.1
    

    Run a python script to parse this XML to find the latest package zip file:

       - name: find latest joomla version
         tags: joomlanew
         command: python ./latest_joomla.py
         args:
           chdir: "{{ role_path }}/scripts"
         delegate_to: 127.0.0.1
         register: xmlresp
    

    You can then use {{ xml.resp.stdout }} in ansible as the input for your download code:

    - name: download & unzip joomla
      tags: joomlanew
      unarchive:
        src: "{{ xmlresp.stdout }}"
        dest: /home/username/public_html/
        remote_src: yes
        mode: 0755
    

    FYI the code in th python script to parse the XML would be:

    from xml.dom import minidom
    xmldoc = minidom.parse('extension_sts.xml')
    itemlist = xmldoc.getElementsByTagName('downloadurl')
    last=(len(itemlist))-1
    print (itemlist[last].firstChild.data)