Merge "Use unified vars in task"

This commit is contained in:
Jenkins 2017-07-12 01:56:12 +00:00 committed by Gerrit Code Review
commit a71aa61ea7
43 changed files with 96 additions and 108 deletions

View File

@ -98,8 +98,6 @@ class ActionModule(action.ActionBase):
def run(self, tmp=None, task_vars=None):
if task_vars is None:
task_vars = dict()
result = super(ActionModule, self).run(tmp, task_vars)
# NOTE(jeffrey4l): Ansible 2.1 add a remote_user param to the
@ -114,22 +112,15 @@ class ActionModule(action.ActionBase):
tmp = self._make_tmp_path(remote_user)
sources = self._task.args.get('sources', None)
extra_vars = self._task.args.get('vars', list())
if not isinstance(sources, list):
sources = [sources]
temp_vars = task_vars.copy()
temp_vars.update(extra_vars)
config = OverrideConfigParser()
old_vars = self._templar._available_variables
self._templar.set_available_variables(temp_vars)
for source in sources:
self.read_config(source, config)
self._templar.set_available_variables(old_vars)
# Dump configparser to string via an emulated file
fakefile = StringIO()
@ -140,7 +131,6 @@ class ActionModule(action.ActionBase):
fakefile.close()
new_module_args = self._task.args.copy()
new_module_args.pop('vars', None)
new_module_args.pop('sources', None)
new_module_args.update(

View File

@ -25,9 +25,9 @@
- Restart aodh-notifier container
- name: Copying over aodh.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/aodh.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -61,9 +61,9 @@
- Restart barbican-api container
- name: Copying over barbican.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/barbican.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -43,9 +43,9 @@
- Restart ceilometer-api container
- name: Copying over ceilometer.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/ceilometer.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -19,9 +19,9 @@
- "ceph-rgw"
- name: Copying over ceph.conf
vars:
service_name: "{{ item }}"
merge_configs:
vars:
service_name: "{{ item }}"
sources:
- "{{ role_path }}/templates/ceph.conf.j2"
- "{{ node_custom_config }}/ceph.conf"

View File

@ -9,9 +9,9 @@
when: inventory_hostname in groups['cinder-volume']
- name: Copying over ceph.conf(s)
vars:
service_name: "{{ item }}"
merge_configs:
vars:
service_name: "{{ item }}"
sources:
- "{{ role_path }}/../ceph/templates/ceph.conf.j2"
- "{{ node_custom_config }}/ceph.conf"

View File

@ -44,9 +44,9 @@
- Restart cinder-api container
- name: Copying over cinder.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/cinder.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -10,9 +10,9 @@
- backup
- name: Copying over ceph.conf for Cinder
vars:
service_name: "{{ item }}"
merge_configs:
vars:
service_name: "{{ item }}"
sources:
- "{{ node_custom_config }}/cinder/ceph.conf"
- "{{ node_custom_config }}/cinder/{{ item }}/ceph.conf"

View File

@ -23,9 +23,9 @@
- Restart cloudkitty-processor container
- name: Copying over cloudkitty.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/cloudkitty.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -20,9 +20,9 @@
- "Restart {{ item.key }} container"
- name: Copying over congress.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/congress.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -27,9 +27,9 @@
- Restart designate-worker container
- name: Copying over designate.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/designate.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -34,9 +34,9 @@
- Restart freezer-api container
- name: Copying over freezer-api.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/freezer-api.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -23,9 +23,9 @@
- Restart glance-registry container
- name: Copying over glance-*.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/{{ item.key }}.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -10,9 +10,9 @@
- "gnocchi-statsd"
- name: Copying over ceph.conf(s)
vars:
service_name: "{{ item }}"
merge_configs:
vars:
service_name: "{{ item }}"
sources:
- "{{ role_path }}/../ceph/templates/ceph.conf.j2"
- "{{ node_custom_config }}/ceph.conf"

View File

@ -24,9 +24,9 @@
- Restart gnocchi-statsd container
- name: Copying over gnocchi.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/gnocchi.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -22,9 +22,9 @@
- Restart grafana container
- name: Copying over grafana.ini
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/grafana.ini.j2"
- "{{ node_custom_config }}/{{ item.key }}.ini"

View File

@ -31,9 +31,9 @@
- "heat-engine"
- name: Copying over heat.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/heat.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -23,9 +23,9 @@
- "ironic-dnsmasq"
- name: Copying over ironic.conf
vars:
service_name: "{{ item }}"
merge_configs:
vars:
service_name: "{{ item }}"
sources:
- "{{ role_path }}/templates/ironic.conf.j2"
- "{{ node_custom_config }}/global.conf"
@ -40,9 +40,9 @@
- "ironic-conductor"
- name: Copying over inspector.conf
vars:
service_name: "ironic-inspector"
merge_configs:
vars:
service_name: "ironic-inspector"
sources:
- "{{ role_path }}/templates/ironic-inspector.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -24,9 +24,9 @@
- Restart karbor-operationengine container
- name: Copying over karbor.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/karbor.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -34,9 +34,9 @@
- Restart keystone-fernet container
- name: Copying over keystone.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/keystone.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -22,9 +22,9 @@
- Restart kuryr container
- name: Copying over kuryr.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/kuryr.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -23,9 +23,9 @@
- Restart magnum-conductor container
- name: Copying over magnum.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/magnum.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -22,9 +22,9 @@
- "Restart {{ item.key }} container"
- name: Copying over manila.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/manila.conf.j2"
- "{{ node_custom_config }}/global.conf"
@ -48,9 +48,8 @@
- name: Copying over manila-share.conf
vars:
service: "{{ manila_services['manila-share'] }}"
service_name: "{{ item }}"
merge_configs:
vars:
service_name: "{{ item }}"
sources:
- "{{ role_path }}/templates/manila.conf.j2"
- "{{ role_path }}/templates/manila-share.conf.j2"

View File

@ -15,9 +15,9 @@
- "mariadb"
- name: Copying over galera.cnf
vars:
service_name: "{{ item }}"
merge_configs:
vars:
service_name: "{{ item }}"
sources:
- "{{ role_path }}/templates/galera.cnf.j2"
- "{{ node_custom_config }}/galera.cnf"

View File

@ -20,9 +20,9 @@
- Restart {{ item.key }} container
- name: Copying over mistral.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/mistral.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -17,9 +17,9 @@
- "murano-engine"
- name: Copying over murano.conf
vars:
service_name: "{{ item }}"
merge_configs:
vars:
service_name: "{{ item }}"
sources:
- "{{ role_path }}/templates/murano.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -18,9 +18,9 @@
- neutron_plugin_agent == "openvswitch"
- name: Copying over neutron.conf
vars:
service_name: "{{ item }}"
merge_configs:
vars:
service_name: "{{ item }}"
sources:
- "{{ role_path }}/templates/neutron.conf.j2"
- "{{ node_custom_config }}/global.conf"
@ -37,9 +37,9 @@
- neutron_plugin_agent == "openvswitch"
- name: Copying over ml2_conf.ini
vars:
service_name: "{{ item }}"
merge_configs:
vars:
service_name: "{{ item }}"
sources:
- "{{ role_path }}/templates/ml2_conf.ini.j2"
- "{{ node_custom_config }}/neutron/ml2_conf.ini"

View File

@ -9,9 +9,9 @@
when: inventory_hostname in groups['compute']
- name: Copying over ceph.conf(s)
vars:
service_name: "{{ item }}"
merge_configs:
vars:
service_name: "{{ item }}"
sources:
- "{{ role_path }}/../ceph/templates/ceph.conf.j2"
- "{{ node_custom_config }}/ceph.conf"

View File

@ -17,9 +17,9 @@
- Restart nova-compute-fake containers
- name: Copying over nova.conf
vars:
service_name: "{{ item }}"
merge_configs:
vars:
service_name: "{{ item }}"
sources:
- "{{ role_path }}/templates/nova.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -45,9 +45,8 @@
- nova-serialproxy
- nova-scheduler
- nova-spicehtml5proxy
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/nova.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -22,9 +22,9 @@
- "Restart {{ item.key }} container"
- name: Copying over octavia.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/octavia.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -22,9 +22,9 @@
- Restart panko-api container
- name: Copying over panko.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/panko.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -22,9 +22,9 @@
- Restart rally container
- name: Copying over rally.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/rally.conf.j2"
- "{{ node_custom_config }}/rally.conf"

View File

@ -23,9 +23,9 @@
- Restart sahara-engine container
- name: Copying over sahara.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/sahara.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -20,9 +20,9 @@
with_dict: "{{ searchlight_services }}"
- name: Copying over searchlight.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/searchlight.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -23,9 +23,9 @@
- Restart senlin-engine container
- name: Copying over senlin.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/senlin.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -25,9 +25,9 @@
- Restart solum-worker container
- name: Copying over solum.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/solum.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -44,9 +44,9 @@
- "swift-rsyncd"
- name: Copying over swift.conf
vars:
service_name: "swift-{{ item }}"
merge_configs:
vars:
service_name: "swift-{{ item }}"
sources:
- "{{ role_path }}/templates/swift.conf.j2"
- "{{ node_custom_config }}/global.conf"
@ -71,9 +71,9 @@
- "proxy-server"
- name: Copying over account-*.conf
vars:
service_name: "swift-{{ item }}"
merge_configs:
vars:
service_name: "swift-{{ item }}"
sources:
- "{{ role_path }}/templates/account.conf.j2"
- "{{ node_custom_config }}/global.conf"
@ -88,9 +88,9 @@
- "account-server"
- name: Copying over container-*.conf
vars:
service_name: "swift-{{ item }}"
merge_configs:
vars:
service_name: "swift-{{ item }}"
sources:
- "{{ role_path }}/templates/container.conf.j2"
- "{{ node_custom_config }}/global.conf"
@ -105,9 +105,9 @@
- "container-updater"
- name: Copying over object-*.conf
vars:
service_name: "swift-{{ item }}"
merge_configs:
vars:
service_name: "swift-{{ item }}"
sources:
- "{{ role_path }}/templates/object.conf.j2"
- "{{ node_custom_config }}/global.conf"
@ -123,9 +123,9 @@
- "object-updater"
- name: Copying over proxy-server.conf
vars:
service_name: "swift-{{ item }}"
merge_configs:
vars:
service_name: "swift-{{ item }}"
sources:
- "{{ role_path }}/templates/proxy-server.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -22,9 +22,9 @@
- Restart tacker container
- name: Copying over tacker.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/tacker.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -22,9 +22,9 @@
- Restart tempest container
- name: Copying over tempest.conf
vars:
project_name: "tempest"
merge_configs:
vars:
project_name: "tempest"
sources:
- "{{ role_path }}/templates/tempest.conf.j2"
- "{{ node_custom_config }}/tempest.conf"

View File

@ -36,9 +36,9 @@
- Restart trove-taskmanager container
- name: Copying over trove.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/trove.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -24,9 +24,9 @@
- Restart watcher-applier container
- name: Copying over watcher.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/watcher.conf.j2"
- "{{ node_custom_config }}/global.conf"

View File

@ -21,9 +21,9 @@
- Restart zun-compute container
- name: Copying over zun.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/zun.conf.j2"
- "{{ node_custom_config }}/global.conf"