From 4649fe7abd60b492916e07f614f85378c433b433 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 4 May 2018 21:14:48 +0200 Subject: [PATCH] cosmetic changes --- ansible/.gitignore | 2 -- ansible/roles/openwrt-image/defaults/main.yml | 3 ++- ansible/roles/openwrt-image/tasks/00-fetch.yml | 25 +++++++++++----------- ansible/roles/openwrt-image/tasks/02-prepare.yml | 1 + ansible/roles/openwrt-image/tasks/main.yml | 5 +++-- ansible/tuer.yml | 1 + 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/ansible/.gitignore b/ansible/.gitignore index 3c4fe7e..808abb8 100644 --- a/ansible/.gitignore +++ b/ansible/.gitignore @@ -1,7 +1,5 @@ /log /gpg/vault-keyring.gpg~ -/files/openwrt -/files/.cache *.pyc *.retry .*.sw? diff --git a/ansible/roles/openwrt-image/defaults/main.yml b/ansible/roles/openwrt-image/defaults/main.yml index 6c94890..e0724a8 100644 --- a/ansible/roles/openwrt-image/defaults/main.yml +++ b/ansible/roles/openwrt-image/defaults/main.yml @@ -1,5 +1,6 @@ +--- openwrt_release: 17.01.4 -download_dir: .cache/openwrt +openwrt_download_dir: .cache/openwrt openwrt_tarball_basename: lede-imagebuilder-{{ openwrt_release }}-{{ openwrt_arch }}{% if openwrt_target != 'generic' %}-{{ openwrt_target }}{% endif %}.Linux-x86_64 openwrt_tarball_name: "{{ openwrt_tarball_basename }}.tar.xz" openwrt_target: generic diff --git a/ansible/roles/openwrt-image/tasks/00-fetch.yml b/ansible/roles/openwrt-image/tasks/00-fetch.yml index b3da57f..a69e65b 100644 --- a/ansible/roles/openwrt-image/tasks/00-fetch.yml +++ b/ansible/roles/openwrt-image/tasks/00-fetch.yml @@ -1,8 +1,9 @@ +--- - name: Create download directory file: - dest: "{{ download_dir }}" + dest: "{{ openwrt_download_dir }}" state: directory - + - block: - name: Generate OpenWrt download URLs set_fact: @@ -12,41 +13,41 @@ - name: Download sha256sums get_url: url: "{{ openwrt_url }}/sha256sums" - dest: "{{ download_dir }}/{{ openwrt_tarball_basename }}.sha256" + dest: "{{ openwrt_download_dir }}/{{ openwrt_tarball_basename }}.sha256" - name: Download sha256sums.asc get_url: url: "{{ openwrt_url }}/sha256sums.asc" - dest: "{{ download_dir }}/{{ openwrt_tarball_basename }}.sha256.asc" + dest: "{{ openwrt_download_dir }}/{{ openwrt_tarball_basename }}.sha256.asc" - name: Check OpenPGP signature - command: gpg --verify "{{ download_dir }}/{{ openwrt_tarball_basename }}.sha256.asc" + command: gpg --verify "{{ openwrt_download_dir }}/{{ openwrt_tarball_basename }}.sha256.asc" changed_when: False - name: Extract SHA256 hash of the imagebuilder archive - command: grep '{{ openwrt_tarball_name }}' "{{ download_dir }}/{{ openwrt_tarball_basename }}.sha256" + command: grep '{{ openwrt_tarball_name }}' "{{ openwrt_download_dir }}/{{ openwrt_tarball_basename }}.sha256" register: sha256 changed_when: False - name: Download imagebuilder get_url: url: "{{ openwrt_url }}/{{ openwrt_tarball_name }}" #lede-imagebuilder-{{ openwrt_release }}-{{ openwrt_arch }}.Linux-x86_64.tar.xz" - dest: "{{ download_dir }}/{{ openwrt_tarball_name }}" + dest: "{{ openwrt_download_dir }}/{{ openwrt_tarball_name }}" checksum: sha256:{{ sha256.stdout.split(' ') | first }} # /!\ This needs to be the last task in 00-fetch.yml # - set_fact: # openwrt_imgbuilder_tarball: > -# {{ download_dir }}/{{ openwrt_tarball_name }} - +# {{ openwrt_download_dir }}/{{ openwrt_tarball_name }} + rescue: - name: Delete downloaded artifacts file: path: "{{ item }}" state: absent with_items: - - "{{ download_dir }}/{{ openwrt_tarball_basename }}.sha256" - - "{{ download_dir }}/{{ openwrt_tarball_basename }}.sha256.asc" - - "{{ download_dir }}/{{ openwrt_tarball_name }}" + - "{{ openwrt_download_dir }}/{{ openwrt_tarball_basename }}.sha256" + - "{{ openwrt_download_dir }}/{{ openwrt_tarball_basename }}.sha256.asc" + - "{{ openwrt_download_dir }}/{{ openwrt_tarball_name }}" - fail: msg: Something borked diff --git a/ansible/roles/openwrt-image/tasks/02-prepare.yml b/ansible/roles/openwrt-image/tasks/02-prepare.yml index 277cc02..28bf10e 100644 --- a/ansible/roles/openwrt-image/tasks/02-prepare.yml +++ b/ansible/roles/openwrt-image/tasks/02-prepare.yml @@ -1 +1,2 @@ +--- - diff --git a/ansible/roles/openwrt-image/tasks/main.yml b/ansible/roles/openwrt-image/tasks/main.yml index f136f89..d182a5b 100644 --- a/ansible/roles/openwrt-image/tasks/main.yml +++ b/ansible/roles/openwrt-image/tasks/main.yml @@ -1,3 +1,4 @@ +--- - include: 00-fetch.yml when: openwrt_imgbuilder_tarball is not defined @@ -37,12 +38,12 @@ - block: # - unarchive: # copy: False -# src: "{{ download_dir }}/{{ openwrt_tarball_name }}" +# src: "{{ openwrt_download_dir }}/{{ openwrt_tarball_name }}" # dest: "{{ openwrt_imgbuilder_dir }}" - name: Decompress the OpenWrt image builder command: >- - tar -xf "{{ download_dir }}/{{ openwrt_tarball_name }}" + tar -xf "{{ openwrt_download_dir }}/{{ openwrt_tarball_name }}" -C "{{ openwrt_imgbuilder_dir }}" # - include: 02-prepare.yml diff --git a/ansible/tuer.yml b/ansible/tuer.yml index a55e085..c73b047 100644 --- a/ansible/tuer.yml +++ b/ansible/tuer.yml @@ -1,3 +1,4 @@ +--- - hosts: torwaechter connection: local pre_tasks: -- 1.7.10.4