From c37ae1742c5009f2e7f836e6ce4da00d3b662ca4 Mon Sep 17 00:00:00 2001 From: Jannik Beyerstedt Date: Thu, 31 Oct 2019 18:29:35 +0100 Subject: [PATCH] [FIX] add common_settingsonly flag to role as well --- README.md | 17 ++++++++++++----- defaults/main.yml | 3 +++ files/dotfiles | 2 +- tasks/main.yml | 12 ++++++++---- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 6df35ea..446bab9 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,8 @@ For a GUI/ Desktop machine, you can enable to install and configure VS Code: The `user_lang_*` switches will also install the language only, if `user_vscode` is set to false. +To install just the dotfiles, set `common_settingsonly` to true. + Dependencies ------------ @@ -50,31 +52,37 @@ You can simply run the whole role: import_role: name: common tasks_from: update + when: common_settingsonly | default(false) == false - name: Basics - Install essential tools import_role: name: common tasks_from: essentials + when: common_settingsonly | default(false) == false - name: Basics - Install more tools import_role: name: common tasks_from: tools + when: common_settingsonly | default(false) == false - name: Basics - Setup user shell import_role: name: common tasks_from: usersetup + when: common_settingsonly | default(false) == false - name: Basics - Install dotfiles import_role: name: common tasks_from: usersettings - # just for you main machine (not included in the role's main.yml) + # Additional Tasks for Specific Host Types (not included in the role's main.yml) + + # more tools for your main machine - name: Basics - Install user's working utilities import_role: name: common tasks_from: usertools - # (not included in the role's main.yml) + # install programming languages and optionally VS Code - name: Basics - Install and configure VS Code import_role: name: common @@ -87,9 +95,8 @@ Or call the different tasks individually: hosts: all strategy: free tasks: - - name: Basics - Update first - roles: - - common + - import_role: + name: common ``` diff --git a/defaults/main.yml b/defaults/main.yml index 84d2fb2..af32e48 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,9 @@ --- # defaults file for common +# just copy dotfiles (for foreign hosts like webhosting) +common_settingsonly: false + # change login shell usersetup_chsh: true diff --git a/files/dotfiles b/files/dotfiles index e70885a..9367388 160000 --- a/files/dotfiles +++ b/files/dotfiles @@ -1 +1 @@ -Subproject commit e70885ae15e32de67ca259e304516237663a5e92 +Subproject commit 93673888bb177052a8b7f993c05e4c29d3b86c7a diff --git a/tasks/main.yml b/tasks/main.yml index 93c30f1..208cc6d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -9,21 +9,25 @@ # - Some must run periodically - name: Install updates - import_tasks: update.yml + include_tasks: update.yml + when: common_settingsonly == false # if role has not changed, this will not be needed when just installing updates - name: Install essential tools - import_tasks: essentials.yml + include_tasks: essentials.yml + when: common_settingsonly == false # if role has not changed, this will not be needed when just installing updates - name: Install more tools - import_tasks: tools.yml + include_tasks: tools.yml + when: common_settingsonly == false # this will just run once, because of a lock-file - name: Basics - Setup user shell - import_tasks: usersetup.yml + include_tasks: usersetup.yml + when: common_settingsonly == false # run this for every maintenance/ update cycle - name: Apply user settings