diff options
author | binary <me@rgoncalves.se> | 2020-11-03 23:23:18 +0100 |
---|---|---|
committer | binary <me@rgoncalves.se> | 2020-11-03 23:23:18 +0100 |
commit | a43b2771624f08396c18f21f8392af603164f047 (patch) | |
tree | 103114685d244ab42724ef6d7fadc87f6671713a /roles/vmm | |
parent | 4ff357865fecd2aaad9d9c197e8ee46e2bab8711 (diff) | |
download | infrastructure-a43b2771624f08396c18f21f8392af603164f047.tar.gz |
Download latest version of vm iso
Diffstat (limited to 'roles/vmm')
-rw-r--r-- | roles/vmm/.travis.yml | 29 | ||||
-rw-r--r-- | roles/vmm/tasks/debug.yml | 5 | ||||
-rw-r--r-- | roles/vmm/tasks/generate_vmconfig.yml | 5 | ||||
-rw-r--r-- | roles/vmm/tasks/init_alpine.yml | 31 | ||||
-rw-r--r-- | roles/vmm/tasks/main.yml | 5 | ||||
-rw-r--r-- | roles/vmm/vars/main.yml | 24 |
6 files changed, 99 insertions, 0 deletions
diff --git a/roles/vmm/.travis.yml b/roles/vmm/.travis.yml new file mode 100644 index 0000000..36bbf62 --- /dev/null +++ b/roles/vmm/.travis.yml @@ -0,0 +1,29 @@ +--- +language: python +python: "2.7" + +# Use the new container infrastructure +sudo: false + +# Install ansible +addons: + apt: + packages: + - python-pip + +install: + # Install ansible + - pip install ansible + + # Check ansible version + - ansible --version + + # Create ansible.cfg with correct roles_path + - printf '[defaults]\nroles_path=../' >ansible.cfg + +script: + # Basic role syntax check + - ansible-playbook tests/test.yml -i tests/inventory --syntax-check + +notifications: + webhooks: https://galaxy.ansible.com/api/v1/notifications/
\ No newline at end of file diff --git a/roles/vmm/tasks/debug.yml b/roles/vmm/tasks/debug.yml new file mode 100644 index 0000000..c078e11 --- /dev/null +++ b/roles/vmm/tasks/debug.yml @@ -0,0 +1,5 @@ + +# vmm ~~ debug.yml + +- debug: + var: vmm.iso.openbsd.version diff --git a/roles/vmm/tasks/generate_vmconfig.yml b/roles/vmm/tasks/generate_vmconfig.yml new file mode 100644 index 0000000..8d5609a --- /dev/null +++ b/roles/vmm/tasks/generate_vmconfig.yml @@ -0,0 +1,5 @@ + +# vmm_deploy ~~ tasks/main.yml + +--- + diff --git a/roles/vmm/tasks/init_alpine.yml b/roles/vmm/tasks/init_alpine.yml new file mode 100644 index 0000000..da0a33c --- /dev/null +++ b/roles/vmm/tasks/init_alpine.yml @@ -0,0 +1,31 @@ + +# vmm ~~ tasks/init_alpine.yml + +--- + +- set_fact: + dest_symlink: "{{ vmm.iso.dir }}/{{ vmm.iso.alpine.name }}-latest.iso" + +- set_fact: + dest_iso: "{{ dest_symlink | regex_replace('latest', vmm.iso.alpine.version) }}" + url_iso: "{{ vmm.iso.alpine.url | regex_replace('VERSION', vmm.iso.alpine.version) }}" + +- name: Check latest Alpine iso on disk + stat: + path: "{{ dest_iso }}" + register: dest_result + +- name: Get latest Alpine iso + get_url: + url: "{{ url_iso }}" + dest: "{{ dest_iso }}" + checksum: "sha256:{{ url_iso }}.sha256" + when: not dest_result.stat.exists + +- name: Symlink latest iso + file: + src: "{{ dest_iso }}" + dest: "{{ dest_symlink }}" + #owner: "{{ vmm.user }}" + #group: "{{ vmm.group }}" + state: link diff --git a/roles/vmm/tasks/main.yml b/roles/vmm/tasks/main.yml new file mode 100644 index 0000000..8d5609a --- /dev/null +++ b/roles/vmm/tasks/main.yml @@ -0,0 +1,5 @@ + +# vmm_deploy ~~ tasks/main.yml + +--- + diff --git a/roles/vmm/vars/main.yml b/roles/vmm/vars/main.yml new file mode 100644 index 0000000..3fc7743 --- /dev/null +++ b/roles/vmm/vars/main.yml @@ -0,0 +1,24 @@ + +# vmm ~~ vars/main.yml + +--- + +vmm: + + user: "vmm" + group: "vmm" + + iso: + + dir: "/data/vmm/iso/" + + alpine: + name: "alpine" + url: "http://dl-cdn.alpinelinux.org/alpine/v3.12/releases/x86_64/alpine-virt-VERSION-x86_64.iso" + version: "3.12.1" + + openbsd: + name: "openbsd" + url: "https://cdn.openbsd.org/pub/OpenBSD/6.8/amd64/installVERSION.img" + version: "68" + |