Move tarball compression to background service;Housekeeping
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		@@ -0,0 +1,4 @@
 | 
			
		||||
- name: Disable crontab job
 | 
			
		||||
  ansible.builtin.cron:
 | 
			
		||||
    name: firstboot
 | 
			
		||||
    state: absent
 | 
			
		||||
@@ -1,10 +1,5 @@
 | 
			
		||||
- name: Compress tarballs
 | 
			
		||||
  community.general.archive:
 | 
			
		||||
    dest: /opt/metacluster/container-images/image-tarballs.tgz
 | 
			
		||||
    path: /opt/metacluster/container-images/*.tar
 | 
			
		||||
    format: gz
 | 
			
		||||
    remove: yes
 | 
			
		||||
  ignore_errors: yes
 | 
			
		||||
- import_tasks: service.yml
 | 
			
		||||
- import_tasks: cron.yml
 | 
			
		||||
 | 
			
		||||
- name: Cleanup tempfile
 | 
			
		||||
  ansible.builtin.file:
 | 
			
		||||
@@ -12,11 +7,6 @@
 | 
			
		||||
    state: absent
 | 
			
		||||
  when: kubeconfig.path is defined
 | 
			
		||||
 | 
			
		||||
- name: Disable crontab job
 | 
			
		||||
  ansible.builtin.cron:
 | 
			
		||||
    name: firstboot
 | 
			
		||||
    state: absent
 | 
			
		||||
 | 
			
		||||
- name: Reboot host
 | 
			
		||||
  ansible.builtin.shell:
 | 
			
		||||
    cmd: /usr/sbin/reboot now
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,24 @@
 | 
			
		||||
- name: Create tarball compression service
 | 
			
		||||
  ansible.builtin.template:
 | 
			
		||||
    src: "{{ item.src }}"
 | 
			
		||||
    dest: "{{ item.dest }}"
 | 
			
		||||
    owner: root
 | 
			
		||||
    group: root
 | 
			
		||||
    mode: "{{ item.mode | default(omit) }}"
 | 
			
		||||
  vars:
 | 
			
		||||
    _template:
 | 
			
		||||
      service:
 | 
			
		||||
        name: compressTarballs
 | 
			
		||||
        executable: /opt/firstboot/compresstarballs.sh
 | 
			
		||||
        workingdir: /opt/metacluster/container-images/
 | 
			
		||||
  loop:
 | 
			
		||||
    - src: compresstarballs.j2
 | 
			
		||||
      dest: "{{ _template.service.executable }}"
 | 
			
		||||
      mode: o+x
 | 
			
		||||
    - src: systemdunit.j2
 | 
			
		||||
      dest: /etc/systemd/system/{{ _template.service.name }}.service
 | 
			
		||||
 | 
			
		||||
- name: Enable tarball compression service
 | 
			
		||||
  ansible.builtin.systemd:
 | 
			
		||||
    name: compressTarballs
 | 
			
		||||
    enabled: yes
 | 
			
		||||
		Reference in New Issue
	
	Block a user