diff options
Diffstat (limited to 'library/latest_iso.py')
-rwxr-xr-x | library/latest_iso.py | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/library/latest_iso.py b/library/latest_iso.py deleted file mode 100755 index b55ea98..0000000 --- a/library/latest_iso.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys -from lxml import html -import requests -import json -from ansible.module_utils.basic import AnsibleModule - -BASE_URL = 'https://downloads.vyos.io/' -PAGE_URL = BASE_URL+'?dir=rolling/current/amd64' - - -def run_module(): - result = dict(changed=False) - module = AnsibleModule(argument_spec=dict()) - - page = requests.get(PAGE_URL) - tree = html.fromstring(page.content) - path = '//*[@id="directory-listing"]/li/a[1]/@href' - isos = [x for x in tree.xpath(path) if os.path.splitext(x)[1] == '.iso'] - latest_iso = os.path.join(BASE_URL, isos[-1]) - result['latest_iso'] = latest_iso - - module.exit_json(**result) - - -if __name__ == '__main__': - run_module() |