From 0d17626c8fc856effd96b6ec5de7ea631416ddd7 Mon Sep 17 00:00:00 2001 From: mg Date: Thu, 24 Jun 2021 07:25:32 +0200 Subject: [PATCH] laptop (#129) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit doku bash alias als dotfile entfernt rg als standard dotfiles source timeshift aufgerÀumt tasks wip timeshift snapd temp aus tasks Co-authored-by: Michael Grote Reviewed-on: https://git.mgrote.net/mg/ansible/pulls/129 Co-Authored-By: mg Co-Committed-By: mg --- group_vars/all.yml | 3 +- playbooks/3_service/laptop.yml | 1 + roles/mgrote.dotfiles/tasks/main.yml | 12 +++++++ roles/mgrote.polybar/tasks/main.yml | 5 --- roles/mgrote.timeshift/README.md | 10 ++++++ roles/mgrote.timeshift/defaults/main.yml | 3 ++ roles/mgrote.timeshift/handlers/main.yml | 4 +++ roles/mgrote.timeshift/tasks/main.yml | 23 ++++++++++++ .../mgrote.timeshift/templates/timeshift.json | 30 ++++++++++++++++ roles/mgrote.vim/tasks/main.yml | 36 ++++--------------- 10 files changed, 91 insertions(+), 36 deletions(-) create mode 100644 roles/mgrote.timeshift/README.md create mode 100644 roles/mgrote.timeshift/defaults/main.yml create mode 100644 roles/mgrote.timeshift/handlers/main.yml create mode 100644 roles/mgrote.timeshift/tasks/main.yml create mode 100644 roles/mgrote.timeshift/templates/timeshift.json diff --git a/group_vars/all.yml b/group_vars/all.yml index c831c31a..2399efbc 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -53,8 +53,6 @@ local_path: "/home/mg/.tmux.conf" - repo_path: "{{ dotfiles_repo_path}}/.gitconfig" local_path: "/home/mg/.gitconfig" - - repo_path: "{{ dotfiles_repo_path}}/.bash_aliases" - local_path: "/home/mg/.bash_aliases" dotfiles_dirs: - path: /home/mg/.config/i3 - path: /home/mg/.config/polybar @@ -193,6 +191,7 @@ - vim - rsync - at + - rg programs_only_physical: - hddtemp - ipmitool diff --git a/playbooks/3_service/laptop.yml b/playbooks/3_service/laptop.yml index b0187838..c04475f3 100644 --- a/playbooks/3_service/laptop.yml +++ b/playbooks/3_service/laptop.yml @@ -3,4 +3,5 @@ roles: - { role: mgrote.i3, tags: "i3", become: true } - { role: mgrote.polybar, tags: "polybar", become: true } + - { role: mgrote.remove_snapd, become: true, tags: "snapd" } - { role: mgrote.deactivate_caps, tags: "caps", become: true } diff --git a/roles/mgrote.dotfiles/tasks/main.yml b/roles/mgrote.dotfiles/tasks/main.yml index fe83013d..81e342de 100644 --- a/roles/mgrote.dotfiles/tasks/main.yml +++ b/roles/mgrote.dotfiles/tasks/main.yml @@ -35,3 +35,15 @@ owner: "{{ dotfiles_owner }}" group: "{{ dotfiles_owner }}" with_items: "{{ dotfiles_files }}" + + - name: add .bash_alias to .bashrc + ansible.builtin.lineinfile: + path: /home/{{ dotfiles_owner }}/.bashrc + line: "source {{ dotfiles_repo_path }}/.bash_aliases" + state: present + + - name: add .bash_functions to .bashrc + ansible.builtin.lineinfile: + path: /home/{{ dotfiles_owner }}/.bashrc + line: "source {{ dotfiles_repo_path }}/.bash_functions" + state: present diff --git a/roles/mgrote.polybar/tasks/main.yml b/roles/mgrote.polybar/tasks/main.yml index b5478796..68b86101 100644 --- a/roles/mgrote.polybar/tasks/main.yml +++ b/roles/mgrote.polybar/tasks/main.yml @@ -40,8 +40,3 @@ name: polybar group: video - - name: change permission for /sys/class/backlight/ - become: true - ansible.builtin.file: - path: /sys/class/backlight/ - mode: '0666' diff --git a/roles/mgrote.timeshift/README.md b/roles/mgrote.timeshift/README.md new file mode 100644 index 00000000..5d5fefc2 --- /dev/null +++ b/roles/mgrote.timeshift/README.md @@ -0,0 +1,10 @@ +## mgrote.timeshift + +### Beschreibung +Installiert und konfiguriert timeshift. + +### Funktioniert auf +- [X] Ubuntu (>=18.04) + +### Variablen + Defaults +see [defaults](./defaults/main.yml) diff --git a/roles/mgrote.timeshift/defaults/main.yml b/roles/mgrote.timeshift/defaults/main.yml new file mode 100644 index 00000000..0acfe2a4 --- /dev/null +++ b/roles/mgrote.timeshift/defaults/main.yml @@ -0,0 +1,3 @@ +--- + acng_server_exthreshold: "60" + acng_server_port: 9999 diff --git a/roles/mgrote.timeshift/handlers/main.yml b/roles/mgrote.timeshift/handlers/main.yml new file mode 100644 index 00000000..6ed760d9 --- /dev/null +++ b/roles/mgrote.timeshift/handlers/main.yml @@ -0,0 +1,4 @@ +--- + - name: create snapshot + become: yes + ansible.builtin.shell: "/usr/bin/timeshift --scripted --create" diff --git a/roles/mgrote.timeshift/tasks/main.yml b/roles/mgrote.timeshift/tasks/main.yml new file mode 100644 index 00000000..121791c7 --- /dev/null +++ b/roles/mgrote.timeshift/tasks/main.yml @@ -0,0 +1,23 @@ +--- + - name: install packages + become: yes + ansible.builtin.package: + name: + - timeshift + state: present + notify: create snapshot + + - name: copy timeshift config + become: yes + ansible.builtin.template: + src: "timeshift.json" + dest: "/etc/timeshift/timeshift.json" + + - name: create restic cronjob + become: yes + ansible.builtin.cron: + name: restic + state: present + job: "/usr/bin/timeshift --scripted --create" + minute: "7" + hour: "*/4" diff --git a/roles/mgrote.timeshift/templates/timeshift.json b/roles/mgrote.timeshift/templates/timeshift.json new file mode 100644 index 00000000..38e1b51e --- /dev/null +++ b/roles/mgrote.timeshift/templates/timeshift.json @@ -0,0 +1,30 @@ +{ + "backup_device_uuid" : "9b924961-0fd4-423f-b440-f2f3d1fa46d8", + "parent_device_uuid" : "", + "do_first_run" : "false", + "btrfs_mode" : "false", + "include_btrfs_home_for_backup" : "false", + "include_btrfs_home_for_restore" : "false", + "stop_cron_emails" : "false", + "btrfs_use_qgroup" : "false", + "schedule_monthly" : "false", + "schedule_weekly" : "false", + "schedule_daily" : "false", + "schedule_hourly" : "false", + "schedule_boot" : "false", + "count_monthly" : "2", + "count_weekly" : "3", + "count_daily" : "7", + "count_hourly" : "6", + "count_boot" : "5", + "snapshot_size" : "7515627384", + "snapshot_count" : "254372", + "date_format" : "%Y-%m-%d %H:%M:%S", + "exclude" : [ + "/root/**", + "/home/polybar/**", + "/home/ansible-user/**", + "/home/mg/**" + ], + "exclude-apps" : [] +} diff --git a/roles/mgrote.vim/tasks/main.yml b/roles/mgrote.vim/tasks/main.yml index ceb9d0f3..815304cc 100644 --- a/roles/mgrote.vim/tasks/main.yml +++ b/roles/mgrote.vim/tasks/main.yml @@ -3,36 +3,14 @@ become: yes ansible.builtin.package: name: - - vim - - ripgrep + - timeshift + - timeshift-gtk state: present - - name: check if vundle is installed - folder + - name: templating timeshift config become: yes - stat: - path: "{{ vim_vundle_path }}" - register: folder_exists + ansible.builtin.template: + src: "timeshift.json" + dest: "/etc/timeshift/timeshift.json" + mode: 0664 - - name: Ensure repository is cloned locally. - git: - repo: "{{ vim_vundle_repo_url }}" - dest: "{{ vim_vundle_path }}" - depth: 1 - register: repo_cloned - - - name: set owner recursive for repo - file: - path: "{{ vim_homedir }}" - owner: mg - group: mg - recurse: yes - when: repo_cloned.changed == true - - - name: Vundle - PluginInstall - ansible.builtin.shell: yes | vim -c PluginInstall -c qall - args: - chdir: /home/mg - when: - - (folder_exists.stat.exists == False) and ("ansible_facts['distribution'] == 'Ubuntu'") - become: yes - become_user: mg