Namespaces: =: org.openstack.ci_cd_pipeline_murano_app.puppet std: io.murano res: io.murano.resources sys: io.murano.system ci_cd_pipeline_murano_app: org.openstack.ci_cd_pipeline_murano_app puppet: org.openstack.ci_cd_pipeline_murano_app.puppet net: org.openstack.ci_cd_pipeline_murano_app.utils.net Name: PuppetMasterApplication Extends: std:Application Properties: server: Contract: $.class(puppet:PuppetInstance) Usage: InOut clients: Contract: - $.class(puppet:PuppetClient) Usage: InOut name: Contract: $.string().notNull() Default: 'PuppetMaster' puppetfileLink: Contract: $.string().notNull() nodesStr: Contract: $.string().notNull() manifest: Contract: $.string().notNull() flavor: Contract: $.string().notNull() osImage: Contract: $.string().notNull() keyPair: Contract: $.string().notNull() availabilityZone: Contract: $.string().notNull() assignFloatingToMaster: Contract: $.bool().notNull() assignFloatingToSlaves: Contract: $.bool().notNull() Methods: initialize: Body: - $._environment: $.find(std:Environment).require() deploy: Body: - $._environment.reporter.report($this, 'Using Puppetfile to install={0}'.format($this.puppetfileLink)) - $nodes: $this.nodesStr.split() - $._environment.reporter.report($this, 'Nodes list={0}'.format($nodes)) - $rules: - FromPort: 1 ToPort: 65535 IpProtocol: tcp External: false - FromPort: 1 ToPort: 65535 IpProtocol: tcp External: true # puppet master port - FromPort: 8140 ToPort: 8140 IpProtocol: tcp External: false - $this._environment.securityGroupManager.addGroupIngress(rules => $rules) - Parallel: - If: $.server = null Then: - $this.server: new(puppet:PuppetInstance, $this._environment, name => 'master', flavor => $this.flavor, image => $this.osImage, keyname => $this.keyPair, availabilityZone => $this.availabilityZone, assignFloatingIp => $this.assignFloatingToMaster) - $this.server.deploy() - If: len($this.clients) = 0 Then: - $this.clients: $nodes.select( new( puppet:PuppetClient, $this._environment, instance => new( puppet:PuppetInstance, $this._environment, name => concat('puppet_', $), flavor => $this.flavor, image => $this.osImage, keyname => $this.keyPair, availabilityZone => $this.availabilityZone, assignFloatingIp => $this.assignFloatingToSlaves), role => $)) - $this.clients.pselect($.instance.deploy()) - $master: new( puppet:PuppetServer, masterInstance => $this.server, environment => $this._environment, manifest => $this.manifest) # add every node with the role assigned to it - $this.clients.select( $master.addClient($)) - $master.configure() - $master.installDependencies( environment => 'production', puppetfileLink => $this.puppetfileLink) - $this._environment.reporter.report( $this, 'Puppet master can be accessed on {0}'.format($.server.floatingIpAddress)) - $this.clients.select($this._environment.reporter.report($this, '{0} can be accessed on {1}'.format( $.role, $.instance.floatingIpAddress)))