Change reserved keyword 'action' to 'kayobe_action'

For several roles (cadvisor, inspection-store, docker-registry, etc.),
we use an 'action' variable, in a similar manner to kolla-ansible,
to determine the current action being performed (deploy,
reconfigure, upgrade). It is likely this information will be
useful for custom playbooks, so we should expose it. The 'action'
keyword is reserved, and its use triggers a warning, so we change its
name to kayobe_action before advertising it to users.

Change-Id: I5ffbb8b014a31e27141bfc8bf780297d81c840be
Story: 2001663
Task: 12604
This commit is contained in:
Mark Goddard 2018-04-12 15:25:20 +01:00
parent 9ec76f9e90
commit 4038c8226b
21 changed files with 40 additions and 15 deletions

View File

@ -12,3 +12,4 @@
- cadvisor - cadvisor
roles: roles:
- role: cadvisor - role: cadvisor
cadvisor_action: "{{ kayobe_action }}"

View File

@ -12,3 +12,4 @@
- docker-registry - docker-registry
roles: roles:
- role: docker-registry - role: docker-registry
docker_registry_action: "{{ kayobe_action }}"

View File

@ -12,6 +12,7 @@
- inspection-store - inspection-store
roles: roles:
- role: inspection-store - role: inspection-store
inspection_store_action: "{{ kayobe_action }}"
inspection_store_enabled: "{{ inspector_store_enabled }}" inspection_store_enabled: "{{ inspector_store_enabled }}"
inspection_store_port: "{{ inspector_store_port }}" inspection_store_port: "{{ inspector_store_port }}"
inspection_store_config_path: "{{ config_path }}/inspection-store" inspection_store_config_path: "{{ config_path }}/inspection-store"

View File

@ -12,3 +12,4 @@
- node-exporter - node-exporter
roles: roles:
- role: node-exporter - role: node-exporter
nodeexporter_action: "{{ kayobe_action }}"

View File

@ -12,3 +12,4 @@
- opensm - opensm
roles: roles:
- role: opensm - role: opensm
opensm_action: "{{ kayobe_action }}"

View File

@ -1,6 +1,10 @@
--- ---
# Roughly follows kolla-ansible's service deployment patterns. # Roughly follows kolla-ansible's service deployment patterns.
# Action to perform. One of 'deploy', 'destroy', 'pull', 'reconfigure',
# 'upgrade'.
cadvisor_action: deploy
# Whether cAdvisor is enabled. # Whether cAdvisor is enabled.
cadvisor_enabled: false cadvisor_enabled: false

View File

@ -1,2 +1,2 @@
--- ---
- include: "{{ action }}.yml" - include: "{{ cadvisor_action }}.yml"

View File

@ -7,4 +7,4 @@
with_dict: "{{ cadvisor_services }}" with_dict: "{{ cadvisor_services }}"
when: when:
- item.value.enabled - item.value.enabled
- action != 'destroy' - cadvisor_action != 'destroy'

View File

@ -1,6 +1,10 @@
--- ---
# Roughly follows kolla-ansible's service deployment patterns. # Roughly follows kolla-ansible's service deployment patterns.
# Action to perform. One of 'deploy', 'destroy', 'pull', 'reconfigure',
# 'upgrade'.
docker_registry_action: deploy
# Whether a docker registry is enabled. # Whether a docker registry is enabled.
docker_registry_enabled: true docker_registry_enabled: true

View File

@ -1,2 +1,2 @@
--- ---
- include: "{{ action }}.yml" - include: "{{ docker_registry_action }}.yml"

View File

@ -7,4 +7,4 @@
with_dict: "{{ docker_registry_services }}" with_dict: "{{ docker_registry_services }}"
when: when:
- item.value.enabled - item.value.enabled
- action != 'destroy' - docker_registry_action != 'destroy'

View File

@ -1,6 +1,10 @@
--- ---
# Roughly follows kolla-ansible's service deployment patterns. # Roughly follows kolla-ansible's service deployment patterns.
# Action to perform. One of 'deploy', 'destroy', 'pull', 'reconfigure',
# 'upgrade'.
inspection_store_action: deploy
# Whether an inspection store is enabled. # Whether an inspection store is enabled.
inspection_store_enabled: true inspection_store_enabled: true

View File

@ -1,2 +1,2 @@
--- ---
- include: "{{ action }}.yml" - include: "{{ inspection_store_action }}.yml"

View File

@ -7,4 +7,4 @@
with_dict: "{{ inspection_store_services }}" with_dict: "{{ inspection_store_services }}"
when: when:
- item.value.enabled - item.value.enabled
- action != 'destroy' - inspection_store_action != 'destroy'

View File

@ -1,6 +1,10 @@
--- ---
# Roughly follows kolla-ansible's service deployment patterns. # Roughly follows kolla-ansible's service deployment patterns.
# Action to perform. One of 'deploy', 'destroy', 'pull', 'reconfigure',
# 'upgrade'.
nodeexporter_action: deploy
# Whether Node Exporter is enabled. # Whether Node Exporter is enabled.
nodeexporter_enabled: false nodeexporter_enabled: false

View File

@ -1,2 +1,2 @@
--- ---
- include: "{{ action }}.yml" - include: "{{ nodeexporter_action }}.yml"

View File

@ -7,4 +7,4 @@
with_dict: "{{ nodeexporter_services }}" with_dict: "{{ nodeexporter_services }}"
when: when:
- item.value.enabled - item.value.enabled
- action != 'destroy' - nodeexporter_action != 'destroy'

View File

@ -1,6 +1,10 @@
--- ---
# Roughly follows kolla-ansible's service deployment patterns. # Roughly follows kolla-ansible's service deployment patterns.
# Action to perform. One of 'deploy', 'destroy', 'pull', 'reconfigure',
# 'upgrade'.
opensm_action: deploy
# Whether OpenSM is enabled. # Whether OpenSM is enabled.
opensm_enabled: true opensm_enabled: true

View File

@ -1,2 +1,2 @@
--- ---
- include: "{{ action }}.yml" - include: "{{ opensm_action }}.yml"

View File

@ -7,4 +7,4 @@
with_dict: "{{ opensm_services }}" with_dict: "{{ opensm_services }}"
when: when:
- item.value.enabled - item.value.enabled
- action != 'destroy' - opensm_action != 'destroy'

View File

@ -855,7 +855,7 @@ class OvercloudServiceDeploy(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
# Deploy kayobe extra services. # Deploy kayobe extra services.
playbooks = _build_playbook_list("overcloud-extras") playbooks = _build_playbook_list("overcloud-extras")
extra_vars = {"action": "deploy"} extra_vars = {"kayobe_action": "deploy"}
self.run_kayobe_playbooks(parsed_args, playbooks, self.run_kayobe_playbooks(parsed_args, playbooks,
extra_vars=extra_vars) extra_vars=extra_vars)
@ -912,7 +912,7 @@ class OvercloudServiceReconfigure(KollaAnsibleMixin, KayobeAnsibleMixin,
# Reconfigure kayobe extra services. # Reconfigure kayobe extra services.
playbooks = _build_playbook_list("overcloud-extras") playbooks = _build_playbook_list("overcloud-extras")
extra_vars = {"action": "reconfigure"} extra_vars = {"kayobe_action": "reconfigure"}
self.run_kayobe_playbooks(parsed_args, playbooks, self.run_kayobe_playbooks(parsed_args, playbooks,
extra_vars=extra_vars) extra_vars=extra_vars)
@ -965,7 +965,7 @@ class OvercloudServiceUpgrade(KollaAnsibleMixin, KayobeAnsibleMixin,
# Upgrade kayobe extra services. # Upgrade kayobe extra services.
playbooks = _build_playbook_list("overcloud-extras") playbooks = _build_playbook_list("overcloud-extras")
extra_vars = {"action": "upgrade"} extra_vars = {"kayobe_action": "upgrade"}
self.run_kayobe_playbooks(parsed_args, playbooks, self.run_kayobe_playbooks(parsed_args, playbooks,
extra_vars=extra_vars) extra_vars=extra_vars)
@ -1011,7 +1011,7 @@ class OvercloudServiceDestroy(KollaAnsibleMixin, KayobeAnsibleMixin,
# Destroy kayobe extra services. # Destroy kayobe extra services.
playbooks = _build_playbook_list("overcloud-extras") playbooks = _build_playbook_list("overcloud-extras")
extra_vars = {"action": "destroy"} extra_vars = {"kayobe_action": "destroy"}
self.run_kayobe_playbooks(parsed_args, playbooks, self.run_kayobe_playbooks(parsed_args, playbooks,
extra_vars=extra_vars) extra_vars=extra_vars)
@ -1032,7 +1032,7 @@ class OvercloudContainerImagePull(KayobeAnsibleMixin, KollaAnsibleMixin,
# Pull container images for kayobe extra services. # Pull container images for kayobe extra services.
playbooks = _build_playbook_list("overcloud-extras") playbooks = _build_playbook_list("overcloud-extras")
extra_vars = {"action": "pull"} extra_vars = {"kayobe_action": "pull"}
self.run_kayobe_playbooks(parsed_args, playbooks, self.run_kayobe_playbooks(parsed_args, playbooks,
extra_vars=extra_vars) extra_vars=extra_vars)