Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- const Crypto = require( 'crypto' );
- const _ = require( 'lodash' );
- exports.seed = function( knex, Promise ) {
- return Promise.join(
- knex( 'operating_systems' ).del(),
- knex.insert([
- { created_at: knex.fn.now(), type: 'linux', flavor: 'Ubuntu', release: '7.10', code_name: 'gutsy', description: 'Ubuntu 7.10' },
- { created_at: knex.fn.now(), type: 'linux', flavor: 'CentOS', release: '6.7', code_name: null, description: 'CentOS release 6.7 (Final)' },
- { created_at: knex.fn.now(), type: 'linux', flavor: 'RedHat', release: '6', code_name: null, description: 'RedHat Enterprise Linux 6' },
- { created_at: knex.fn.now(), type: 'microsoft', flavor: '2008', release: 'r2', code_name: null, description: 'Windows Server 2008 r2' }
- ]).into( 'operating_systems' ),
- knex( 'servers' ).del(),
- knex.insert([
- { // 1
- created_at: knex.fn.now(),
- server_hostname: 'lpweb01.server.ad',
- monitoring: 1,
- operating_system_id: 1,
- root_password: Crypto.createHash('md5').update( 'str - ' + _.random(0, 20) ).digest('hex')
- }, { // 2
- created_at: knex.fn.now(),
- server_hostname: 'ldjen02.server.ad',
- monitoring: 1,
- operating_system_id: 2,
- root_password: Crypto.createHash('md5').update( 'str - ' + _.random(0, 20) ).digest('hex')
- }, { // 3
- created_at: knex.fn.now(),
- server_hostname: 'lpnag01.server.ad',
- monitoring: 1,
- operating_system_id: 3,
- root_password: Crypto.createHash('md5').update( 'str - ' + _.random(0, 20) ).digest('hex')
- }, { // 4
- created_at: knex.fn.now(),
- server_hostname: 'lpnag02.server.ad',
- monitoring: 1,
- operating_system_id: 3,
- root_password: Crypto.createHash('md5').update( 'str - ' + _.random(0, 20) ).digest('hex')
- }, { // 5
- created_at: knex.fn.now(),
- server_hostname: 'lqchef01.server.ad',
- monitoring: 1,
- operating_system_id: 2,
- root_password: Crypto.createHash('md5').update( 'str - ' + _.random(0, 20) ).digest('hex')
- }, { // 6
- created_at: knex.fn.now(),
- server_hostname: 'wpdir01.server.ad',
- monitoring: 1,
- operating_system_id: 4,
- root_password: Crypto.createHash('md5').update( 'str - ' + _.random(0, 20) ).digest('hex')
- }, { // 7
- created_at: knex.fn.now(),
- server_hostname: 'wpdir02.server.ad',
- monitoring: 1,
- operating_system_id: 4,
- root_password: Crypto.createHash('md5').update( 'str - ' + _.random(0, 20) ).digest('hex')
- }, { // 8
- created_at: knex.fn.now(),
- server_hostname: 'lptwst01.server.ad',
- monitoring: 1,
- operating_system_id: 1,
- root_password: Crypto.createHash('md5').update( 'str - ' + _.random(0, 20) ).digest('hex')
- }, { // 9
- created_at: knex.fn.now(),
- server_hostname: 'lpngnx01.server.ad',
- monitoring: 1,
- operating_system_id: 1,
- root_password: Crypto.createHash('md5').update( 'str - ' + _.random(0, 20) ).digest('hex')
- }, { // 10
- created_at: knex.fn.now(),
- server_hostname: 'wqbatch01.server.ad',
- monitoring: 0,
- operating_system_id: 1,
- root_password: Crypto.createHash('md5').update( 'str - ' + _.random(0, 20) ).digest('hex')
- }, { // 11
- created_at: knex.fn.now(),
- server_hostname: 'lscacti01.server.ad',
- monitoring: 0,
- operating_system_id: 1,
- root_password: Crypto.createHash('md5').update( 'str - ' + _.random(0, 20) ).digest('hex')
- }, { // 12
- created_at: knex.fn.now(),
- server_hostname: 'lqrhds01.server.ad',
- monitoring: 1,
- operating_system_id: 1,
- root_password: Crypto.createHash('md5').update( 'str - ' + _.random(0, 20) ).digest('hex')
- }, { // 13
- created_at: knex.fn.now(),
- server_hostname: 'lqrhds02.server.ad',
- monitoring: 1,
- operating_system_id: 1,
- root_password: Crypto.createHash('md5').update( 'str - ' + _.random(0, 20) ).digest('hex')
- }, { // 14
- created_at: knex.fn.now(),
- server_hostname: 'wsbamboo01.server.ad',
- monitoring: 1,
- operating_system_id: 1,
- root_password: Crypto.createHash('md5').update( 'str - ' + _.random(0, 20) ).digest('hex')
- }
- ]).into( 'servers' ),
- knex( 'applications' ).del(),
- knex.insert( [
- { created_at: knex.fn.now(), name: 'Apache', version: '2' }, // 1
- { created_at: knex.fn.now(), name: 'Nagios', version: '4' }, // 2
- { created_at: knex.fn.now(), name: 'Nginx', version: null }, // 3
- { created_at: knex.fn.now(), name: 'PHP', version: '5' }, // 4
- { created_at: knex.fn.now(), name: 'Jenkins', version: '1.642' }, // 5
- { created_at: knex.fn.now(), name: 'Chef Server', version: null }, // 6
- { created_at: knex.fn.now(), name: 'Tumbleweed', version: 1 }, // 7
- { created_at: knex.fn.now(), name: 'AD', version: null }, // 8
- { created_at: knex.fn.now(), name: 'Chef Client', version: null }, // 9
- { created_at: knex.fn.now(), name: 'Batch Server', version: null }, // 10
- { created_at: knex.fn.now(), name: 'LDAP', version: null }, // 11
- { created_at: knex.fn.now(), name: 'Cacti', version: null }, // 12
- { created_at: knex.fn.now(), name: 'Bamboo', version: null } // 13
- ]).into( 'applications' ),
- knex( 'applications_servers' ).del(),
- knex.insert( [
- // lpweb01: Apache, PHP, Chef Client
- { created_at: knex.fn.now(), server_id: 1, application_id: 1 },
- { created_at: knex.fn.now(), server_id: 1, application_id: 4 },
- { created_at: knex.fn.now(), server_id: 1, application_id: 9 },
- // lpngnx01: Nginx, PHP, Chef Client
- { created_at: knex.fn.now(), server_id: 9, application_id: 3 },
- { created_at: knex.fn.now(), server_id: 9, application_id: 4 },
- { created_at: knex.fn.now(), server_id: 9, application_id: 9 },
- // ldjen02: Jenkins, Chef Client
- { created_at: knex.fn.now(), server_id: 2, application_id: 5 },
- { created_at: knex.fn.now(), server_id: 2, application_id: 9 },
- // lpnag01 & lpnag02: Nagios, Chef Client
- { created_at: knex.fn.now(), server_id: 3, application_id: 2 },
- { created_at: knex.fn.now(), server_id: 3, application_id: 9 },
- { created_at: knex.fn.now(), server_id: 4, application_id: 2 },
- { created_at: knex.fn.now(), server_id: 4, application_id: 9 },
- // lqchef01: Chef Server
- { created_at: knex.fn.now(), server_id: 5, application_id: 6 },
- // wpdir01 & wpdir02: Active Directory
- { created_at: knex.fn.now(), server_id: 6, application_id: 8 },
- { created_at: knex.fn.now(), server_id: 7, application_id: 8 },
- // lptwst01: Tumbleweed, Chef Client
- { created_at: knex.fn.now(), server_id: 8, application_id: 7 },
- { created_at: knex.fn.now(), server_id: 8, application_id: 9 },
- // lscacti01: Cacti, Chef Client,
- { created_at: knex.fn.now(), server_id: 11, application_id: 9 },
- { created_at: knex.fn.now(), server_id: 11, application_id: 12 },
- // wqbatch01: Batch Server
- { created_at: knex.fn.now(), server_id: 10, application_id: 10 },
- // lqrhds01 & lqrhds02: LDAP, Chef Client
- { created_at: knex.fn.now(), server_id: 12, application_id: 11 },
- { created_at: knex.fn.now(), server_id: 13, application_id: 8 },
- { created_at: knex.fn.now(), server_id: 12, application_id: 11 },
- { created_at: knex.fn.now(), server_id: 13, application_id: 8 },
- // wsbamboo01: Bamboo
- { created_at: knex.fn.now(), server_id: 14, application_id: 13 }
- ]).into( 'applications_servers' )
- );
- };
Advertisement
Add Comment
Please, Sign In to add comment