mirror of
https://github.com/mmumshad/ansible-playable.git
synced 2025-02-12 17:01:54 +00:00
Add option to disable adding custom ansible host engine
This commit is contained in:
parent
2fc2040882
commit
f06bd10330
9 changed files with 95 additions and 54 deletions
|
@ -63,6 +63,10 @@ The tool currently supports the following features and functionality:
|
|||
- Auto update documentation and parameter section based on user input
|
||||
- Provides default properties and available types in UI
|
||||
- Test developed custom module
|
||||
- Admin
|
||||
- View list of users
|
||||
- Delete Users
|
||||
- View System and Server logs from the Admin tab
|
||||
|
||||
### Prerequisites
|
||||
|
||||
|
|
|
@ -7,12 +7,15 @@ import routes from './project.routes';
|
|||
|
||||
export class ProjectComponent {
|
||||
/*@ngInject*/
|
||||
constructor($scope, Projects, Auth, appConfig) {
|
||||
constructor($scope, Projects, Auth, appConfig, system) {
|
||||
'ngInject';
|
||||
var default_project_folder = '/opt/ehc-ansible-projects/';
|
||||
|
||||
var projectCtrl = this;
|
||||
|
||||
system.getConfigDisableAnsibleHostAddition((response) => {
|
||||
projectCtrl.disableAnsibleHostAddition = response.data;
|
||||
console.log(projectCtrl.disableAnsibleHostAddition)
|
||||
});
|
||||
|
||||
// Define a blank project object
|
||||
projectCtrl.blankProject = {
|
||||
name: '',
|
||||
|
|
|
@ -10,40 +10,47 @@
|
|||
<input type="text" ng-model="projectCtrl.newProject.name" class="form-control" ng-required="true">
|
||||
</p>
|
||||
|
||||
<p class="form-group">
|
||||
<label>Ansible Host</label>
|
||||
<input type="text" ng-model="projectCtrl.newProject.ansibleEngine.ansibleHost" class="form-control">
|
||||
<div class="hint">Ansible Controller system - A linux system with Ansible Installed on it. Required if you want to execute Ansible playbooks. You could skip this and still generate playbooks but not test them.</div>
|
||||
</p>
|
||||
<div class="alert alert-warning" ng-if="projectCtrl.disableAnsibleHostAddition == 'true'">
|
||||
Adding a custom Ansible Engine (Ansible Controller) is disabled in the demo mode.
|
||||
</div>
|
||||
|
||||
<p class="form-group" ng-if="projectCtrl.newProject.ansibleEngine.ansibleHost">
|
||||
<label>User</label>
|
||||
<input type="text" ng-model="projectCtrl.newProject.ansibleEngine.ansibleHostUser" class="form-control">
|
||||
</p>
|
||||
<div ng-if="projectCtrl.disableAnsibleHostAddition != 'true'">
|
||||
<p class="form-group">
|
||||
<label>Ansible Host</label>
|
||||
<input type="text" ng-model="projectCtrl.newProject.ansibleEngine.ansibleHost" class="form-control">
|
||||
<div class="hint">Ansible Controller system - A linux system with Ansible Installed on it. Required if you want to execute Ansible playbooks. You could skip this and still generate playbooks but not test them.</div>
|
||||
</p>
|
||||
|
||||
<p class="form-group" ng-if="projectCtrl.newProject.ansibleEngine.ansibleHost">
|
||||
<label>Host Password</label>
|
||||
<input type="password" ng-model="projectCtrl.newProject.ansibleEngine.ansibleHostPassword" class="form-control">
|
||||
</p>
|
||||
<p class="form-group" ng-if="projectCtrl.newProject.ansibleEngine.ansibleHost">
|
||||
<label>User</label>
|
||||
<input type="text" ng-model="projectCtrl.newProject.ansibleEngine.ansibleHostUser" class="form-control">
|
||||
</p>
|
||||
|
||||
<p class="form-group" ng-if="projectCtrl.newProject.ansibleEngine.ansibleHost">
|
||||
<label>Project Folder</label>
|
||||
<input ng-readonly="projectCtrl.editProjectFlag" ng-model="projectCtrl.newProject.ansibleEngine.projectFolder" class="form-control">
|
||||
<p class="form-group" ng-if="projectCtrl.newProject.ansibleEngine.ansibleHost">
|
||||
<label>Host Password</label>
|
||||
<input type="password" ng-model="projectCtrl.newProject.ansibleEngine.ansibleHostPassword" class="form-control">
|
||||
</p>
|
||||
|
||||
<p class="form-group" ng-if="projectCtrl.newProject.ansibleEngine.ansibleHost">
|
||||
<label>Project Folder</label>
|
||||
<input ng-readonly="projectCtrl.editProjectFlag" ng-model="projectCtrl.newProject.ansibleEngine.projectFolder" class="form-control">
|
||||
<div ng-if="projectCtrl.newProject.ansibleEngine.ansibleHost" class="hint">A directory path on the Ansible Host to store files of this project </div>
|
||||
</p>
|
||||
</p>
|
||||
|
||||
<p class="form-group" ng-if="projectCtrl.newProject.ansibleEngine.ansibleHost">
|
||||
<label>Custom Modules Location</label>
|
||||
<input ng-readonly="projectCtrl.editProjectFlag" ng-model="projectCtrl.newProject.ansibleEngine.customModules" class="form-control">
|
||||
<p class="form-group" ng-if="projectCtrl.newProject.ansibleEngine.ansibleHost">
|
||||
<label>Custom Modules Location</label>
|
||||
<input ng-readonly="projectCtrl.editProjectFlag" ng-model="projectCtrl.newProject.ansibleEngine.customModules" class="form-control">
|
||||
<div ng-if="projectCtrl.newProject.ansibleEngine.ansibleHost" class="hint">A directory path on the Ansible Host to store custom modules for this project </div>
|
||||
</p>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<button class="btn btn-success" ng-disabled="!projectCtrl.newProject.name" ng-click="projectCtrl.createProject()"> Save <span class="fa {{projectCtrl.saveButtonIcon}}"></span></button>
|
||||
<button class="btn btn-warning" ng-click="projectCtrl.hideProjectForm()"> Cancel <span class="fa fa-times"></span></button>
|
||||
|
||||
</form>
|
||||
|
||||
<div ng-if="msg" class="alert alert-{{ projectCtrl.msg_status }}">{{ projectCtrl.msg }}</div>
|
||||
<div ng-if="projectCtrl.msg" class="alert alert-{{ projectCtrl.msg_status }}">{{ projectCtrl.msg }}</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -7,9 +7,14 @@ export function systemService($http) {
|
|||
|
||||
const api_system = '/api/system';
|
||||
const api_get_logs = api_system + '/logs';
|
||||
const get_config_disable_ansible_host_addition = api_system + '/config/disable_ansible_host_addition';
|
||||
|
||||
this.getLogs = function(type, successCallback, errorCallback){
|
||||
$http.get(api_get_logs + '/' + type).then(successCallback, errorCallback);
|
||||
};
|
||||
|
||||
this.getConfigDisableAnsibleHostAddition = function(successCallback, errorCallback){
|
||||
$http.get(get_config_disable_ansible_host_addition).then(successCallback, errorCallback);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -109,6 +109,10 @@ export function create(req, res) {
|
|||
req.body.owner_id = req.user._id;
|
||||
req.body.owner_name = req.user.name;
|
||||
|
||||
if(config.disableAnsibleHostAddition == "true" && ansibleEngine.ansibleHost && ansibleEngine.ansibleHost !== 'localhost'){
|
||||
return res.status(500).send("Unable to add a custom Ansible Engine as ENV variable DISABLE_ANSIBLE_HOST_ADDITION is set to true")
|
||||
}
|
||||
|
||||
// Set default values
|
||||
if(!ansibleEngine.ansibleHost){
|
||||
ansibleEngine = {
|
||||
|
|
|
@ -7,5 +7,6 @@ var router = express.Router();
|
|||
|
||||
router.get('/logs/server', controller.serverLogs);
|
||||
router.get('/logs/api', controller.apiLogs);
|
||||
router.get('/config/disable_ansible_host_addition', controller.getConfigDisableAnsibleHostAddition);
|
||||
|
||||
module.exports = router;
|
||||
|
|
|
@ -88,3 +88,9 @@ exports.apiLogs = function(req,res){
|
|||
})
|
||||
|
||||
};
|
||||
|
||||
exports.getConfigDisableAnsibleHostAddition = function(req,res){
|
||||
|
||||
res.send(config.disableAnsibleHostAddition);
|
||||
|
||||
};
|
||||
|
|
|
@ -4,11 +4,11 @@ exports = module.exports = {
|
|||
version: 'Alpha',
|
||||
// List of user roles
|
||||
userRoles: ['guest', 'user', 'admin'],
|
||||
'scriptEngine' : {
|
||||
'host' : process.env.SCRIPT_ENGINE_HOST || 'localhost',
|
||||
'user' : process.env.SCRIPT_ENGINE_USER || 'root',
|
||||
'scriptEngine': {
|
||||
'host': process.env.SCRIPT_ENGINE_HOST || 'localhost',
|
||||
'user': process.env.SCRIPT_ENGINE_USER || 'root',
|
||||
// This is the default root password for local container set during docker container rebuild
|
||||
'password' : process.env.SCRIPT_ENGINE_PASSWORD || 'P@ssw0rd@123'
|
||||
'password': process.env.SCRIPT_ENGINE_PASSWORD || 'P@ssw0rd@123'
|
||||
},
|
||||
|
||||
paths: {
|
||||
|
@ -28,29 +28,34 @@ exports = module.exports = {
|
|||
},
|
||||
|
||||
disablePlayboookExecution: process.env.DISABLE_PLAYBOOK_EXECUTION || false,
|
||||
// Disable adding a separate ansible host than localhost
|
||||
disableAnsibleHostAddition: process.env.DISABLE_ANSIBLE_HOST_ADDITION || false,
|
||||
|
||||
videos: [
|
||||
{
|
||||
title: 'Overview',
|
||||
type: 'overview',
|
||||
video_id: '6sE0Gqcw_4U'
|
||||
},
|
||||
{
|
||||
title: 'Getting Started',
|
||||
type: 'getting_started'
|
||||
},
|
||||
{
|
||||
title: 'Google Cloud Example',
|
||||
type: 'google_cloud'
|
||||
},
|
||||
{
|
||||
title: 'VMWare Example',
|
||||
type: 'vmware'
|
||||
},
|
||||
{
|
||||
title: 'Custom Modules',
|
||||
type: 'custom_module'
|
||||
}
|
||||
]
|
||||
videos
|
||||
:
|
||||
[
|
||||
{
|
||||
title: 'Overview',
|
||||
type: 'overview',
|
||||
video_id: '6sE0Gqcw_4U'
|
||||
},
|
||||
{
|
||||
title: 'Getting Started',
|
||||
type: 'getting_started'
|
||||
},
|
||||
{
|
||||
title: 'Google Cloud Example',
|
||||
type: 'google_cloud'
|
||||
},
|
||||
{
|
||||
title: 'VMWare Example',
|
||||
type: 'vmware'
|
||||
},
|
||||
{
|
||||
title: 'Custom Modules',
|
||||
type: 'custom_module'
|
||||
}
|
||||
]
|
||||
|
||||
};
|
||||
}
|
||||
;
|
||||
|
|
|
@ -24,5 +24,11 @@ module.exports = {
|
|||
|
||||
MONGODB_URI_DEV: 'mongodb://localhost/dev',
|
||||
|
||||
DISABLE_PLAYBOOK_EXECUTION: true
|
||||
DISABLE_PLAYBOOK_EXECUTION: true,
|
||||
DISABLE_ANSIBLE_HOST_ADDITION: true,
|
||||
|
||||
PASSWORD_TEST: 'test',
|
||||
PASSWORD_ADMIN: 'admin',
|
||||
|
||||
SEED_DB: false
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue