Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On going work in getting the puppet-cloudstack module usuable #1

Merged
merged 6 commits into from Nov 21, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion manifests/init.pp
Expand Up @@ -29,7 +29,8 @@


yumrepo{ 'cloudstack':
baseurl => 'git@github.com:ke4qqq/puppet-cloudstack.git'
baseurl => 'http://cloudstack.apt-get.eu/rhel/4.1/',
# baseurl => 'http://cloudstack.apt-get.eu/rhel/4.0/',
enabled => 1,
gpgcheck => 0,
}
Expand Down
44 changes: 22 additions & 22 deletions manifests/kvmagent.pp
Expand Up @@ -16,58 +16,58 @@
class cloudstack::kvmagent {
include cloudstack

package { 'cloud-agent':
package { 'cloudstack-agent':
ensure => present,
require => Yumrepo[ 'cloudstack' ],
}

package { 'NetworkManager':
package { 'NetworkManager':
ensure => absent;
}

service { 'network':
service { 'network':
ensure => running,
enabled => true,
hasstatus => true,
requires => Package[ 'cloud-agent' ],
require => Package[ 'cloudstack-agent' ],
}

exec { '/usr/bin/cloud-setup-agent':
creates => '/var/log/cloud/setupAgent.log',
require => [
Package[ 'cloud-agent' ],
File[ '/etc/cloud/agent/agent.properties' ],
File_line[ 'cs_sudo_rule' ],
Host[ 'localhost' ],
],
}
# Needs params
#exec { '/usr/bin/cloudstack-setup-agent':
# creates => '/var/log/cloud/setupAgent.log',
# require => [
# Package[ 'cloudstack-agent' ],
# File[ '/etc/cloudstack/agent/agent.properties' ],
# File_line[ 'cs_sudo_rule' ],
# Host[ 'localhost' ],
# ],
#}


file { '/etc/cloud/agent/agent.properties':
file { '/etc/cloudstack/agent/agent.properties':
ensure => present,
require => Package[ 'cloud-agent' ],
require => Package[ 'cloudstack-agent' ],
content => template( 'cloudstack/agent.properties' ),
}

################## Firewall stuff #########################
#

firewall { "first range":
firewall { "001 first range ":
proto => 'tcp',
dport => '49152-49216',
jump => 'ACCEPT',
action => 'accept',
}

firewall { " 191 VNC rules":
firewall { "191 VNC rules":
proto => 'tcp',
dport => '5900-6100',
jump => 'ACCEPT',
action => 'accept',
}

firewall { " 192 port 16509":
firewall { "192 port 16509":
proto => 'tcp',
dport => '16509',
jump => 'accept',
action => 'accept',
}


Expand Down
88 changes: 55 additions & 33 deletions manifests/mgmt.pp
Expand Up @@ -26,89 +26,111 @@
ensure => present,
}

service { 'mysqld':
ensure => running,
enable => true,
service { 'mysqld':
ensure => running,
enable => true,
hasstatus => true,
require => Package[ 'mysql-server' ],
}
require => Package[ 'mysql-server' ],
}

######### END MYSQL #####################################

$dbstring = inline_template( "<%= \"/usr/bin/cloud-setup-databases \" +
$dbstring = inline_template( "<%= \"/usr/bin/cloudstack-setup-databases \" +
\"cloud:dbpassword@localhost --deploy-as=root\" %>" )
########### If you are using a separate database or different passwords, change it above


package { 'cloud-client':
package { 'cloudstack-management':
ensure => present,
require => Yumrepo[ 'cloudstack' ],
}

service { 'cloud-management':
service { 'cloudstack-management':
ensure => running,
enable => true,
hasstatus => true,
require => [Package[ 'cloud-client' ], Service[ 'mysqld' ] ],
hasstatus => true,
require => [Package[ 'cloudstack-management' ], Service[ 'mysqld' ] ],
}

exec { '/usr/bin/cloud-setup-management':
unless => [ '/usr/bin/test -e /etc/sysconfig/cloud-management' ],
require => [ Service[ 'cloud-management' ],
Exec[ 'cloud_setup_databases' ] ],
exec { '/usr/bin/cloudstack-setup-management':
unless => [ '/usr/bin/test -e /etc/sysconfig/cloudstack-management' ],
require => [ Service[ 'cloudstack-management' ],
Exec[ 'cloudstack_setup_databases' ] ],
}

exec { 'cloud_setup_databases':
exec { 'cloudstack_setup_databases':
command => $dbstring,
creates => '/var/lib/mysql/cloud',
require => Service[ 'mysqld' ],
}


######################################################
############## tomcat section ########################
######################################################


file { '/etc/cloudstack/management/tomcat6.conf':
ensure => 'link',
group => '0',
mode => '0777',
owner => '0',
target => 'tomcat6-nonssl.conf',
}

file { '/usr/share/cloudstack-management/conf/server.xml':
ensure => 'link',
group => '0',
mode => '0777',
owner => '0',
target => 'server-nonssl.xml',
}


######################################################
############ firewall section ########################
######################################################


firewall { '003 allow port 80 in':
proto => 'tcp',
dport => '80',
jump => 'accept',
proto => 'tcp',
dport => '80',
action => 'accept',
}


firewall { '120 permit 8080 - web interface':
proto => 'tcp',
dport => '8080',
jump => 'accept',
proto => 'tcp',
dport => '8080',
action => 'accept',
}

###### this is the unauthed API interface - should be locked down by default.
###### this is the unauthed API interface - should be locked down by default.
# firewall { '130 permit unauthed API':
# proto => 'tcp',
# dport => '8096',
# jump => 'accept',
# jump => 'accept',
# }
#


firewall { '8250 CPVM': #### Think this is for cpvm, but check for certain.
proto => 'tcp',
dport => '8250',
action => 'accept',
proto => 'tcp',
dport => '8250',
action => 'accept',
}

firewall { '9090 unk port': ############# find out what this does in cloudstack
proto => 'tcp',
dport => '9090',
action => 'accept',
proto => 'tcp',
dport => '9090',
action => 'accept',
}


}
########## SecStorage ############
## NOTE: This will take a LONG time to run. Go get a cup of coffee
# exec { 'mount ${cloudstack::cs_sec_storage_nfs_server}:${cloudstack::cs_sec_storage_mnt_point} /mnt ;
# ${cloudstack::system_tmplt_dl_cmd} -m /mnt -u ${cloudstack::sysvm_url_kvm} -h kvm -F ;
# exec { 'mount ${cloudstack::cs_sec_storage_nfs_server}:${cloudstack::cs_sec_storage_mnt_point} /mnt ;
# ${cloudstack::system_tmplt_dl_cmd} -m /mnt -u ${cloudstack::sysvm_url_kvm} -h kvm -F ;
# curl 'http://localhost:8096/?command=addSecondaryStorage&url=nfs://${cloudstack::cs_sec_storage_nfs_server}${cloudstack::cs_sec_storage_mnt_point}&zoneid=1' ;
# touch /var/lib/cloud/ssvm':
# onlyif => [ 'test ! -e /var/lib/cloud/ssvm', 'curl 'http://localhost:8096/?command=listZones&available=true' | grep Zone1',]
Expand All @@ -118,7 +140,7 @@
### THis needs to add a check for a host to have been added
# exec { 'curl 'http://localhost:8096/?command=createStoragePool&name=PStorage&url=nfs://${cloudstack::pri_storage_nfs_server}${cloudstack::pri_storage_mnt_point}&zoneid=4&podid=1'':
# onlyif => ['curl 'http://localhost:8096/?command=listPods' | grep Pod1',
# 'curl 'http://localhost:8096/?command=listStoragePools' | grep -v PStorage',
# 'curl 'http://localhost:8096/?command=listStoragePools' | grep -v PStorage',
# ]
# }

Expand Down