From: nicoo Date: Sun, 17 Jun 2018 16:03:49 +0000 (+0200) Subject: Move debian-installer downloads to its own role X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=4d4c74d4762d367eaab6a277cb59cc87f7a7b1f5;p=noc.git Move debian-installer downloads to its own role --- diff --git a/ansible/host_vars/alfred/main.yml b/ansible/host_vars/alfred/main.yml index 48f4ee5..ab6ad85 100644 --- a/ansible/host_vars/alfred/main.yml +++ b/ansible/host_vars/alfred/main.yml @@ -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 index 0000000..91b5fe9 --- /dev/null +++ b/ansible/roles/debian-installer/defaults/main.yml @@ -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 index 0000000..eb32f6a --- /dev/null +++ b/ansible/roles/debian-installer/tasks/main.yml @@ -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 index deaa50a..0000000 --- a/ansible/roles/vm/host/defaults/main.yml +++ /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 index 0000000..40f6fcb --- /dev/null +++ b/ansible/roles/vm/host/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: debian-installer diff --git a/ansible/roles/vm/host/tasks/main.yml b/ansible/roles/vm/host/tasks/main.yml index 2c75bbb..357f85a 100644 --- a/ansible/roles/vm/host/tasks/main.yml +++ b/ansible/roles/vm/host/tasks/main.yml @@ -22,31 +22,3 @@ 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 }}"