diff options
author | Christian Pointner <equinox@spreadspace.org> | 2019-09-08 00:20:46 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2019-09-08 00:20:46 +0200 |
commit | d4dd2f186ea9c5977ea66d3fcc13da8f1553b9d3 (patch) | |
tree | 390bafa38d0e7a3864da121aa43b5ca7aa4bd719 /roles/cloud/install/tasks/hetzner_installimage.yml | |
parent | don't autostart testvm (diff) |
major refactoring for cloud install
Diffstat (limited to 'roles/cloud/install/tasks/hetzner_installimage.yml')
-rw-r--r-- | roles/cloud/install/tasks/hetzner_installimage.yml | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/roles/cloud/install/tasks/hetzner_installimage.yml b/roles/cloud/install/tasks/hetzner_installimage.yml new file mode 100644 index 00000000..f54a785b --- /dev/null +++ b/roles/cloud/install/tasks/hetzner_installimage.yml @@ -0,0 +1,38 @@ +--- +- name: determine latest image name + shell: | + set -o pipefail + shopt -s nocaseglob + ls /root/.oldroot/nfs/images/{{ install_distro }}-*-{{ install_codename }}-64-minimal.tar.gz | sort -r | head -n 1 + args: + executable: /bin/bash + check_mode: no + changed_when: false + register: latest_image + +- name: generate installimage config + template: + src: hetzner_installimage.conf.j2 + dest: /root/installimage.conf + +- name: generate postinst script + template: + src: hetzner_postinst.sh.j2 + dest: /root/postinst.sh + mode: 0755 + +- name: run installimage + command: /root/.oldroot/nfs/install/installimage -a -c installimage.conf -x postinst.sh + register: hetzner_installimage_cmd + changed_when: true + args: + chdir: /root + +- name: "print installimage output" + debug: + msg: "{{ hetzner_installimage_cmd.stdout_lines + hetzner_installimage_cmd.stderr_lines }}" + +- name: "check if installimage succeeded" + fail: + msg: "failed to run installimage" + when: "hetzner_installimage_cmd.rc != 0 or 'postinst.sh finished successfully' not in hetzner_installimage_cmd.stdout_lines" |