test candidate for full operation

This commit is contained in:
2025-08-24 21:57:15 -07:00
parent cc24088bbe
commit 0a5a7cc32c
9 changed files with 113 additions and 107 deletions

View File

@ -1,7 +1,7 @@
---
# when ran, this will look for an SD card
# optionally format it
# optionally format it, be careful with that, it WILL destroy things
# map it to working_storage
# can only run on arm64
# '"arm64" in cpu_architecture'
@ -20,20 +20,13 @@
when: '"arm64" in cpu_architecture'
set_fact:
arm_arch: true
format_sd: false
- name: SD Handler - Checks have passed
when: sd_unmounted and arm_arch | bool
block:
- name: SD Handler - format SD card
when: format_sd | bool
block:
- name: dummy task
debug:
msg: "nothing to see here, move along"
- name: SD Handler - find SD card
- name: SD Handler - Get SD Device
block:
- name: SD Handler - get boot device
@ -44,6 +37,34 @@
shell: "lsblk -o NAME,SIZE --nodeps | grep -v -e loop -e {{ boot_device.stdout_lines[0] }} -e NAME | cut -d ' ' -f 1"
register: sd_card_device
- name: SD Handler - format SD card
when: format_sd | bool
block:
- name: SD Handler - clear existing partition table
shell: 'sgdisk --zap-all "/dev/{{ sd_card_device.stdout_lines[0] }}"'
- name: SD Handler - create new partition table
shell: 'sgdisk --new=0:0:0 "/dev/{{ sd_card_device.stdout_lines[0] }}"'
- name: SD Handler - create new volume table
shell: 'sgdisk --typecode=1:8300 --change-name=1:"Linux filesystem" "/dev/{{ sd_card_device.stdout_lines[0] }}"'
- name: SD Handler - find new volume
shell: 'blkid | grep {{ sd_card_device.stdout_lines[0] }} | cut -d: -f1'
register: new_sd_volume
- name: SD Handler - format new volume
shell: 'mkfs.ext4 {{ new_sd_volume.stdout_lines[0] }}'
register: format_output
- name: SD Handler - show format stdout
debug:
msg: "{{ format_output.stdout_lines }}"
- name: SD Handler - find SD card volume
block:
- name: SD Handler - get sd card uuid
shell: "blkid | grep {{ sd_card_device.stdout_lines[0] }} | awk '{for (i=1; i<=NF; i++) print $i}' | grep UUID | grep -v PART | cut -d '\"' -f 2"
register: sd_card_uuid_output
@ -98,5 +119,37 @@
- debug:
msg: "{{ sd_test_output.stdout_lines }}"
- name: SD Handler - Share with samba
block:
- name: SD Handler - Create config file
copy:
dest: "/etc/samba/smb.conf.d/vcr_rip.conf"
content: |
[vcr_rip]
path = {{ working_storage }}
writable = yes
read only = no
only guest = yes
public = yes
guest ok = yes
guest only = yes
guest account = nobody
browsable = yes
mode: 0644
- name: SD Handler - Include in smb.conf
lineinfile:
path: "/etc/smb.conf"
search_string: "/etc/smb/smb.conf.d/vcr_rip.conf"
line: "/etc/smb/smb.conf.d/vcr_rip.conf"
insertafter: 'map to guest'
- name: SD Handler - restart smbd
service:
name: smbd
state: restarted
enabled: yes
...