Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically increase ansible_group_priority for selected env #909

Merged
merged 1 commit into from
Oct 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### HEAD
* Dynamically increase `ansible_group_priority` for selected env ([#909](https://github.com/roots/trellis/pull/909))
* Bump Ansible `version_tested_max` to 2.4.1.0 ([#911](https://github.com/roots/trellis/pull/911))
* Update wp-cli to 1.4.0 ([#906](https://github.com/roots/trellis/pull/906))
* [BREAKING] Normalize `apt` tasks ([#881](https://github.com/roots/trellis/pull/881))
Expand Down
5 changes: 5 additions & 0 deletions lib/trellis/plugins/callback/vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ def darwin_without_passlib(self):
return True

def v2_playbook_on_play_start(self, play):
env = play.get_variable_manager().get_vars(play=play).get('env', '')
env_group = next((group for key,group in play.get_variable_manager()._inventory.groups.iteritems() if key == env), False)
if env_group:
env_group.set_priority(20)

for host in play.get_variable_manager()._inventory.list_hosts(play.hosts[0]):
hostvars = play.get_variable_manager().get_vars(play=play, host=host)
self.raw_vars(play, host, hostvars)
Expand Down