Commit bd04f69

bryfry <bryon.fryer@gmail.com>
2018-02-24 14:27:46
playbook add master
1 parent 2c9b493
dev-env/tasks/git.yml
@@ -0,0 +1,17 @@
+- name: git - email
+  git_config: 
+    name: user.email
+    scope: global
+    value: "{{ git_email }}"
+  tags: git
+
+- name: git - username
+  git_config: 
+    name: user.name
+    scope: global
+    value: "{{ git_username }}"
+  tags: git
+
+# should be a git_config task but that's a TODO I guess
+- name: git - use ssh over https
+  command: git config --global url."git@github.com:".insteadOf "https://github.com/"
dev-env/tasks/home.yml
@@ -0,0 +1,47 @@
+---
+# home.yml tasks
+
+- name: home - check git dir existance
+  stat: 
+    path: "{{ home_dir }}"
+  register: home_git_dir
+
+- name: home - git clone (only if absent, touch yubikey for ssh key unlock)
+  git:
+    repo: git@github.com:bryfry/home.git
+    dest: "{{ home_dir }}"
+    accept_hostkey: True
+  when: not home_git_dir.stat.exists
+
+- name: home - symbolic links
+  file:
+    src: "{{ home_dir }}/{{ item }}" 
+    dest: "{{ ansible_env.HOME }}/.{{ item }}"
+    state: link
+    force: yes
+  with_items:
+  - vimrc
+  - tmux.conf
+  - tmux.statusbar.conf
+  - bashrc
+  - bash_aliases
+
+- name: home - create elinks config dir
+  file: 
+    path: "{{ ansible_env.HOME }}/.elinks"
+    state: directory
+
+# old version of ssh causes errors on proxyjump, config shouldnt be needed for dev hosts
+#- name: home - symbolic links (ssh config)
+#  file:
+#    src: "{{ home_dir }}/ssh_config" 
+#    dest: "{{ ansible_env.HOME }}/.ssh/config"
+#    state: link
+#    force: yes
+
+- name: home - symbolic links (elinks)
+  file:
+    src: "{{ home_dir }}/elinks.conf" 
+    dest: "{{ ansible_env.HOME }}/.elinks/elinks.conf"
+    state: link
+    force: yes
dev-env/tasks/logbook.yml
@@ -0,0 +1,13 @@
+---
+# home.yml tasks
+
+- name: logbook - check git dir existance
+  stat: 
+    path: "{{ logbook_dir }}"
+  register: lb_git_dir
+
+- name: logbook - git clone (only if absent, touch yubikey for ssh key unlock)
+  git:
+    repo: git@github.com:bryfry/logbook.git
+    dest: "{{ logbook_dir }}"
+  when: not lb_git_dir.stat.exists
dev-env/ansible.cfg
@@ -0,0 +1,4 @@
+[defaults]
+nocows = True
+inventory = hosts
+retry_files_enabled = False
dev-env/dev-env.yml
dev-env/hosts
@@ -0,0 +1,6 @@
+[dev-hosts]
+r-dev ansible_become_method=su ansible_become_user=root
+jmp
+
+[dev-hosts:vars]
+ansible_python_interpreter=/usr/bin/python3
dev-env/main.yml
@@ -0,0 +1,55 @@
+---
+- hosts: dev-hosts
+  gather_facts: False
+  tasks: 
+  - raw: apt install -y python3
+    become: yes
+
+
+- hosts: dev-hosts
+
+  vars: 
+    home_dir: "{{ ansible_env.HOME }}/git/home"
+    logbook_dir: "{{ ansible_env.HOME }}/git/logbook"
+    git_email: "bryon.fryer@gmail.com"
+    git_username: "bryfry"
+
+  tasks:  
+  - name: apt - update && upgrade && autoremove
+    apt:
+      update_cache: yes
+      cache_valid_time: 3600
+      upgrade: full
+      autoremove: yes
+    become: yes
+
+  - name: apt - utilities
+    apt: 
+      name: "{{ item }}"
+      state: latest
+    become: yes
+    with_items:
+    # misc tools
+    - man
+    - htop
+    - vim
+    - git
+    - apt-file # search apt for header files
+    - curl
+    - mtr-tiny
+    # Ansible
+    - python3 
+    - python3-pip
+    # cli tools
+    - elinks
+
+  - name: pip - utilities
+    pip:
+      name: "{{ item }}"
+      state: latest
+    with_items:
+    - shade
+  
+  - include: tasks/home.yml
+  - include: tasks/logbook.yml
+  - include: tasks/git.yml
dev-env/README.md
@@ -0,0 +1,87 @@
+# ansible-chromebook
+
+An ansible playbook for setting up Debian Sid (console only) on a Dell Chromebook 11
+
+## raw commands
+
+#### LVM snapshots
+
+  * create snapshot volume: `sudo lvcreate --size 6G --snapshot --name snap_root /dev/mapper/sid11--vg-root`
+  * LATER... `sudo lvconvert --merge /dev/mapper/sid11--vg-snap_root`
+  
+#### Bootstrap device
+
+  * basic cli: `sudo apt install git htop vim`
+  * gpg yubikey: `sudo apt install gnupg2 gnupg-agent pinentry-curses scdaemon pcscd`
+  * gpg-agent config (`~/.gnupg/gpg-agent.conf`):
+    
+    ```
+    enable-ssh-support
+    pinentry-program /usr/bin/pinentry-tty
+    default-cache-ttl 60
+    max-cache-ttl 120
+    ```
+  * gpg-agent start:
+    
+    ```
+    export GPG_TTY="$(tty)"
+    export SSH_AUTH_SOCK="${HOME}/.gnupg/S.gpg-agent.ssh
+    gpgconf --launch gpg-agent 
+    gpg-connect-agent updatestartuptty /bye > /dev/null
+    ```
+
+  * `git clone git@github.com:bryfry/ansible-chromebook.git`
+  * `sudo apt install python3 python3-pip apitude` 
+  * `pip3 install git+https://github.com/ansible/ansible.git@devel`
+
+#### wifi
+
+  * `sudo iw dev wlp1s0 scan | grep SSID`
+  * `sudo tee wpa_passphrase <SSID> > /root/<SSID>.conf` (prompt is for password)
+  * `sudo wpa_supplicant -B -i wlp1s0 -c /root/<SSID>.conf`
+  * `sudo dhclient -i wlp1s0`
+
+## Running it
+
+  * `ansible-playbook -i hosts main.yml`
+
+#### Neat stuff
+
+  * min backlight: `sudo tee /sys/class/backlight/intel_backlight/brightness <<< "1"`
+  * max backlight: ``sudo tee /sys/class/backlight/intel_backlight/brightness <<< `cat /sys/class/backlight/intel_backlight/max_brightness` ``
+  * [good resource on tty keyboard mappings](https://superuser.com/questions/290115/how-to-change-console-keymap-in-linux)
+    * search key = keycode 125 = Alt
+    * left control key = keycode 29 = Control
+  * [how to live well on the linux console](http://blog.startaylor.net/2016/05/30/howto-console/)
+
+     
+
+## TODO 
+
+  - [ ] powertop systemd service
+  - [ ] battery charge logs
+  - [ ] improve wifi setup (script?)
+  - [ ] power button sensitivity
+  - [ ] lock screen
+
+## TODO maybe
+
+  - [ ] zram
+  - [ ] audio drivers
+  - [ ] fix hw/lvm errors at initial login
+  - [ ] improve boot speed (ext4)
+
+## Done
+
+  - [x] `git config --global user.email "bryon@fryer.io"`
+  - [x] `git config --global user.name "bryfry"`
+  - [x] `git config --global url."git@github.com:".insteadOf "https://github.com/"`
+
+## Done v1
+
+  - [x] australian style trackpad, sidescrolling?
+  - [x] remove right click trackpad area
+  - [x] home directory dotfiles
+  - [x] screen recording
+  - [x] systemd/X lock screen
+  - [x] paste into st - no shift insert