Detect platform through laptop-detect
This commit is contained in:
parent
1c80c7277f
commit
e821d049eb
4 changed files with 38 additions and 19 deletions
|
|
@ -22,7 +22,7 @@ packages:
|
||||||
- curl
|
- curl
|
||||||
- cantata
|
- cantata
|
||||||
- reflector
|
- reflector
|
||||||
|
- laptop-detect
|
||||||
|
|
||||||
platform: "desktop"
|
|
||||||
platform_packages: []
|
platform_packages: []
|
||||||
skip_common_setup: true
|
skip_common_setup: true
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,18 @@
|
||||||
- name: load desktop specific vars
|
|
||||||
include_vars: desktop.yml
|
|
||||||
when: platform == "desktop"
|
|
||||||
|
|
||||||
- name: load laptop specific vars
|
|
||||||
include_vars: laptop.yml
|
|
||||||
when: platform == "laptop"
|
|
||||||
|
|
||||||
- name: install shared packages
|
- name: install shared packages
|
||||||
become: yes
|
become: yes
|
||||||
pacman:
|
pacman:
|
||||||
name: "{{ packages }}"
|
name: "{{ packages }}"
|
||||||
|
|
||||||
|
- name: detecting platform
|
||||||
|
include_tasks: platform.yml
|
||||||
|
|
||||||
- name: install platform specific packages
|
- name: install platform specific packages
|
||||||
become: yes
|
become: yes
|
||||||
pacman:
|
pacman:
|
||||||
name: "{{ platform_packages }}"
|
name: "{{ platform_packages }}"
|
||||||
|
|
||||||
- name: copy firewall template
|
- name: configuring network
|
||||||
become: yes
|
include_tasks: network.yml
|
||||||
template:
|
|
||||||
src: "{{ platform }}/nftables.j2"
|
|
||||||
dest: "/etc/nftables.conf"
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: "0600"
|
|
||||||
notify: restart nftables
|
|
||||||
|
|
||||||
- name: copy reflector configuration
|
- name: copy reflector configuration
|
||||||
become: yes
|
become: yes
|
||||||
|
|
@ -40,7 +28,6 @@
|
||||||
# - pacman setup depending on platform (see include section for common options)
|
# - pacman setup depending on platform (see include section for common options)
|
||||||
# - laptop power saving configuration
|
# - laptop power saving configuration
|
||||||
|
|
||||||
- include_tasks: network.yml
|
|
||||||
- include_tasks: mpv.yml # TODO
|
- include_tasks: mpv.yml # TODO
|
||||||
- include_tasks: mpd.yml # TODO
|
- include_tasks: mpd.yml # TODO
|
||||||
- include_tasks: nfs.yml # TODO
|
- include_tasks: nfs.yml # TODO
|
||||||
|
|
|
||||||
|
|
@ -34,3 +34,13 @@
|
||||||
state: started
|
state: started
|
||||||
enabled: yes
|
enabled: yes
|
||||||
when: platform == "laptop"
|
when: platform == "laptop"
|
||||||
|
|
||||||
|
- name: copy firewall template
|
||||||
|
become: yes
|
||||||
|
template:
|
||||||
|
src: "{{ platform }}/nftables.j2"
|
||||||
|
dest: "/etc/nftables.conf"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0600"
|
||||||
|
notify: restart nftables
|
||||||
|
|
|
||||||
22
roles/arch/tasks/platform.yml
Normal file
22
roles/arch/tasks/platform.yml
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
- name: detect platform
|
||||||
|
command: laptop-detect
|
||||||
|
register: is_laptop
|
||||||
|
failed_when: is_laptop.rc == 2
|
||||||
|
|
||||||
|
- name: set platform (desktop)
|
||||||
|
set_fact:
|
||||||
|
platform: "desktop"
|
||||||
|
when: is_laptop.rc == 1
|
||||||
|
|
||||||
|
- name: set platform (laptop)
|
||||||
|
set_fact:
|
||||||
|
platform: "laptop"
|
||||||
|
when: is_laptop.rc == 0
|
||||||
|
|
||||||
|
- name: load desktop specific vars
|
||||||
|
include_vars: desktop.yml
|
||||||
|
when: platform == "desktop"
|
||||||
|
|
||||||
|
- name: load laptop specific vars
|
||||||
|
include_vars: laptop.yml
|
||||||
|
when: platform == "laptop"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue