bugfixes from previous commit

master
Glenn K. Lockwood 6 years ago
parent 4181ca6030
commit 429829f28f
  1. 11
      roles/common/tasks/linux-facts.yml
  2. 9
      roles/common/tasks/main.yml
  3. 44
      roles/common/tasks/raspi-facts.yml

@ -1,9 +1,16 @@
---
- name: get timezone via timedatectl
shell: timedatectl | grep "Time zone" | cut -d: -f2 | cut -d'(' -f1 | sed -Ee 's/(^ *| *$)//g'
shell: "timedatectl | grep 'Time zone' | cut -d':' -f2 | cut -d'(' -f1 | sed -Ee 's/(^ *| *$)//g'"
register: linux_tz
changed_when: False
- name: get locale
shell: "locale | grep ^LANG | cut -d= -f2"
register: linux_locale
changed_when: False
- name: set linux-config facts
set_fact:
linux_tz: linux_tz.stdout
linux_tz: "{{ linux_tz.stdout }}"
linux_locale: "{{ linux_locale.stdout }}"

@ -6,12 +6,17 @@
# Basic hostname setup
- name: Get MAC address
debug: msg="{{ hostvars[inventory_hostname].ansible_default_ipv4.macaddress }}"
debug:
msg: "{{ hostvars[inventory_hostname].ansible_default_ipv4.macaddress }}"
- name: store MAC address
set_fact:
my_macaddr: "{{ hostvars[inventory_hostname].ansible_default_ipv4.macaddress }}"
- name: print configured hostname
debug:
msg: "raspi-config hostname: {{ raspi_hostname }} vs. intended: {{ macaddrs[my_macaddr].hostname }}"
- name: set hostname
shell: "raspi-config nonint do_hostname {{ macaddrs[my_macaddr].hostname }}"
when: raspi_hostname != macaddrs[my_macaddr].hostname
@ -38,7 +43,7 @@
# Set locale
- name: set locale
shell: "raspi-config nonint do_change_locale {{ macaddrs[my_macaddr].locale }}"
when: raspi_locale != macaddrs[my_macaddr].locale
when: linux_locale != macaddrs[my_macaddr].locale
# Enable sshd
- name: forbid login via 'pi' user via ssh

@ -111,25 +111,25 @@
- name: set raspi-config facts
set_fact:
raspi_type: raspi_type.stdout
raspi_hostname: raspi_hostname.stdout
raspi_boot_gui: raspi_boot_gui.stdout
raspi_noautologin: raspi_noautologin.stdout
raspi_boot_nowait: raspi_boot_nowait.stdout
raspi_wifi_country: raspi_wifi_country.stdout
raspi_camera_disabled: raspi_camera_disabled.stdout
raspi_ssh_disabled: raspi_ssh_disabled.stdout
raspi_vnc_disabled: raspi_vnc_disabled.stdout
raspi_spi_disabled: raspi_spi_disabled.stdout
raspi_i2c_disabled: raspi_i2c_disabled.stdout
raspi_serial_disabled: raspi_serial_disabled.stdout
raspi_serial_hw_disabled: raspi_serial_hw_disabled.stdout
raspi_onewire_disabled: raspi_onewire_disabled.stdout
raspi_rpgio_disabled: raspi_rpgio_disabled.stdout
raspi_overclock: raspi_overclock.stdout
raspi_fs_unexpandable: raspi_fs_unexpandable.stdout
raspi_overscan: raspi_overscan.stdout
raspi_gpu_mem: raspi_gpu_mem.stdout
raspi_gpu_mem_256: raspi_gpu_mem_256.stdout
raspi_gpu_mem_512: raspi_gpu_mem_512.stdout
raspi_gpu_mem_1024: raspi_gpu_mem_1024.stdout
raspi_type: "{{ raspi_type.stdout }}"
raspi_hostname: "{{ raspi_hostname.stdout }}"
raspi_boot_gui: "{{ raspi_boot_gui.stdout }}"
raspi_noautologin: "{{ raspi_noautologin.stdout }}"
raspi_boot_nowait: "{{ raspi_boot_nowait.stdout }}"
raspi_wifi_country: "{{ raspi_wifi_country.stdout }}"
raspi_camera_disabled: "{{ raspi_camera_disabled.stdout }}"
raspi_ssh_disabled: "{{ raspi_ssh_disabled.stdout }}"
raspi_vnc_disabled: "{{ raspi_vnc_disabled.stdout }}"
raspi_spi_disabled: "{{ raspi_spi_disabled.stdout }}"
raspi_i2c_disabled: "{{ raspi_i2c_disabled.stdout }}"
raspi_serial_disabled: "{{ raspi_serial_disabled.stdout }}"
raspi_serial_hw_disabled: "{{ raspi_serial_hw_disabled.stdout }}"
raspi_onewire_disabled: "{{ raspi_onewire_disabled.stdout }}"
raspi_rgpio_disabled: "{{ raspi_rgpio_disabled.stdout }}"
raspi_overclock: "{{ raspi_overclock.stdout }}"
raspi_fs_unexpandable: "{{ raspi_fs_unexpandable.stdout }}"
raspi_overscan: "{{ raspi_overscan.stdout }}"
raspi_gpu_mem: "{{ raspi_gpu_mem.stdout }}"
raspi_gpu_mem_256: "{{ raspi_gpu_mem_256.stdout }}"
raspi_gpu_mem_512: "{{ raspi_gpu_mem_512.stdout }}"
raspi_gpu_mem_1024: "{{ raspi_gpu_mem_1024.stdout }}"

Loading…
Cancel
Save