--- - name: ensure build work dir exists become: yes file: path: "{{build_work_dir}}" state: "directory" owner: "{{ansible_user}}" group: "{{ansible_user}}" mode: "0755" - name: unarchive mattertimesync source unarchive: remote_src: yes src: "{{mattertimesync_tar}}" dest: "{{build_work_dir}}/" creates: "{{mattertimesync_build_dir}}" - name: check if mattertimesync build exists stat: path: "{{mattertimesync_srv_dir}}/mattertimesync-{{mattertimesync_version}}.tar.gz" register: build_file - name: install mattertimesync build dependencies command: "npm ci" args: chdir: "{{mattertimesync_build_dir}}" # Keep the npm cache on build_work_dir (the SSD) instead of the SD card. environment: npm_config_cache: "{{build_work_dir}}/.npm" when: not build_file.stat.exists - name: bundle mattertimesync command: "npm run bundle" args: chdir: "{{mattertimesync_build_dir}}" creates: "{{mattertimesync_build_dir}}/mattertimesync.mjs" environment: npm_config_cache: "{{build_work_dir}}/.npm" when: not build_file.stat.exists - name: create build server dir become: yes file: path: "{{mattertimesync_srv_dir}}" mode: "0755" state: "directory" - name: create gz archive of mattertimesync bundle become: yes archive: path: "{{mattertimesync_build_dir}}/mattertimesync.mjs" dest: "{{mattertimesync_srv_dir}}/mattertimesync-{{mattertimesync_version}}.tar.gz" format: "gz" # force a real tar for the single-file bundle; the module otherwise gzips a # lone file into a bare .gz that the server's unarchive can't extract. force_archive: true when: not build_file.stat.exists