diff --git a/edbdeploy/cli.py b/edbdeploy/cli.py index afe9fe4e..57440122 100644 --- a/edbdeploy/cli.py +++ b/edbdeploy/cli.py @@ -343,6 +343,18 @@ def aws_subcommands(aws_subparser): action='store_true', help="Do not install the Ansible collection." ) + aws_deploy.add_argument( + '-f', '--force-install', + dest='force_install', + action='store_true', + help="Force components installation." + ) + aws_deploy.add_argument( + '-i', '--force-initdb', + dest='force_initdb', + action='store_true', + help="Force Postgres data initialization." + ) # Azure sub-commands and options def azure_subcommands(azure_subparser): @@ -515,6 +527,18 @@ def azure_subcommands(azure_subparser): action='store_true', help="Do not install the Ansible collection." ) + azure_deploy.add_argument( + '-f', '--force-install', + dest='force_install', + action='store_true', + help="Force components installation." + ) + azure_deploy.add_argument( + '-i', '--force-initdb', + dest='force_initdb', + action='store_true', + help="Force Postgres data initialization." + ) # GCloud sub-commands and options def gcloud_subcommands(gcloud_subparser): @@ -703,6 +727,18 @@ def gcloud_subcommands(gcloud_subparser): action='store_true', help="Do not install the Ansible collection." ) + gcloud_deploy.add_argument( + '-f', '--force-install', + dest='force_install', + action='store_true', + help="Force components installation." + ) + gcloud_deploy.add_argument( + '-i', '--force-initdb', + dest='force_initdb', + action='store_true', + help="Force Postgres data initialization." + ) # Argcomplete completer def project_name_completer(prefix, parsed_args, **kwargs): diff --git a/edbdeploy/command.py b/edbdeploy/command.py index 0f3871a1..99b1b279 100644 --- a/edbdeploy/command.py +++ b/edbdeploy/command.py @@ -68,7 +68,11 @@ def destroy(self): def deploy(self): self._check_project_exists() logging.info("Deploying components for project %s", self.project.name) - self.project.deploy(self.env.no_install_collection) + self.project.deploy( + self.env.no_install_collection, + self.env.force_install, + self.env.force_initdb + ) def display(self): self._check_project_exists() diff --git a/edbdeploy/project.py b/edbdeploy/project.py index 59688ab0..b2b94403 100644 --- a/edbdeploy/project.py +++ b/edbdeploy/project.py @@ -590,7 +590,7 @@ def destroy(self): self.update_state('terraform', 'DESTROYED') self.update_state('ansible', 'UNKNOWN') - def deploy(self, no_install_collection): + def deploy(self, no_install_collection, force_install, force_initdb): inventory_data = None ansible = AnsibleCli(self.project_path) @@ -612,7 +612,9 @@ def deploy(self, no_install_collection): efm_version=self.ansible_vars['efm_version'], yum_username=self.ansible_vars['yum_username'], yum_password=self.ansible_vars['yum_password'], - pass_dir=os.path.join(self.project_path, '.edbpass') + pass_dir=os.path.join(self.project_path, '.edbpass'), + force_install=force_install, + force_initdb=force_initdb, ) if self.ansible_vars.get('pg_data'): extra_vars.update(dict(