76 lines
2.2 KiB
YAML
76 lines
2.2 KiB
YAML
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
Namespaces:
|
|
=: com.example.activeDirectory
|
|
res: io.murano.resources
|
|
std: io.murano
|
|
sys: io.murano.system
|
|
|
|
Name: Host
|
|
|
|
Extends: res:WindowsInstance
|
|
|
|
Properties:
|
|
adminAccountName:
|
|
Contract: $.string().notNull()
|
|
Default: Administrator
|
|
|
|
adminPassword:
|
|
Contract: $.string().notNull()
|
|
|
|
Methods:
|
|
.init:
|
|
Body:
|
|
- $._environment: $.find(std:Environment).require()
|
|
|
|
deploy:
|
|
Body:
|
|
- $.super($.deploy())
|
|
|
|
# Deploy host only once
|
|
- If: $.getAttr(hostDeployed, false)
|
|
Then:
|
|
- Return:
|
|
- $._environment.reporter.report($this, 'Setting up password')
|
|
- $resources: new(sys:Resources)
|
|
- $template: $resources.json('SetPassword.template').bind(dict(
|
|
adminPassword => $.adminPassword
|
|
))
|
|
- $.agent.send($template, $resources)
|
|
|
|
- $.setAttr(hostDeployed, true)
|
|
|
|
joinDomain:
|
|
Arguments:
|
|
- domain:
|
|
Contract: $.class(ActiveDirectory).notNull()
|
|
Body:
|
|
|
|
# Join domain only once
|
|
- If: $.getAttr(hostIsDomainMember, false)
|
|
Then:
|
|
- Return:
|
|
|
|
- $resources: new(sys:Resources)
|
|
- $._environment.reporter.report($this, format('Joining host to {0} domain', $domain.name))
|
|
- $template: $resources.json('JoinDomain.template').bind(dict(
|
|
domain => $domain.name,
|
|
domainUser => $domain.adminAccountName,
|
|
domainPassword => $domain.adminPassword,
|
|
ouPath => '',
|
|
dnsIp => $domain.primaryController.dnsIp
|
|
))
|
|
- $.agent.call($template, $resources, 1800)
|
|
|
|
- $.setAttr(hostIsDomainMember, true)
|