File tree Expand file tree Collapse file tree 5 files changed +24
-2
lines changed Expand file tree Collapse file tree 5 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 11### HEAD
2+ * Escape salts and keys to avoid templating errors ([ #548 ] ( https://github.com/roots/trellis/pull/548 ) )
23* Add plugin to pretty print Ansible msg output ([ #544 ] ( https://github.com/roots/trellis/pull/544 ) )
34* Fix #482 - Multisite is-installed deploy check ([ #543 ] ( https://github.com/roots/trellis/pull/543 ) )
45* Skip setting permalink for multisite installs ([ #546 ] ( https://github.com/roots/trellis/pull/546 ) )
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ force_handlers = True
66inventory = hosts
77library = /usr/share/ansible:lib/trellis/modules
88roles_path = vendor/roles
9+ vars_plugins = ~/.ansible/plugins/vars_plugins/:/usr/share/ansible_plugins/vars_plugins:lib/trellis/plugins/vars
910
1011[ssh_connection]
1112ssh_args = -o ForwardAgent =yes -o ControlMaster =auto -o ControlPersist =60s
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ vault_wordpress_sites:
1212 env :
1313 db_password : example_dbpassword
1414 # Generate your keys here: https://api.wordpress.org/secret-key/1.1/salt/
15- # These CANNOT contain the characters "{%" or "{{" in succession
1615 auth_key : " generateme"
1716 secure_auth_key : " generateme"
1817 logged_in_key : " generateme"
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ vault_wordpress_sites:
1212 env :
1313 db_password : example_dbpassword
1414 # Generate your keys here: https://api.wordpress.org/secret-key/1.1/salt/
15- # These CANNOT contain the characters "{%" or "{{" in succession
1615 auth_key : " generateme"
1716 secure_auth_key : " generateme"
1817 logged_in_key : " generateme"
Original file line number Diff line number Diff line change 1+ from __future__ import (absolute_import , division , print_function )
2+ __metaclass__ = type
3+
4+ class VarsModule (object ):
5+ ''' Creates and modifies host variables '''
6+
7+ def __init__ (self , inventory ):
8+ self .inventory = inventory
9+ self .inventory_basedir = inventory .basedir ()
10+
11+ # Wrap salts and keys variables in {% raw %} to prevent jinja templating errors
12+ def wrap_salts_in_raw (self , host , hostvars ):
13+ if 'vault_wordpress_sites' in hostvars :
14+ for name , site in hostvars ['vault_wordpress_sites' ].iteritems ():
15+ for key , value in site ['env' ].iteritems ():
16+ if key .endswith (('_key' , '_salt' )) and not value .startswith (('{% raw' , '{%raw' )):
17+ hostvars ['vault_wordpress_sites' ][name ]['env' ][key ] = '' .join (['{% raw %}' , value , '{% endraw %}' ])
18+ host .vars ['vault_wordpress_sites' ] = hostvars ['vault_wordpress_sites' ]
19+
20+ def get_host_vars (self , host , vault_password = None ):
21+ self .wrap_salts_in_raw (host , host .get_group_vars ())
22+ return {}
You can’t perform that action at this time.
0 commit comments