Fix automatrop system/access roles

This commit is contained in:
Geoffrey Frogeye 2021-06-17 21:21:34 +02:00
parent 729de4013e
commit c9657f69d4
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
3 changed files with 38 additions and 17 deletions

View file

@ -13,7 +13,7 @@
- name: Enable passwordless sudo access to wheel group (Manjaro) - name: Enable passwordless sudo access to wheel group (Manjaro)
copy: copy:
content: "%wheel ALL=(ALL) NOPASSWD: ALL" 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=" mode: "u=rwx,g=rx,o="
when: manjaro when: manjaro
become: yes become: yes

View file

@ -2,6 +2,9 @@
command: "etckeeper commit 'automatrop {{ ansible_date_time.iso8601 }}'" command: "etckeeper commit 'automatrop {{ ansible_date_time.iso8601 }}'"
listen: "etc changed" listen: "etc changed"
become: yes 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 - name: Restart chrony
systemd: systemd:
@ -26,3 +29,8 @@
listen: wpa_supplicant changed listen: wpa_supplicant changed
# Could probably use something better like # Could probably use something better like
# listing /sys/class/ieee80211/*/device/net/ # 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

View file

@ -213,13 +213,6 @@
# Network configuration # Network configuration
- name: Uninstall networkmanager
pacman:
name: networkmanager
state: absent
when: arch_based
become: yes
- name: Install dhcpcd (Arch based) - name: Install dhcpcd (Arch based)
pacman: pacman:
name: dhcpcd name: dhcpcd
@ -241,6 +234,8 @@
state: present state: present
when: arch_based when: arch_based
become: yes become: yes
notify:
- wifi setup changed
- name: Configure wpa_supplicant - name: Configure wpa_supplicant
template: template:
@ -264,26 +259,43 @@
copy: copy:
src: wpa_supplicant.service src: wpa_supplicant.service
dest: /etc/systemd/system/wpa_supplicant@.service.d/override.conf dest: /etc/systemd/system/wpa_supplicant@.service.d/override.conf
register: wpa_supplicant_systemd
become: yes become: yes
notify: notify:
- etc changed - 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: systemd:
name: "wpa_supplicant@{{ item }}" name: "wpa_supplicant@{{ item }}"
state: started
enabled: yes 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 become: yes
notify: etc changed notify:
- etc changed
- wifi setup changed
loop: "{{ ansible_interfaces }}" loop: "{{ ansible_interfaces }}"
when: "item.startswith('wl')" when: "item.startswith('wl')"
# Could probably use something better like # Could probably use something better like
# listing /sys/class/ieee80211/*/device/net/ # 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 # Time synchronisation
@ -311,7 +323,8 @@
become: yes become: yes
notify: notify:
- etc changed - etc changed
- "chrony reconfigured" - chrony reconfigured
# TODO More configuration, RTC configuration
- name: Enable chronyd - name: Enable chronyd
systemd: systemd:
@ -320,7 +333,7 @@
become: yes become: yes
notify: notify:
- etc changed - etc changed
- "chrony reconfigured" - chrony reconfigured
- name: Configure dhcpcd chrony hook - name: Configure dhcpcd chrony hook
copy: copy: