Skip to content

Commit

Permalink
feat: add become key to topic config
Browse files Browse the repository at this point in the history
Topics can now declare the need for sudo privileges in order to deploy.
Some link destinations in particular require sudo.
  • Loading branch information
eliasnorrby committed Nov 23, 2020
1 parent 93cae5f commit 798738f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,11 @@ Possible fields in `topic.config.yml`:

- `path` (required)
- `links`
- `become`
- `brew_formulas`
- `brew_casks`
- `brew_taps`
- `pacman_packages`
- `osx_defaults`
- `npm_packages`
- `pip_packages`
Expand Down
4 changes: 4 additions & 0 deletions _provision/roles/eliasnorrby.dotfiles/tasks/link-topic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
vars:
link_src: "{{ (item.absolute is defined and item.absolute) | ternary('',topic_data_path + '/') + (item.src | default(item)) }}"
link_path: "{{ (item.dest | default(xdg_config_home + '/' + topic_config_dirname + '/')) | regex_replace('/$', '/' + (item.rename | default(item.src | default(item)))) }}"
should_become: "{{ topic.config.become is defined and topic.config.become }}"
become: "{{ should_become }}"
become_flags: "--preserve-env {{ is_interactive | ternary('', '--non-interactive') }}"
ignore_errors: "{{ should_become }}"
when:
- topic.config.links is defined
- item.condition is undefined or item.condition
Expand Down
1 change: 1 addition & 0 deletions _provision/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dotfiles_data: "{{ xdg_data_home }}/dotfiles"

is_macos: "{{ ansible_distribution == 'MacOSX' }}"
is_arch: "{{ ansible_distribution == 'Archlinux' }}"
is_interactive: true

brew_formulas: []
brew_taps: []
Expand Down

0 comments on commit 798738f

Please sign in to comment.