Fix remote play for backup and restore
This change fixes the cases where ansible is looking for vars file on the AnsibleController instead of the remote StarlingX. Also, this file adds requirements.txt and uses it for the tox "venv" setup in order to provide an wasy way for a user to create an environment to remotely run ansible with the same toolset we have on a StarlingX ISO. TEST PLAN PASS remote play for backup PASS local play for backup PASS remote play for restore PASS local play for restore Closes-Bug: #1986691 Signed-off-by: Thiago Brito <thiago.brito@windriver.com> Change-Id: I27ea61428afafbd12434fca6f7bef4526ee01559
This commit is contained in:
parent
e251470059
commit
a80d03e5af
@ -10,8 +10,35 @@
|
|||||||
# backup is running.
|
# backup is running.
|
||||||
#
|
#
|
||||||
- name: Read in last kubernetes config values (extraArgs and extraVolumes)
|
- name: Read in last kubernetes config values (extraArgs and extraVolumes)
|
||||||
include_vars:
|
block:
|
||||||
file: "{{ config_permdir }}/last_kube_extra_config_bootstrap.yaml"
|
- name: Check if load has last_kube_extra_config_bootstrap.yaml
|
||||||
|
stat:
|
||||||
|
path: "{{ config_permdir }}/last_kube_extra_config_bootstrap.yaml"
|
||||||
|
register: load_has_extra_config
|
||||||
|
|
||||||
|
- name: Read last_kube_extra_config_bootstrap.yaml if it exists
|
||||||
|
block:
|
||||||
|
|
||||||
|
- name: Read last kubernetes config yaml file
|
||||||
|
command: "cat {{ config_permdir }}/last_kube_extra_config_bootstrap.yaml"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: Get last kubernetes config facts
|
||||||
|
set_fact:
|
||||||
|
last_kube_extra_config: "{{ result.stdout | from_yaml }}"
|
||||||
|
|
||||||
|
- name: Set last kubernetes config facts
|
||||||
|
set_fact:
|
||||||
|
apiserver_extra_args: "{{ last_kube_extra_config.apiserver_extra_args }}"
|
||||||
|
controllermanager_extra_args: "{{ last_kube_extra_config.controllermanager_extra_args }}"
|
||||||
|
scheduler_extra_args: "{{ last_kube_extra_config.scheduler_extra_args }}"
|
||||||
|
kubelet_configurations: "{{ last_kube_extra_config.kubelet_configurations }}"
|
||||||
|
apiserver_extra_volumes: "{{ last_kube_extra_config.apiserver_extra_volumes }}"
|
||||||
|
controllermanager_extra_volumes: "{{ last_kube_extra_config.controllermanager_extra_volumes }}"
|
||||||
|
scheduler_extra_volumes: "{{ last_kube_extra_config.scheduler_extra_volumes }}"
|
||||||
|
|
||||||
|
when: load_has_extra_config.stat.exists
|
||||||
|
|
||||||
when: mode == 'backup'
|
when: mode == 'backup'
|
||||||
|
|
||||||
- name: Append kubernetes extra configuration (extraArgs and extraVolumes)
|
- name: Append kubernetes extra configuration (extraArgs and extraVolumes)
|
||||||
@ -20,17 +47,24 @@
|
|||||||
marker: ""
|
marker: ""
|
||||||
create: yes
|
create: yes
|
||||||
block: |
|
block: |
|
||||||
apiserver_extra_args:
|
{% if apiserver_extra_args is defined %}
|
||||||
{{ apiserver_extra_args | to_nice_yaml | indent(2, indentfirst=True) }}
|
apiserver_extra_args: {{ apiserver_extra_args | to_nice_yaml | indent(2, indentfirst=True) }}
|
||||||
controllermanager_extra_args:
|
{% endif %}
|
||||||
{{ controllermanager_extra_args | to_nice_yaml | indent(2, indentfirst=True) }}
|
{% if controllermanager_extra_args is defined %}
|
||||||
scheduler_extra_args:
|
controllermanager_extra_args: {{ controllermanager_extra_args | to_nice_yaml | indent(2, indentfirst=True) }}
|
||||||
{{ scheduler_extra_args | to_nice_yaml | indent(2, indentfirst=True) }}
|
{% endif %}
|
||||||
kubelet_configurations:
|
{% if scheduler_extra_args is defined %}
|
||||||
{{ kubelet_configurations | to_nice_yaml | indent(2, indentfirst=True) }}
|
scheduler_extra_args: {{ scheduler_extra_args | to_nice_yaml | indent(2, indentfirst=True) }}
|
||||||
apiserver_extra_volumes:
|
{% endif %}
|
||||||
{{ apiserver_extra_volumes | to_yaml | indent(2, indentfirst=True) }}
|
{% if kubelet_configurations is defined %}
|
||||||
controllermanager_extra_volumes:
|
kubelet_configurations: {{ kubelet_configurations | to_nice_yaml | indent(2, indentfirst=True) }}
|
||||||
{{ controllermanager_extra_volumes | to_yaml | indent(2, indentfirst=True) }}
|
{% endif %}
|
||||||
scheduler_extra_volumes:
|
{% if apiserver_extra_volumes is defined %}
|
||||||
{{ scheduler_extra_volumes | to_yaml | indent(2, indentfirst=True) }}
|
apiserver_extra_volumes: {{ apiserver_extra_volumes | to_yaml | indent(2, indentfirst=True) }}
|
||||||
|
{% endif %}
|
||||||
|
{% if controllermanager_extra_volumes is defined %}
|
||||||
|
controllermanager_extra_volumes: {{ controllermanager_extra_volumes | to_yaml | indent(2, indentfirst=True) }}
|
||||||
|
{% endif %}
|
||||||
|
{% if scheduler_extra_volumes is defined %}
|
||||||
|
scheduler_extra_volumes: {{ scheduler_extra_volumes | to_yaml | indent(2, indentfirst=True) }}
|
||||||
|
{% endif %}
|
||||||
|
4
requirements.txt
Normal file
4
requirements.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
ansible==2.10.7
|
||||||
|
jinja2==2.11.3
|
||||||
|
markupsafe==1.1.1
|
||||||
|
netaddr==0.8.0
|
3
tox.ini
3
tox.ini
@ -10,7 +10,8 @@ setenv = VIRTUAL_ENV={envdir}
|
|||||||
OS_STDERR_CAPTURE=1
|
OS_STDERR_CAPTURE=1
|
||||||
OS_TEST_TIMEOUT=60
|
OS_TEST_TIMEOUT=60
|
||||||
ANSIBLE_LOCAL_TEMP={toxworkdir}/.ansible/tmp
|
ANSIBLE_LOCAL_TEMP={toxworkdir}/.ansible/tmp
|
||||||
deps = -r{toxinidir}/test-requirements.txt
|
deps = -r{toxinidir}/requirements.txt
|
||||||
|
-r{toxinidir}/test-requirements.txt
|
||||||
|
|
||||||
[testenv:linters]
|
[testenv:linters]
|
||||||
basepython = python3
|
basepython = python3
|
||||||
|
Loading…
Reference in New Issue
Block a user