ansible #1

Merged
onjen merged 14 commits from ansible into master 2021-08-26 20:53:23 +02:00
18 changed files with 56 additions and 705 deletions
Showing only changes of commit b6ec318afb - Show all commits

View File

@ -2,7 +2,6 @@
# - fix symlinks for folders
- hosts: all
roles:
- bootstrap
- dotfiles
tasks:
- debug:

6
group_vars/all.yaml Normal file
View File

@ -0,0 +1,6 @@
home: '{{ "~" | expanduser }}'
dotfiles_dir: '{{home}}/src/dotfiles'
files_dir: '{{dotfiles_dir}}/roles/dotfiles/files'
git_mail: 'mail@johannes-rothe.de'
git_name: 'Johannes Rothe'
diff_tool: 'vimdiff'

View File

@ -1,27 +0,0 @@
---
- name: Install necessary packages
become: yes
become_method: su
become_user: root
apt:
name: "{{ packages_all }}"
state: present
cache_valid_time: 3600
- name: Install ubuntu specific packages
become: yes
become_method: su
become_user: root
when: ansible_distribution == "Ubuntu"
apt:
name: "{{ packages_ubuntu }}"
state: present
cache_valid_time: 3600
- name: Install debian specific packages
become: yes
become_method: su
become_user: root
when: ansible_distribution == "Debian"
apt:
name: "{{ packages_debian }}"
state: present
cache_valid_time: 3600

View File

@ -1,25 +0,0 @@
---
packages_all:
- ack
- build-essential
- dmenu
- fish
- fzf
- grim # screenshot
- htop
- ispell
- pass
- python3-dev
- slurp # region select
- sway
- swaylock
- tmux
- waybar
- vim
- wdisplays
packages_debian:
- foot
packages_ubuntu:
# required for foot compilation
- meson
- ninja-build

View File

@ -1,108 +0,0 @@
# -*- conf -*-
font=Roboto Mono Medium:size=8
bell=set-urgency
# initial-window-size-pixels=700x500 # Or,
# initial-window-size-chars=<COLSxROWS>
# initial-window-mode=windowed
# pad=2x2
# shell=$SHELL (if set, otherwise user's default shell from /etc/passwd)
# term=foot
# login-shell=no
# workers=<number of logical CPUs>
[scrollback]
# lines=1000
# multiplier=3.0
# indicator-position=relative
# indicator-format=
[cursor]
# style=block
# color=111111 dcdccc
# blink=no
[mouse]
# hide-when-typing=no
# alternate-scroll-mode=yes
[colors]
# alpha=0.9
# foreground=dcdccc
# background=111111
regular0=222222 # black
regular1=f92672 # red
regular2=82b414 # green
regular3=fd971f # yellow
regular4=268bd2 # blue
regular5=8c54fe # magenta
regular6=56c2d6 # cyan
regular7=ccccc6 # white
bright0=505354 # bright black
bright1=ff5995 # bright red
bright2=b7eb46 # bright green
bright3=feed6c # bright yellow
bright4=62ade3 # bright blue
bright5=bfa0fe # bright magenta
bright6=94d8e5 # bright cyan
bright7=f8f8f2 # bright white
# selection-foreground=<inverse foreground/background>
# selection-background=<inverse foreground/background>
[csd]
# preferred=server
# size=26
# color=<foreground color>
# button-width=26
# button-minimize-color=ff0000ff
# button-maximize-color=ff00ff00
# button-close-color=ffff0000
[key-bindings]
# scrollback-up-page=Shift+Page_Up
# scrollback-up-half-page=none
# scrollback-up-line=none
# scrollback-down-page=Shift+Page_Down
# scrollback-down-half-page=none
# scrollback-down-line=none
# clipboard-copy=Control+Shift+C
# clipboard-paste=Control+Shift+V
# primary-paste=Shift+Insert
# search-start=Control+Shift+R
# font-increase=Control+plus Control+equal Control+KP_Add
# font-decrease=Control+minus Control+KP_Subtract
# font-reset=Control+0 Control+KP_0
# spawn-terminal=Control+Shift+N
# minimize=none
# maximize=none
# fullscreen=none
# pipe-visible=[sh -c "xurls | bemenu | xargs -r firefox"] none
# pipe-scrollback=[sh -c "xurls | bemenu | xargs -r firefox"] none
# pipe-selected=[xargs -r firefox] none
[search-bindings]
# cancel=Control+g Escape
# commit=Return
# find-prev=Control+r
# find-next=Control+s
# cursor-left=Left Control+b
# cursor-left-word=Control+Left Mod1+b
# cursor-right=Right Control+f
# cursor-right-word=Control+Right Mod1+f
# cursor-home=Home Control+a
# cursor-end=End Control+e
# delete-prev=BackSpace
# delete-prev-word=Mod1+BackSpace Control+BackSpace
# delete-next=Delete
# delete-next-word=Mod1+d Control+Delete
# extend-to-word-boundary=Control+w
# extend-to-next-whitespace=Control+Shift+W
[mouse-bindings]
# primary-paste=BTN_MIDDLE
# select-begin=BTN_LEFT
# select-begin-block=Control+BTN_LEFT
# select-extend=BTN_RIGHT
# select-word=BTN_LEFT-2
# select-word-whitespace=Control+BTN_LEFT-2
# select-row=BTN_LEFT-3

View File

@ -1,188 +0,0 @@
# From /etc/sway/config
### Variables
#
# Logo key. Use Mod1 for Alt.
set $mod Mod4
# Home row direction keys, like vim
set $left h
set $down j
set $up k
set $right l
# Your preferred terminal emulator
set $term foot
# Your preferred application launcher
# Note: pass the final command to swaymsg so that the resulting window can be opened
# on the original workspace that the command was run on.
set $menu dmenu_path | dmenu | xargs swaymsg exec --
include /etc/sway/config-vars.d/*
### Output configuration
#
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
# output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
output * bg ~/.config/sway/bg.png fill
#
# Example configuration:
#
# output HDMI-A-1 resolution 1920x1080 position 1920,0
#
# You can get the names of your outputs by running: swaymsg -t get_outputs
### Key bindings
#
# Basics:
#
# Start a terminal
bindsym $mod+Return exec $term
# Kill focused window
bindsym $mod+Shift+q kill
# Start your launcher
bindsym $mod+d exec $menu
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
# Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
floating_modifier $mod normal
# Reload the configuration file
bindsym $mod+Shift+r reload
# Exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'
#
# Moving around:
#
# Move your focus around
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right
# Or use $mod+[up|down|left|right]
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# Move the focused window with the same, but add Shift
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right
# Ditto, with arrow keys
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
#
# Workspaces:
#
# Switch to workspace
bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
bindsym $mod+3 workspace number 3
bindsym $mod+4 workspace number 4
bindsym $mod+5 workspace number 5
bindsym $mod+6 workspace number 6
bindsym $mod+7 workspace number 7
bindsym $mod+8 workspace number 8
bindsym $mod+9 workspace number 9
bindsym $mod+0 workspace number 10
# Move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2
bindsym $mod+Shift+3 move container to workspace number 3
bindsym $mod+Shift+4 move container to workspace number 4
bindsym $mod+Shift+5 move container to workspace number 5
bindsym $mod+Shift+6 move container to workspace number 6
bindsym $mod+Shift+7 move container to workspace number 7
bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10
# Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default.
#
# Layout stuff:
#
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
bindsym $mod+b splith
bindsym $mod+v splitv
# Switch the current container between different layout styles
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# Make the current focus fullscreen
bindsym $mod+f fullscreen
# Toggle the current focus between tiling and floating mode
bindsym $mod+Shift+space floating toggle
# Swap focus between the tiling area and the floating area
bindsym $mod+space focus mode_toggle
# Move focus to the parent container
bindsym $mod+a focus parent
#
# Scratchpad:
#
# Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.
# Move the currently focused window to the scratchpad
bindsym $mod+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $mod+minus scratchpad show
#
# Resizing containers:
#
mode "resize" {
# left will shrink the containers width
# right will grow the containers width
# up will shrink the containers height
# down will grow the containers height
bindsym $left resize shrink width 10px
bindsym $down resize grow height 10px
bindsym $up resize shrink height 10px
bindsym $right resize grow width 10px
# Ditto, with arrow keys
bindsym Left resize shrink width 10px
bindsym Down resize grow height 10px
bindsym Up resize shrink height 10px
bindsym Right resize grow width 10px
# Return to default mode
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
include /etc/sway/config.d/*
# custom
input * {
xkb_layout "de"
}
bar {
swaybar_command waybar
}
# remove header
default_border pixel
# Keys
bindsym Mod1+l exec swaylock -c 222222
bindsym Mod1+s exec systemctl suspend
bindsym XF86AudioRaiseVolume exec "pactl set-sink-volume @DEFAULT_SINK@ +5%"
bindsym XF86AudioLowerVolume exec "pactl set-sink-volume @DEFAULT_SINK@ -5%"
bindsym XF86AudioMute exec "pactl set-sink-mute @DEFAULT_SINK@ toggle"
# Take a Screenshot with the region select (slurp)
bindsym Print exec grim -g "$(slurp)" ~/Pictures/shots/$(date +%Y-%m-%d_%H-%m-%S).png

View File

@ -1,163 +0,0 @@
{
// "layer": "top", // Waybar at top layer
// "position": "bottom", // Waybar position (top|bottom|left|right)
"height": 24, // Waybar height (to be removed for auto height)
// "width": 1280, // Waybar width
// Choose the order of the modules
"modules-left": ["sway/workspaces", "sway/mode"],
//"modules-center": ["sway/window"],
"modules-right": ["cpu", "temperature","network", "pulseaudio", "battery", "battery#bat2", "custom/date", "custom/week", "custom/clock", "tray"],
// Modules configuration
"sway/workspaces": {
"disable-scroll": true,
"all-outputs": true,
"format": "{name}",
"persistent_workspaces": {
"1": [],
"2": [],
"3": [],
"4": [],
"5": []
},
"format-icons": {
"1": "",
"2": "",
"3": "",
"4": "",
"urgent": "",
"focused": "",
"default": ""
}
},
"sway/mode": {
"format": "<span style=\"italic\">{}</span>"
},
"mpd": {
"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ ",
"format-disconnected": "Disconnected ",
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
"unknown-tag": "N/A",
"interval": 2,
"consume-icons": {
"on": " "
},
"random-icons": {
"off": "<span color=\"#f53c3c\"></span> ",
"on": " "
},
"repeat-icons": {
"on": " "
},
"single-icons": {
"on": "1 "
},
"state-icons": {
"paused": "",
"playing": ""
},
"tooltip-format": "MPD (connected)",
"tooltip-format-disconnected": "MPD (disconnected)"
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
}
},
"tray": {
// "icon-size": 21,
"spacing": 10
},
// "clock": {
// "format": "{%Y-%m-%d %H:%M}"
// },
"cpu": {
"format": " {usage}%",
"tooltip": false
},
"memory": {
"format": " {}% "
},
"temperature": {
// "thermal-zone": 2,
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
"critical-threshold": 80,
// "format-critical": "{temperatureC}°C {icon}",
"format": " {temperatureC}°C",
"format-icons": ["", "", ""]
},
"backlight": {
// "device": "acpi_video1",
"format": "{percent}% {icon}",
"format-icons": ["", ""]
},
"battery": {
"states": {
"good": 95,
"warning": 30,
"critical": 15
},
"format": "  {time} {capacity}%",
"format-charging": "  {time} {capacity}%",
"format-plugged": " {capacity}%",
"format-alt": "{time} {icon}",
"format-good": " {capacity}%", // An empty format will hide the module
"format-full": " {capacity}%",
"format-icons": ["", "", "", "", ""]
},
"battery#bat2": {
"bat": "BAT2"
},
"network": {
// "interface": "wlp2*", // (Optional) To force the use of this interface
"format-wifi": " {essid} ({signalStrength}%)",
"format-ethernet": " {ipaddr}",
"format-linked": "{ifname} (No IP) ",
"format-disconnected": "Disconnected ⚠",
"format-alt": "{ifname}: {ipaddr}/{cidr}"
},
"pulseaudio": {
// "scroll-step": 1, // %, can be a float
"format": "{icon} {volume}%",
"format-bluetooth": "{volume}% {icon} {format_source}",
"format-bluetooth-muted": " {icon} {format_source}",
"format-muted": "mute ",
"format-source": "{volume}% ",
"format-source-muted": "",
"format-icons": {
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", "", ""]
},
"on-click": "pavucontrol"
},
"custom/media": {
"format": "{icon} {}",
"return-type": "json",
"max-length": 40,
"format-icons": {
"spotify": "",
"default": "🎜"
},
"escape": true,
"exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder
// "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
},
"custom/date": {
"exec": "date +' %a %_d. %b'",
"interval": 60
},
"custom/week": {
"exec": "date +'CW %V'",
"interval": 60
},
"custom/clock": {
"exec": "date +' %H:%M'",
"interval": 10
}
}

View File

@ -1,149 +0,0 @@
* {
border: none;
border-radius: 0;
/* `otf-font-awesome` is required to be installed for icons */
font-family: Roboto Mono;
font-size: 14px;
min-height: 0;
}
window#waybar {
background-color: #3b4252;
color: white;
}
window#waybar.hidden {
opacity: 0.2;
}
#workspaces button {
padding: 0 5px;
background-color: transparent;
color: #ffffff;
border-bottom: 3px solid transparent;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
box-shadow: inherit;
border-bottom: 3px solid #ffffff;
}
#workspaces button.focused {
background-color: #64727D;
border-bottom: 3px solid #ffffff;
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#mode {
background-color: #64727D;
border-bottom: 3px solid #ffffff;
}
#clock,
#battery,
#cpu,
#memory,
#temperature,
#backlight,
#network,
#pulseaudio,
#custom-media,
#tray,
#mode,
#idle_inhibitor,
#custom-date,
#custom-clock,
#custom-week,
#mpd {
padding: 0px 10px;
/*margin: 2px 0px;*/
color: #ffffff;
background-color: #4c566a;
}
/*#clock {
/ background-color: #64727D;
}*/
/*#battery {
background-color: #ffffff;
color: #000000;
}
#battery.charging {
color: #ffffff;
background-color: #26A65B;
}*/
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
#battery.warning:not(.charging) {
background-color: #fd971f;
}
#battery.critical:not(.charging) {
background-color: #ff5995;
}
label:focus {
background-color: #000000;
}
#network.disconnected {
background-color: #f53c3c;
}
#custom-media {
background-color: #66cc99;
color: #2a5c45;
min-width: 100px;
}
#custom-media.custom-spotify {
background-color: #66cc99;
}
#custom-media.custom-vlc {
background-color: #ffa000;
}
#temperature.critical {
background-color: #eb4d4b;
}
#tray {
background-color: #2980b9;
}
#idle_inhibitor {
background-color: #2d3436;
}
#idle_inhibitor.activated {
background-color: #ecf0f1;
color: #2d3436;
}
#mpd {
background-color: #66cc99;
color: #2a5c45;
}
#mpd.disconnected {
background-color: #f53c3c;
}
#mpd.stopped {
background-color: #90b1b1;
}
#mpd.paused {
background-color: #51a37a;
}

View File

@ -1,51 +1,57 @@
---
- name: List files from config dir
find:
paths: "{{ role_path }}/files/config"
file_type: any
register: config_files
- name: List files for home dir
find:
paths: "{{ role_path }}/files/home"
file_type: any
register: home_files
- name: Create a backup dir
# Install base packages
- name: Install necessary packages
become: yes
become_method: su
become_user: root
apt:
name:
- ack
- dmenu
- fish
- fzf
- htop
- ispell
- pass
- tmux
- vim
state: present
cache_valid_time: 3600
- name: Remove old backup
file:
path: "~/tmp/dotfiles_backup"
path: '{{home}}/tmp/dotfiles_backup'
state: absent
- name: Create new backup dir
file:
path: '{{home}}/tmp/dotfiles_backup'
state: directory
- name: Backup home files
- name: Backup stuff
copy:
src: "{{ item.path }}"
dest: "~/tmp/dotfiles_backup"
remote_src: True
loop: "{{ home_files.files }}"
- name: Backup config files
copy:
src: "{{ item.path }}"
dest: "~/tmp/dotfiles_backup"
remote_src: True
loop: "{{ config_files.files }}"
- name: Remove exisiting home files
src: '{{ item }}'
dest: '{{home}}/tmp/dotfiles_backup'
remote_src: True # copy the folder from the host instead of ansible
ignore_errors: yes
loop:
# dirs (without trailing '/' copies the whole dir)
- '{{home}}/.config/fish'
# files
- '{{home}}/.tmux.conf'
- '{{home}}/.vimrc'
- '{{home}}/.ssh/config'
- name: Link files
file:
path: "~/.{{ item.path | basename }}/"
state: absent
loop: "{{ home_files.files }}"
- name: Remove exisiting config files
file:
path: "~/.config/{{ item.path | basename }}/"
state: absent
loop: "{{ config_files.files }}"
- name: Link home files
file:
src: "{{ item.path }}"
path: "~/.{{ item.path | basename }}"
src: '{{ item.src }}'
dest: '{{ item.dest }}'
state: link
force: True
loop: "{{ home_files.files }}"
- name: Link config files
file:
src: "{{ item.path }}"
path: "~/.config/{{ item.path | basename }}"
state: link
force: True
loop: "{{ config_files.files }}"
loop:
- src: '{{files_dir}}/vimrc'
dest: '{{home}}/.vimrc'
- src: '{{files_dir}}/tmux.conf'
dest: '{{home}}/.tmux.conf'
- src: '{{files_dir}}/ssh_config'
dest: '{{home}}/.ssh/config'
- src: '{{files_dir}}/fish'
dest: '{{home}}/.config/fish'