From 72fc9b1852b1470fde95ff31eb2ec09891cfe41c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Sch=C3=B6ldstr=C3=B6m?= Date: Wed, 31 May 2017 10:39:42 -0500 Subject: [PATCH 1/2] Add ansible tags for the commonly ran tasks --- main.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main.yml b/main.yml index f0b68f5..6133f8e 100644 --- a/main.yml +++ b/main.yml @@ -9,12 +9,16 @@ - include_vars: "{{ item }}" with_fileglob: - ../config.yml + tags: ['always'] roles: - - geerlingguy.homebrew - - geerlingguy.dotfiles - - name: geerlingguy.mas + - role: geerlingguy.homebrew + tags: ['homebrew'] + - role: geerlingguy.dotfiles + tags: ['dotfiles'] + - role: geerlingguy.mas when: mas_installed_apps + tags: ['mas'] tasks: - include: tasks/ansible-setup.yml @@ -27,3 +31,4 @@ - include: tasks/osx.yml when: configure_osx + tags: ['osx'] From 26bab2aae137429cdeabc7c43357c02a4809a734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Sch=C3=B6ldstr=C3=B6m?= Date: Wed, 31 May 2017 10:57:14 -0500 Subject: [PATCH 2/2] Add docs for tags usage [ci skip] --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 3768f4a..76a1be3 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,12 @@ This is a work in progress, and is mostly a means for me to document my current > Note: If some Homebrew commands fail, you might need to agree to Xcode's license or fix some other Brew issue. Run `brew doctor` to see if this is the case. +### Running a specific set of tagged tasks + +You can filter which part of the provisioning process to run by specifying a set of tags using `ansible-playbook`'s `--tags` flag. The tags available are `dotfiles`, `homebrew`, `mas` and `osx`. + + ansible-playook main.yml -i inventory -K --tags "dotfiles,homebrew" + ## Overriding Defaults Not everyone's development environment and preferred software configuration is the same.