@@ -59,6 +59,7 @@ def run_command(self, command):
59
59
ENV_TARGET_NAME = "TARGET"
60
60
ENV_REQUIRED_COLLECTION_NAME = "REQCOLLECTIONS"
61
61
ENV_REQUIRED_ROLE_NAME = "REROLE"
62
+ ENV_PIPPACKAGE_NAME = "PIPPACKAGE"
62
63
63
64
# check for target variable
64
65
env_target = EnvironmentManager (ENV_TARGET_NAME )
@@ -75,6 +76,10 @@ def run_command(self, command):
75
76
env_role = EnvironmentManager (ENV_REQUIRED_ROLE_NAME )
76
77
reqired_role = env_role .check_optional_environment_variable ()
77
78
79
+ # check for required role variable
80
+ env_pip = EnvironmentManager (ENV_PIPPACKAGE_NAME )
81
+ pip_pkg = env_pip .check_optional_environment_variable ()
82
+
78
83
# run ansible commands
79
84
ansible_version_checker = AnsibleCommandExecution ()
80
85
@@ -91,6 +96,12 @@ def run_command(self, command):
91
96
version_info = ansible_version_checker .run_command (ansible_command )
92
97
print (f"ROLE INSTALL SUCCESSFUL\n { version_info } " )
93
98
99
+ # Optionally install pip package
100
+ if bool (pip_pkg ):
101
+ ansible_command = ["pip" , "install" , "--upgrade" , f"{ pip_pkg } " ]
102
+ version_info = ansible_version_checker .run_command (ansible_command )
103
+ print (f"PIP PACKAGE INSTALL SUCCESSFUL\n { version_info } " )
104
+
94
105
# run ansible lint
95
106
ansible_command = ["ansible-lint" , f"{ target } " ]
96
107
linter_run = ansible_version_checker .run_command (ansible_command )
0 commit comments