From ad396149a1e207a8167eeb0efb726119d83a47d7 Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Sat, 23 Feb 2019 11:53:41 +0000 Subject: [PATCH] More refactorisation of the roles. --- .ansible/desktop.yaml | 20 +----- .../files/screen/.screenrc | 0 .../tasks}/firefox.yaml | 0 .ansible/roles/common_desktop/tasks/main.yaml | 2 + .../tasks}/screen.yaml | 0 .../vars/main.yaml} | 0 .../files/iterm2/com.googlecode.iterm2.plist | 0 .../files/iterm2/hybrid.itermcolors | 0 .../files/iterm2/shell_integration.bash | 0 .ansible/roles/darwin_desktop/meta/main.yaml | 2 + .../tasks}/homebrew.yaml | 0 .ansible/roles/darwin_desktop/tasks/main.yaml | 3 + .../darwin => darwin_desktop/tasks}/mas.yaml | 0 .../tasks}/prefs.yaml | 0 .ansible/roles/desktop/notes.md | 5 -- .ansible/roles/desktop/vars/darwin.yaml | 48 -------------- .ansible/roles/desktop/vars/linux.yaml | 63 ------------------ .ansible/roles/linux_desktop/meta/main.yaml | 2 + .../linux => linux_desktop/tasks}/config.yaml | 0 .../linux_desktop/tasks/includes/repos.yaml | 16 +++++ .ansible/roles/linux_desktop/tasks/main.yaml | 2 + .../tasks}/software.yaml | 17 +---- .../templates/conkyrc.j2 | 0 .ansible/roles/linux_desktop/vars/main.yaml | 66 +++++++++++++++++++ 24 files changed, 99 insertions(+), 147 deletions(-) rename .ansible/roles/{desktop/tasks/common => common_desktop}/files/screen/.screenrc (100%) rename .ansible/roles/{desktop/tasks/common => common_desktop/tasks}/firefox.yaml (100%) create mode 100644 .ansible/roles/common_desktop/tasks/main.yaml rename .ansible/roles/{desktop/tasks/common => common_desktop/tasks}/screen.yaml (100%) rename .ansible/roles/{desktop/vars/common.yaml => common_desktop/vars/main.yaml} (100%) rename .ansible/roles/{desktop/tasks/darwin => darwin_desktop}/files/iterm2/com.googlecode.iterm2.plist (100%) rename .ansible/roles/{desktop/tasks/darwin => darwin_desktop}/files/iterm2/hybrid.itermcolors (100%) rename .ansible/roles/{desktop/tasks/darwin => darwin_desktop}/files/iterm2/shell_integration.bash (100%) create mode 100644 .ansible/roles/darwin_desktop/meta/main.yaml rename .ansible/roles/{desktop/tasks/darwin => darwin_desktop/tasks}/homebrew.yaml (100%) create mode 100644 .ansible/roles/darwin_desktop/tasks/main.yaml rename .ansible/roles/{desktop/tasks/darwin => darwin_desktop/tasks}/mas.yaml (100%) rename .ansible/roles/{desktop/tasks/darwin => darwin_desktop/tasks}/prefs.yaml (100%) delete mode 100644 .ansible/roles/desktop/notes.md delete mode 100644 .ansible/roles/desktop/vars/darwin.yaml delete mode 100644 .ansible/roles/desktop/vars/linux.yaml create mode 100644 .ansible/roles/linux_desktop/meta/main.yaml rename .ansible/roles/{desktop/tasks/linux => linux_desktop/tasks}/config.yaml (100%) create mode 100644 .ansible/roles/linux_desktop/tasks/includes/repos.yaml create mode 100644 .ansible/roles/linux_desktop/tasks/main.yaml rename .ansible/roles/{desktop/tasks/linux => linux_desktop/tasks}/software.yaml (92%) rename .ansible/roles/{desktop/tasks/linux => linux_desktop}/templates/conkyrc.j2 (100%) create mode 100644 .ansible/roles/linux_desktop/vars/main.yaml diff --git a/.ansible/desktop.yaml b/.ansible/desktop.yaml index 571a32e..ee6a442 100644 --- a/.ansible/desktop.yaml +++ b/.ansible/desktop.yaml @@ -1,21 +1,7 @@ - name: Desktop installation and configuration hosts: desktop roles: - - role: desktop - vars_files: - - roles/desktop/vars/common.yaml - - "roles/desktop/vars/{{ ansible_system | lower }}.yaml" - tasks: - - import_tasks: roles/desktop/tasks/common/firefox.yaml - - import_tasks: roles/desktop/tasks/common/screen.yaml - - - block: - - import_tasks: roles/desktop/tasks/darwin/homebrew.yaml - - import_tasks: roles/desktop/tasks/darwin/mas.yaml - - import_tasks: roles/desktop/tasks/darwin/prefs.yaml - when: ansible_system == 'Darwin' - - - block: - - import_tasks: roles/desktop/tasks/linux/software.yaml - - import_tasks: roles/desktop/tasks/linux/config.yaml + - role: linux_desktop when: ansible_system == 'Linux' + - role: darwin_desktop + when: ansible_system == 'Darwin' diff --git a/.ansible/roles/desktop/tasks/common/files/screen/.screenrc b/.ansible/roles/common_desktop/files/screen/.screenrc similarity index 100% rename from .ansible/roles/desktop/tasks/common/files/screen/.screenrc rename to .ansible/roles/common_desktop/files/screen/.screenrc diff --git a/.ansible/roles/desktop/tasks/common/firefox.yaml b/.ansible/roles/common_desktop/tasks/firefox.yaml similarity index 100% rename from .ansible/roles/desktop/tasks/common/firefox.yaml rename to .ansible/roles/common_desktop/tasks/firefox.yaml diff --git a/.ansible/roles/common_desktop/tasks/main.yaml b/.ansible/roles/common_desktop/tasks/main.yaml new file mode 100644 index 0000000..1023b32 --- /dev/null +++ b/.ansible/roles/common_desktop/tasks/main.yaml @@ -0,0 +1,2 @@ +- import_tasks: firefox.yaml +- import_tasks: screen.yaml diff --git a/.ansible/roles/desktop/tasks/common/screen.yaml b/.ansible/roles/common_desktop/tasks/screen.yaml similarity index 100% rename from .ansible/roles/desktop/tasks/common/screen.yaml rename to .ansible/roles/common_desktop/tasks/screen.yaml diff --git a/.ansible/roles/desktop/vars/common.yaml b/.ansible/roles/common_desktop/vars/main.yaml similarity index 100% rename from .ansible/roles/desktop/vars/common.yaml rename to .ansible/roles/common_desktop/vars/main.yaml diff --git a/.ansible/roles/desktop/tasks/darwin/files/iterm2/com.googlecode.iterm2.plist b/.ansible/roles/darwin_desktop/files/iterm2/com.googlecode.iterm2.plist similarity index 100% rename from .ansible/roles/desktop/tasks/darwin/files/iterm2/com.googlecode.iterm2.plist rename to .ansible/roles/darwin_desktop/files/iterm2/com.googlecode.iterm2.plist diff --git a/.ansible/roles/desktop/tasks/darwin/files/iterm2/hybrid.itermcolors b/.ansible/roles/darwin_desktop/files/iterm2/hybrid.itermcolors similarity index 100% rename from .ansible/roles/desktop/tasks/darwin/files/iterm2/hybrid.itermcolors rename to .ansible/roles/darwin_desktop/files/iterm2/hybrid.itermcolors diff --git a/.ansible/roles/desktop/tasks/darwin/files/iterm2/shell_integration.bash b/.ansible/roles/darwin_desktop/files/iterm2/shell_integration.bash similarity index 100% rename from .ansible/roles/desktop/tasks/darwin/files/iterm2/shell_integration.bash rename to .ansible/roles/darwin_desktop/files/iterm2/shell_integration.bash diff --git a/.ansible/roles/darwin_desktop/meta/main.yaml b/.ansible/roles/darwin_desktop/meta/main.yaml new file mode 100644 index 0000000..39aaa3d --- /dev/null +++ b/.ansible/roles/darwin_desktop/meta/main.yaml @@ -0,0 +1,2 @@ +dependencies: + - role: common_desktop diff --git a/.ansible/roles/desktop/tasks/darwin/homebrew.yaml b/.ansible/roles/darwin_desktop/tasks/homebrew.yaml similarity index 100% rename from .ansible/roles/desktop/tasks/darwin/homebrew.yaml rename to .ansible/roles/darwin_desktop/tasks/homebrew.yaml diff --git a/.ansible/roles/darwin_desktop/tasks/main.yaml b/.ansible/roles/darwin_desktop/tasks/main.yaml new file mode 100644 index 0000000..fbab017 --- /dev/null +++ b/.ansible/roles/darwin_desktop/tasks/main.yaml @@ -0,0 +1,3 @@ +- import_tasks: homebrew.yaml +- import_tasks: mas.yaml +- import_tasks: prefs.yaml diff --git a/.ansible/roles/desktop/tasks/darwin/mas.yaml b/.ansible/roles/darwin_desktop/tasks/mas.yaml similarity index 100% rename from .ansible/roles/desktop/tasks/darwin/mas.yaml rename to .ansible/roles/darwin_desktop/tasks/mas.yaml diff --git a/.ansible/roles/desktop/tasks/darwin/prefs.yaml b/.ansible/roles/darwin_desktop/tasks/prefs.yaml similarity index 100% rename from .ansible/roles/desktop/tasks/darwin/prefs.yaml rename to .ansible/roles/darwin_desktop/tasks/prefs.yaml diff --git a/.ansible/roles/desktop/notes.md b/.ansible/roles/desktop/notes.md deleted file mode 100644 index 2083715..0000000 --- a/.ansible/roles/desktop/notes.md +++ /dev/null @@ -1,5 +0,0 @@ -# Interesting variables -* ansible_default_ipv4.interface -* ansible_form_factor -* ansible_product_name -* ansible_system_vendor diff --git a/.ansible/roles/desktop/vars/darwin.yaml b/.ansible/roles/desktop/vars/darwin.yaml deleted file mode 100644 index e3b2d3e..0000000 --- a/.ansible/roles/desktop/vars/darwin.yaml +++ /dev/null @@ -1,48 +0,0 @@ -homebrew_tap_items: - - caskroom/versions - - buo/homebrew-cask-upgrade - -homebrew_brew_items: - - ack - - bash-completion - - curl - - git - - coreutils - - glances - - ipcalc - - mas - - nmap - - p7zip - - psgrep - - pv - - python3 - - rename - - screen - - task - - tree - - vim - - watch - -homebrew_cask_items: - - alfred - - cleanmymac - - enpass - - firefox - - google-drive-file-stream - - google-chrome - - google-hangouts - - handbrake - - iterm2 - - itsycal - - joplin - - keybase - - osxfuse - - resilio-sync - - shiftit - - signal - - sonos - - virtualbox - - visual-studio-code - - whatsapp - - wireshark - - xquartz diff --git a/.ansible/roles/desktop/vars/linux.yaml b/.ansible/roles/desktop/vars/linux.yaml deleted file mode 100644 index 516a3a5..0000000 --- a/.ansible/roles/desktop/vars/linux.yaml +++ /dev/null @@ -1,63 +0,0 @@ -config_repos: - - name: 'albert' - repo: 'git@github.com:scottwallacesh/albert.git' - dest: '~/.local/share/albert' - -linux_repos: - - 'deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main' # Visual Studio Code - - 'deb http://download.opensuse.org/repositories/home:/manuelschneid3r/xUbuntu_18.10/ /' # Albert - - 'deb http://linux-packages.resilio.com/resilio-sync/deb resilio-sync non-free' # Resilio Sync - - 'deb http://prerelease.keybase.io/deb stable main' # Keybase - - 'deb https://apt.enpass.io/ stable main' # Enpass - -linux_repos_keys: - - 'https://packages.microsoft.com/keys/microsoft.asc' # Visual Studio Code - - 'https://download.opensuse.org/repositories/home:manuelschneid3r/xUbuntu_18.10/Release.key' # Albert - - 'http://linux-packages.resilio.com/resilio-sync/key.asc' # Resilio Sync - - 'https://keybase.io/docs/server_security/code_signing_key.asc' # Keybase - - 'https://apt.enpass.io/keys/enpass-linux.key' # Enpass - -linux_packages: - - albert - - chrome-gnome-shell - - code - - conky - - copyq - - dconf-editor - - enpass - - git - - glances - - gnome-shell-extension-caffeine - - gnome-shell-extension-dashtodock - - gnome-shell-extension-mediaplayer - - gnome-shell-extension-weather - - gnome-tweaks - - keybase - - net-tools - - netcat - - qrencode - - resilio-sync - - screen - # - sonos-controller-unofficial - - ttf-mscorefonts-installer - - units - - vim - - wireshark-qt - -linux_apps: - # - franz - - google-play-music-desktop-player - - 'skype --classic' - - wireguard-ammp - -gnome_extension_ids: - - 358 # activities configurator - - 1206 # clock-override - - 28 # gtile - - 1386 # notification counter - - 19 # user themes - -# Platform specific packages -# Format: systemvendor_formfactor_packages -"Apple Inc._Laptop_packages": - - mbpfan diff --git a/.ansible/roles/linux_desktop/meta/main.yaml b/.ansible/roles/linux_desktop/meta/main.yaml new file mode 100644 index 0000000..39aaa3d --- /dev/null +++ b/.ansible/roles/linux_desktop/meta/main.yaml @@ -0,0 +1,2 @@ +dependencies: + - role: common_desktop diff --git a/.ansible/roles/desktop/tasks/linux/config.yaml b/.ansible/roles/linux_desktop/tasks/config.yaml similarity index 100% rename from .ansible/roles/desktop/tasks/linux/config.yaml rename to .ansible/roles/linux_desktop/tasks/config.yaml diff --git a/.ansible/roles/linux_desktop/tasks/includes/repos.yaml b/.ansible/roles/linux_desktop/tasks/includes/repos.yaml new file mode 100644 index 0000000..844a905 --- /dev/null +++ b/.ansible/roles/linux_desktop/tasks/includes/repos.yaml @@ -0,0 +1,16 @@ +- name: includes/repos.yaml + tags: + - install + - repos + block: + - name: "Apt repo: Import GPG key: {{ repo.name }}" + apt_key: + state: present + url: "{{ repo.key }}" + become: true + + - name: "Apt repo: Add repo: {{ repo.name }}" + apt_repository: + state: present + repo: "{{ repo.data }}" + become: true diff --git a/.ansible/roles/linux_desktop/tasks/main.yaml b/.ansible/roles/linux_desktop/tasks/main.yaml new file mode 100644 index 0000000..81f6ea7 --- /dev/null +++ b/.ansible/roles/linux_desktop/tasks/main.yaml @@ -0,0 +1,2 @@ +- import_tasks: software.yaml +- import_tasks: config.yaml diff --git a/.ansible/roles/desktop/tasks/linux/software.yaml b/.ansible/roles/linux_desktop/tasks/software.yaml similarity index 92% rename from .ansible/roles/desktop/tasks/linux/software.yaml rename to .ansible/roles/linux_desktop/tasks/software.yaml index a7338f1..69a9fb4 100644 --- a/.ansible/roles/desktop/tasks/linux/software.yaml +++ b/.ansible/roles/linux_desktop/tasks/software.yaml @@ -1,22 +1,11 @@ -- name: Apt public GPG keys - tags: - - install - - repos - apt_key: - state: present - url: "{{ item }}" - loop: "{{ linux_repos_keys }}" - become: true - - name: Adding repositories tags: - install - repos - apt_repository: - repo: "{{ item }}" - state: present + include: includes/repos.yaml loop: "{{ linux_repos }}" - become: true + loop_control: + loop_var: repo - name: Installing packages tags: diff --git a/.ansible/roles/desktop/tasks/linux/templates/conkyrc.j2 b/.ansible/roles/linux_desktop/templates/conkyrc.j2 similarity index 100% rename from .ansible/roles/desktop/tasks/linux/templates/conkyrc.j2 rename to .ansible/roles/linux_desktop/templates/conkyrc.j2 diff --git a/.ansible/roles/linux_desktop/vars/main.yaml b/.ansible/roles/linux_desktop/vars/main.yaml new file mode 100644 index 0000000..188aa0d --- /dev/null +++ b/.ansible/roles/linux_desktop/vars/main.yaml @@ -0,0 +1,66 @@ +config_repos: + - name: 'albert' + repo: 'git@github.com:scottwallacesh/albert.git' + dest: '~/.local/share/albert' + +linux_repos: + - name: 'Visual Studio Code' + data: 'deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main' + key: 'https://packages.microsoft.com/keys/microsoft.asc' + - name: 'Albert' + data: 'deb http://download.opensuse.org/repositories/home:/manuelschneid3r/xUbuntu_18.10/ /' + key: 'https://download.opensuse.org/repositories/home:manuelschneid3r/xUbuntu_18.10/Release.key' + - name: 'Resilio Sync' + data: 'deb http://linux-packages.resilio.com/resilio-sync/deb resilio-sync non-free' + key: 'http://linux-packages.resilio.com/resilio-sync/key.asc' + - name: 'Keybase' + data: 'deb http://prerelease.keybase.io/deb stable main' + key: 'https://keybase.io/docs/server_security/code_signing_key.asc' + - name: 'Enpass' + data: 'deb https://apt.enpass.io/ stable main' + key: 'https://apt.enpass.io/keys/enpass-linux.key' + +linux_packages: + - albert + - chrome-gnome-shell + - code + - conky + - copyq + - dconf-editor + - enpass + - git + - glances + - gnome-shell-extension-caffeine + - gnome-shell-extension-dashtodock + - gnome-shell-extension-mediaplayer + - gnome-shell-extension-weather + - gnome-tweaks + - keybase + - net-tools + - netcat + - qrencode + - resilio-sync + - screen + # - sonos-controller-unofficial + - ttf-mscorefonts-installer + - units + - vim + - wireshark-qt + +linux_apps: + # - franz + - google-play-music-desktop-player + - 'skype --classic' + - wireguard-ammp + +gnome_extension_ids: + - 358 # activities configurator + - 1206 # clock-override + - 28 # gtile + - 1386 # notification counter + - 19 # user themes + +# Platform specific packages +# Format: systemvendor_formfactor_packages +"Apple Inc._Laptop_packages": + - mbpfan