diff --git a/apps/ops/ansible/inventory.py b/apps/ops/ansible/inventory.py index 44dab9435..cddea41fb 100644 --- a/apps/ops/ansible/inventory.py +++ b/apps/ops/ansible/inventory.py @@ -115,6 +115,10 @@ class JMSInventory: else: host.update(self.make_account_ansible_vars(account)) + if platform.name == 'Huawei': + host['ansible_connection'] = 'network_cli' + host['ansible_network_os'] = 'asa' + if gateway: ansible_connection = host.get('ansible_connection', 'ssh') if ansible_connection in ('local', 'winrm', 'rdp'): diff --git a/apps/ops/const.py b/apps/ops/const.py index 578697c48..61f0b5e32 100644 --- a/apps/ops/const.py +++ b/apps/ops/const.py @@ -54,6 +54,7 @@ class JobModules(models.TextChoices): postgresql = 'postgresql', _('PostgreSQL') sqlserver = 'sqlserver', _('SQLServer') raw = 'raw', _('Raw') + huawei = 'huawei', _('HUAWEI') class AdHocModules(models.TextChoices): diff --git a/apps/ops/models/job.py b/apps/ops/models/job.py index 7c6f9e9ab..723369e25 100644 --- a/apps/ops/models/job.py +++ b/apps/ops/models/job.py @@ -66,7 +66,7 @@ class JMSPermedInventory(JMSInventory): 'mysql': ['mysql'], 'postgresql': ['postgresql'], 'sqlserver': ['sqlserver'], - 'ssh': ['shell', 'python', 'win_shell', 'raw'], + 'ssh': ['shell', 'python', 'win_shell', 'raw', 'huawei'], 'winrm': ['win_shell', 'shell'], } @@ -301,6 +301,11 @@ class JobExecution(JMSOrgBaseModel): shell += " chdir={}".format(self.current_job.chdir) if self.current_job.module in ['python']: shell += " executable={}".format(self.current_job.module) + + if module == JobModules.huawei.value: + module = 'ce_command' + shell = "commands=\"{}\" ".format(self.current_job.args) + return module, shell def get_runner(self):