diff --git a/tasks/openstack_proxy_settings.yml b/tasks/openstack_proxy_settings.yml index bfc122a4..19296a13 100644 --- a/tasks/openstack_proxy_settings.yml +++ b/tasks/openstack_proxy_settings.yml @@ -13,8 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Install host proxy settings - template: +- name: Add global_environment_variables to environment file + blockinfile: dest: "/etc/environment" - src: "environment.j2" - mode: "0644" + state: present + marker: "# {mark} Managed by OpenStack-Ansible" + insertbefore: EOF + block: "{{ lookup('template', 'environment.j2') }}" diff --git a/templates/environment.j2 b/templates/environment.j2 index 7cc9fb14..79d5ef51 100644 --- a/templates/environment.j2 +++ b/templates/environment.j2 @@ -1,10 +1,8 @@ -# {{ ansible_managed }} - PATH="{{ openstack_host_environment_path | join(':') }}" {% if global_environment_variables is defined %} -{% for key, value in global_environment_variables.iteritems() %} -{% if value %} +{% for key, value in global_environment_variables.iteritems() %} +{% if value %} {{ key }}={{ value }} -{% endif %} -{% endfor %} +{% endif %} +{% endfor %} {% endif %}