diff options
author | Yuya Kusakabe <yuya.kusakabe@gmail.com> | 2018-06-20 23:06:38 +0900 |
---|---|---|
committer | Yuya Kusakabe <yuya.kusakabe@gmail.com> | 2018-06-20 23:06:38 +0900 |
commit | 8c9f3a8e7bd9a937bcc4401a27246e258c5b4e4c (patch) | |
tree | 7d6d52fc658e13170d5c92f2c11055b2eb04ee3e /library | |
download | vyos-vm-images-8c9f3a8e7bd9a937bcc4401a27246e258c5b4e4c.tar.gz vyos-vm-images-8c9f3a8e7bd9a937bcc4401a27246e258c5b4e4c.zip |
Initial QEMU support
Diffstat (limited to 'library')
-rw-r--r-- | library/hosts | 5 | ||||
-rwxr-xr-x | library/latest_iso.py | 29 |
2 files changed, 34 insertions, 0 deletions
diff --git a/library/hosts b/library/hosts new file mode 100644 index 0000000..5fd0150 --- /dev/null +++ b/library/hosts @@ -0,0 +1,5 @@ +[local] +localhost + +[qemu] +localhost diff --git a/library/latest_iso.py b/library/latest_iso.py new file mode 100755 index 0000000..b55ea98 --- /dev/null +++ b/library/latest_iso.py @@ -0,0 +1,29 @@ +#!/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() |