Browse Source

Fix automatrop system/access roles

master
Geoffrey Frogeye 1 year ago
parent
commit
c9657f69d4
Signed by: geoffrey GPG Key ID: C72403E7F82E6AD8
  1. 2
      config/automatrop/roles/access/tasks/main.yml
  2. 8
      config/automatrop/roles/system/handlers/main.yaml
  3. 45
      config/automatrop/roles/system/tasks/main.yml

2
config/automatrop/roles/access/tasks/main.yml

@ -13,7 +13,7 @@
- name: Enable passwordless sudo access to wheel group (Manjaro)
copy:
content: "%wheel ALL=(ALL) NOPASSWD: ALL"
path: /etc/sudoers.d/11-wheel-nopasswd
dest: /etc/sudoers.d/11-wheel-nopasswd
mode: "u=rwx,g=rx,o="
when: manjaro
become: yes

8
config/automatrop/roles/system/handlers/main.yaml

@ -2,6 +2,9 @@
command: "etckeeper commit 'automatrop {{ ansible_date_time.iso8601 }}'"
listen: "etc changed"
become: yes
register: etckeeper_commit
failed_when: "etckeeper_commit.rc != 0 and 'nothing to commit' not in etckeeper_commit.stdout"
changed_when: "'nothing to commit' not in etckeeper_commit.stdout"
- name: Restart chrony
systemd:
@ -26,3 +29,8 @@
listen: wpa_supplicant changed
# Could probably use something better like
# listing /sys/class/ieee80211/*/device/net/
- name: Warn about changed Wi-Fi setup
debug:
msg: "The Wi-Fi configuration was changed, but not applied to let this playbook finish. A reboot is required."
listen: wifi setup changed

45
config/automatrop/roles/system/tasks/main.yml

@ -213,13 +213,6 @@
# Network configuration
- name: Uninstall networkmanager
pacman:
name: networkmanager
state: absent
when: arch_based
become: yes
- name: Install dhcpcd (Arch based)
pacman:
name: dhcpcd
@ -241,6 +234,8 @@
state: present
when: arch_based
become: yes
notify:
- wifi setup changed
- name: Configure wpa_supplicant
template:
@ -264,26 +259,43 @@
copy:
src: wpa_supplicant.service
dest: /etc/systemd/system/wpa_supplicant@.service.d/override.conf
register: wpa_supplicant_systemd
become: yes
notify:
- etc changed
- systemd changed
- wifi setup changed
- name: Start/enable wpa_supplicant
- name: Disable wpa_supplicant for networkmanager
systemd:
name: wpa_supplicant
enabled: no
become: yes
notify:
- etc changed
- wifi setup changed
- name: Start/enable wpa_supplicant for interface
systemd:
name: "wpa_supplicant@{{ item }}"
state: started
enabled: yes
# Can't wait for handlers reload systemd daemon,
# but flushing is a bit much, so:
daemon_reload: "{{ wpa_supplicant_systemd.changed }}"
become: yes
notify: etc changed
notify:
- etc changed
- wifi setup changed
loop: "{{ ansible_interfaces }}"
when: "item.startswith('wl')"
# Could probably use something better like
# listing /sys/class/ieee80211/*/device/net/
- name: Uninstall networkmanager
pacman:
name: networkmanager
state: absent
extra_args: "--cascade --recursive"
when: arch_based
become: yes
notify:
- wifi setup changed
# Time synchronisation
@ -311,7 +323,8 @@
become: yes
notify:
- etc changed
- "chrony reconfigured"
- chrony reconfigured
# TODO More configuration, RTC configuration
- name: Enable chronyd
systemd:
@ -320,7 +333,7 @@
become: yes
notify:
- etc changed
- "chrony reconfigured"
- chrony reconfigured
- name: Configure dhcpcd chrony hook
copy:

Loading…
Cancel
Save