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
roles:
- role: cadvisor
cadvisor_action: "{{ kayobe_action }}"

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,10 @@
---
# 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.
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 }}"
when:
- item.value.enabled
- action != 'destroy'
- cadvisor_action != 'destroy'

View File

@ -1,6 +1,10 @@
---
# 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.
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 }}"
when:
- item.value.enabled
- action != 'destroy'
- docker_registry_action != 'destroy'

View File

@ -1,6 +1,10 @@
---
# 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.
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 }}"
when:
- item.value.enabled
- action != 'destroy'
- inspection_store_action != 'destroy'

View File

@ -1,6 +1,10 @@
---
# 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.
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 }}"
when:
- item.value.enabled
- action != 'destroy'
- nodeexporter_action != 'destroy'

View File

@ -1,6 +1,10 @@
---
# 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.
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 }}"
when:
- item.value.enabled
- action != 'destroy'
- opensm_action != 'destroy'

View File

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