22 lines
581 B
YAML

---
- name: Prepare scripts for custom VMs (First start)
block:
- name: Copy files to remote system
ansible.builtin.copy:
src: files/first_start.sh
dest: /root/first_start.sh
owner: root
group: root
mode: '0644'
- name: Edit /etc/rc.local
ansible.builtin.lineinfile:
path: /etc/rc.local
regexp: '^(exit 0.*)$'
line: |
/root/first_start.sh &
$(sleep 2; chmod 755 /root/first_start.sh | sed '/chmod 755 \/root\/first_start.sh/d' -i /etc/rc.local) &
exit 0
when: ansible_os_family == "Debian"