Fix galaxy role upgrade
It is necessary to pass the --force flag to ansible-galaxy to ensure roles are upgraded during kayobe control host upgrade.
This commit is contained in:
parent
cb4e45b971
commit
e7e4344509
@ -127,7 +127,9 @@ class ControlHostUpgrade(KayobeAnsibleMixin, VaultMixin, Command):
|
|||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
self.app.LOG.debug("Upgrading Kayobe control host")
|
self.app.LOG.debug("Upgrading Kayobe control host")
|
||||||
utils.galaxy_install("ansible/requirements.yml", "ansible/roles")
|
# Use force to upgrade roles.
|
||||||
|
utils.galaxy_install("ansible/requirements.yml", "ansible/roles",
|
||||||
|
force=True)
|
||||||
playbooks = _build_playbook_list("bootstrap")
|
playbooks = _build_playbook_list("bootstrap")
|
||||||
self.run_kayobe_playbooks(parsed_args, playbooks)
|
self.run_kayobe_playbooks(parsed_args, playbooks)
|
||||||
playbooks = _build_playbook_list("kolla-ansible")
|
playbooks = _build_playbook_list("kolla-ansible")
|
||||||
|
@ -36,11 +36,13 @@ def yum_install(packages):
|
|||||||
sys.exit(e.returncode)
|
sys.exit(e.returncode)
|
||||||
|
|
||||||
|
|
||||||
def galaxy_install(role_file, roles_path):
|
def galaxy_install(role_file, roles_path, force=False):
|
||||||
"""Install Ansible roles via Ansible Galaxy."""
|
"""Install Ansible roles via Ansible Galaxy."""
|
||||||
cmd = ["ansible-galaxy", "install"]
|
cmd = ["ansible-galaxy", "install"]
|
||||||
cmd += ["--roles-path", roles_path]
|
cmd += ["--roles-path", roles_path]
|
||||||
cmd += ["--role-file", role_file]
|
cmd += ["--role-file", role_file]
|
||||||
|
if force:
|
||||||
|
cmd += ["--force"]
|
||||||
try:
|
try:
|
||||||
run_command(cmd)
|
run_command(cmd)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user