diff --git a/CHANGELOG.md b/CHANGELOG.md index 5271f18bd9..7e565cd8c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) diff --git a/lib/trellis/plugins/callback/vars.py b/lib/trellis/plugins/callback/vars.py index 42942bdca1..98773de710 100644 --- a/lib/trellis/plugins/callback/vars.py +++ b/lib/trellis/plugins/callback/vars.py @@ -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)