Move debian-installer downloads to its own role
authornicoo <nicoo@realraum.at>
Sun, 17 Jun 2018 16:03:49 +0000 (18:03 +0200)
committernicoo <nicoo@realraum.at>
Sat, 24 Nov 2018 23:30:26 +0000 (00:30 +0100)
ansible/host_vars/alfred/main.yml
ansible/roles/debian-installer/defaults/main.yml [new file with mode: 0644]
ansible/roles/debian-installer/tasks/main.yml [new file with mode: 0644]
ansible/roles/vm/host/defaults/main.yml [deleted file]
ansible/roles/vm/host/meta/main.yml [new file with mode: 0644]
ansible/roles/vm/host/tasks/main.yml

index 48f4ee5..ab6ad85 100644 (file)
@@ -2,17 +2,6 @@
 vm_host:
   installer:
     net_if: br-mgmt
-    distros:
-    - distro: debian
-      codename: stretch
-      arch:
-      - amd64
-      - i386
-    - distro: ubuntu
-      codename: xenial
-      arch:
-      - amd64
-      - i386
   network:
     interface: br-mgmt
     ip: "{{ net.mgmt.prefix | ipaddr(65) | ipaddr('address') }}"
diff --git a/ansible/roles/debian-installer/defaults/main.yml b/ansible/roles/debian-installer/defaults/main.yml
new file mode 100644 (file)
index 0000000..91b5fe9
--- /dev/null
@@ -0,0 +1,19 @@
+arch: amd64
+
+distros:
+  - distro: debian
+    codename: stretch
+    arch:
+      - amd64
+      - i386
+  - distro: ubuntu
+    codename: xenial
+    arch:
+      - amd64
+      - i386
+
+debian_installer_force_download: no
+
+debian_installer_url:
+  debian: "http://debian.mur.at/debian"
+  ubuntu: "http://ubuntu.uni-klu.ac.at/ubuntu"
diff --git a/ansible/roles/debian-installer/tasks/main.yml b/ansible/roles/debian-installer/tasks/main.yml
new file mode 100644 (file)
index 0000000..eb32f6a
--- /dev/null
@@ -0,0 +1,27 @@
+- name: prepare directories for installer images
+  with_subelements:
+    - "{{ distros }}"
+    - arch
+  file:
+    name: "{{ debian_installer_path }}/{{ item.0.distro }}-{{ item.0.codename }}/{{ item.1 }}"
+    state: directory
+
+- name: download installer kernel images
+  with_subelements:
+    - "{{ distros }}"
+    - arch
+  get_url:
+    url: "{{ debian_installer_url[item.0.distro] }}/dists/{{ item.0.codename }}/main/installer-{{ item.1 }}/current/images/netboot/{{ item.0.distro }}-installer/{{ item.1 }}/linux"
+    dest: "{{ debian_installer_path }}/{{ item.0.distro }}-{{ item.0.codename }}/{{ item.1 }}/linux"
+    mode: 0644
+    force: "{{ debian_installer_force_download }}"
+
+- name: download installer initrd.gz
+  with_subelements:
+    - "{{ distros }}"
+    - arch
+  get_url:
+    url: "{{ debian_installer_url[item.0.distro] }}/dists/{{ item.0.codename }}/main/installer-{{ item.1 }}/current/images/netboot/{{ item.0.distro }}-installer/{{ item.1 }}/initrd.gz"
+    dest: "{{ debian_installer_path }}/{{ item.0.distro }}-{{ item.0.codename }}/{{ item.1 }}/initrd.gz"
+    mode: 0644
+    force: "{{ debian_installer_force_download }}"
diff --git a/ansible/roles/vm/host/defaults/main.yml b/ansible/roles/vm/host/defaults/main.yml
deleted file mode 100644 (file)
index deaa50a..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
----
-vm_host_force_download_installer: False
-vm_host_installer_url:
-  debian: "http://debian.mur.at/debian"
-  ubuntu: "http://ubuntu.uni-klu.ac.at/ubuntu"
diff --git a/ansible/roles/vm/host/meta/main.yml b/ansible/roles/vm/host/meta/main.yml
new file mode 100644 (file)
index 0000000..40f6fcb
--- /dev/null
@@ -0,0 +1,3 @@
+---
+dependencies:
+  - role: debian-installer
index 2c75bbb..357f85a 100644 (file)
   file:
     name: "{{ item }}"
     state: directory
-
-- name: prepare directories for installer images
-  with_subelements:
-    - "{{ vm_host.installer.distros }}"
-    - arch
-  file:
-    name: "{{ debian_installer_path }}/{{ item.0.distro }}-{{ item.0.codename }}/{{ item.1 }}"
-    state: directory
-
-- name: download installer kernel images
-  with_subelements:
-    - "{{ vm_host.installer.distros }}"
-    - arch
-  get_url:
-    url: "{{ vm_host_installer_url[item.0.distro] }}/dists/{{ item.0.codename }}/main/installer-{{ item.1 }}/current/images/netboot/{{ item.0.distro }}-installer/{{ item.1 }}/linux"
-    dest: "{{ debian_installer_path }}/{{ item.0.distro }}-{{ item.0.codename }}/{{ item.1 }}/linux"
-    mode: 0644
-    force: "{{ vm_host_force_download_installer }}"
-
-- name: download installer initrd.gz
-  with_subelements:
-    - "{{ vm_host.installer.distros }}"
-    - arch
-  get_url:
-    url: "{{ vm_host_installer_url[item.0.distro] }}/dists/{{ item.0.codename }}/main/installer-{{ item.1 }}/current/images/netboot/{{ item.0.distro }}-installer/{{ item.1 }}/initrd.gz"
-    dest: "{{ debian_installer_path }}/{{ item.0.distro }}-{{ item.0.codename }}/{{ item.1 }}/initrd.gz"
-    mode: 0644
-    force: "{{ vm_host_force_download_installer }}"