From 35ca98a74270c2ff93ca17e63623b9b14964d5a5 Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Wed, 17 May 2023 14:51:15 +0200 Subject: [PATCH] Add tasks for XPS13 --- roles/laptop/tasks/asus-x13-flow.yml | 13 +++++ roles/laptop/tasks/dell-xps13.yml | 72 ++++++++++++++++++++++++++++ roles/laptop/tasks/main.yml | 22 ++++----- 3 files changed, 95 insertions(+), 12 deletions(-) create mode 100644 roles/laptop/tasks/asus-x13-flow.yml create mode 100644 roles/laptop/tasks/dell-xps13.yml diff --git a/roles/laptop/tasks/asus-x13-flow.yml b/roles/laptop/tasks/asus-x13-flow.yml new file mode 100644 index 0000000..556ffd3 --- /dev/null +++ b/roles/laptop/tasks/asus-x13-flow.yml @@ -0,0 +1,13 @@ +- name: Check if it's laptop + stat: + path: /sys/class/power_supply/BAT0/charge_control_end_threshold + register: battery_limiter_available + +- name: Powersave tasks + import_tasks: powersave.yml + +- when: battery_limiter_available.stat.exists + block: + - import_tasks: battery.yml + - import_tasks: asusctl.yml + - import_tasks: supergfxctl.yml diff --git a/roles/laptop/tasks/dell-xps13.yml b/roles/laptop/tasks/dell-xps13.yml new file mode 100644 index 0000000..8c6e3f1 --- /dev/null +++ b/roles/laptop/tasks/dell-xps13.yml @@ -0,0 +1,72 @@ +- become: yes + block: + - name: Create temporary directory + ansible.builtin.tempfile: + state: directory + register: tmp_dir + + - name: add ppa + apt_repository: + repo: ppa:oem-solutions-engineers/oem-projects-meta + + - name: install drivers + become: yes + apt: + update_cache: yes + state: latest + pkg: + - oem-somerville-tentacool-meta + + - name: Create temp dir + file: + path: "{{ tmp_dir.path }}" + state: directory + + - name: download dell configure + unarchive: + src: https://dl.dell.com/FOLDER09518608M/1/command-configure_4.10.0-5.ubuntu22_amd64.tar.gz + dest: "{{ tmp_dir.path }}" + remote_src: yes + + - name: Making a list of files + shell: "ls {{ tmp_dir.path }}" + register: command_result + + - name: Install a .deb package + ansible.builtin.apt: + deb: "{{ tmp_dir.path }}/{{ item }}" + with_items: + - "{{ command_result.stdout_lines | reverse }}" + + - name: Remove temp directory + become: yes + file: + path: "{{ tmp_dir.path }}" + state: absent + + - name: Create temp dir + file: + path: "{{ tmp_dir.path }}" + state: directory + + - name: Download old libssl because dell don't know how to package manage or update dependencies + get_url: + url: http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.18_amd64.deb + dest: "{{ tmp_dir.path }}/libssl1.deb" + + - name: unpack deb file + shell: + cmd: "dpkg -x libssl1.deb {{ tmp_dir.path }}" + chdir: "{{ tmp_dir.path }}" + + - name: copy libs + copy: + src: "{{ tmp_dir.path }}/usr/lib/x86_64-linux-gnu/" + dest: "/opt/dell/dcc" + remote_src: yes + + - name: Remove temp directory + become: yes + file: + path: "{{ tmp_dir.path }}" + state: absent diff --git a/roles/laptop/tasks/main.yml b/roles/laptop/tasks/main.yml index 556ffd3..ec9d4fb 100644 --- a/roles/laptop/tasks/main.yml +++ b/roles/laptop/tasks/main.yml @@ -1,13 +1,11 @@ -- name: Check if it's laptop - stat: - path: /sys/class/power_supply/BAT0/charge_control_end_threshold - register: battery_limiter_available +- name: Asus X13 Flow (2022) specific tasks + when: + - ansible_facts.board_vendor == "ASUSTeK COMPUTER INC." + - ansible_facts.board_name == "GV301RE" + import_tasks: asus-x13-flow.yml -- name: Powersave tasks - import_tasks: powersave.yml - -- when: battery_limiter_available.stat.exists - block: - - import_tasks: battery.yml - - import_tasks: asusctl.yml - - import_tasks: supergfxctl.yml +- name: Dell XPS 13 9320 specific tasks + when: + - ansible_facts.board_vendor == "Dell Inc." + - ansible_facts.board_name == "0CW9KM" + import_tasks: dell-xps13.yml \ No newline at end of file