update puppet
							parent
							
								
									ce61bdad8d
								
							
						
					
					
						commit
						29e8bbb666
					
				
										
											Binary file not shown.
										
									
								
							|  | @ -2,6 +2,11 @@ | ||||||
| 
 | 
 | ||||||
| class odoo { | class odoo { | ||||||
| 
 | 
 | ||||||
|  |     class { 'sudo': | ||||||
|  |       purge               => false, | ||||||
|  |       config_file_replace => false, | ||||||
|  |     } | ||||||
|  | 
 | ||||||
| 	user { odoo: | 	user { odoo: | ||||||
| 		ensure => present, | 		ensure => present, | ||||||
| 		shell => '/bin/bash', | 		shell => '/bin/bash', | ||||||
|  | @ -20,22 +25,24 @@ class odoo { | ||||||
|         key => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDBIg6NZV4tTs+J5qUP4/zQAn+Xi3muKqbaSDV8yYm50mH77PcLwbkZVlxdF0/OFCl5f5FCNp4Ag4Px97M35Nv+BweOTCZNMKOHmvtXY1fCRUQnk6ca3NlipImppL0U47SUzt9KkNIsz0FWxLu74LANgxKwrf8Hgim8Nkq8WrlvuoJCqf+542N15cGrf/9eD6yRm7AmdFi7VIYrP4m7TPbXJBGX+cXOo0bKTyaq8mtinbUN5UCi/eJ08wYkm/CGVxL+9cm6HOABw332A8OadAliCZBWqhFT0rBKdoWLxBbTsILALskrddpKLwBLOUIU79YeT0OfNpLCnVi8u67X9inl', |         key => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDBIg6NZV4tTs+J5qUP4/zQAn+Xi3muKqbaSDV8yYm50mH77PcLwbkZVlxdF0/OFCl5f5FCNp4Ag4Px97M35Nv+BweOTCZNMKOHmvtXY1fCRUQnk6ca3NlipImppL0U47SUzt9KkNIsz0FWxLu74LANgxKwrf8Hgim8Nkq8WrlvuoJCqf+542N15cGrf/9eD6yRm7AmdFi7VIYrP4m7TPbXJBGX+cXOo0bKTyaq8mtinbUN5UCi/eJ08wYkm/CGVxL+9cm6HOABw332A8OadAliCZBWqhFT0rBKdoWLxBbTsILALskrddpKLwBLOUIU79YeT0OfNpLCnVi8u67X9inl', | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     ssh_authorized_key { "stefan@camadeus": |  | ||||||
|         user => odoo, |  | ||||||
|         type => 'ssh-rsa', |  | ||||||
|         key  => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQC0Lv4GOvotyJRzPphIjf+UEzRzWZpGaEt5HiWBx9ih6aBnSLXx0O+PA8+ejN4dfMK3rAu3vdcXcI/egj9eJbIYWeHnE2k/gckCgk3Ttg2aq24cGDcgTDB0MdfLYSeFNxRsrLH4fFpPtvulNyu7ZPuXJj/BaIUHGGas+lUP3r+Bmhj2+guWlTMVMLFMENn3FUlrtMCiL7wIiXGQ+xXHhRAqG55t+CLxX0jaf57uCGkYKlkTfQAmnGMiUnUcxjileUDq8HRlANSqv2XRH/tjonP/bPqs0PySCU9rWEomSpertvdrO/8ZPCo3fjAKCyAAC6GS8uPJlQIoEMo2EVG8DrbX', |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     ssh_authorized_key { "joerg@camadeus": |     ssh_authorized_key { "joerg@camadeus": | ||||||
|         user => odoo, |         user => odoo, | ||||||
|         type => 'ssh-rsa', |         type => 'ssh-rsa', | ||||||
|         key  => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQC5wf8HJPMWf9+NGbrHxehVB/mWavztXx6v6hgsjvY+mg8V2eAHwKVvm8k9idvg/AqkMR6DbxC5GbMYcYP9drxcE5WhBFV5okR8o5h0/ZvpCmF8FQOZuR0NbRWA9ybVPfkn9thdMv3PI7iAMt+3Nh0g1QBEx/w7RRZ+/3LxSeGOGIFBtWja5hA94SLIunjKTyo2wPxyr3GZoGkG9KTN9f1iI4Imrg5kUXAXtT7rpJ1NdZdphYiuBZiZ9rAHymr9yJkXsSLxNWboqBsFoWSkFVc1CxGeqHNcEKO16wtOeGoJgsURM0wscWi+YjQXCYxLVY8a8JzeRLlMVhojk0zSfwdD', |         key  => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQC5wf8HJPMWf9+NGbrHxehVB/mWavztXx6v6hgsjvY+mg8V2eAHwKVvm8k9idvg/AqkMR6DbxC5GbMYcYP9drxcE5WhBFV5okR8o5h0/ZvpCmF8FQOZuR0NbRWA9ybVPfkn9thdMv3PI7iAMt+3Nh0g1QBEx/w7RRZ+/3LxSeGOGIFBtWja5hA94SLIunjKTyo2wPxyr3GZoGkG9KTN9f1iI4Imrg5kUXAXtT7rpJ1NdZdphYiuBZiZ9rAHymr9yJkXsSLxNWboqBsFoWSkFVc1CxGeqHNcEKO16wtOeGoJgsURM0wscWi+YjQXCYxLVY8a8JzeRLlMVhojk0zSfwdD', | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     ssh_authorized_key { "christian@camadeus": | 
 | ||||||
|         user => odoo, |     sshkey { "gitlab.datenpol.at": | ||||||
|         type => 'ssh-rsa', |         ensure => present, | ||||||
|         key  => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDt1sWm9vgxSzLLIU8KUJunWmJDpX3KNRgcDI8NeTEVTlfSBWniLzbur1qaQrl1WuC9rMTIZ3JarhknVue/7RPq2fjZU2n9wBCkwgtanvpmv7eLBckyGAmW5ctHWnvLcbEexl3YsgKfQJ10a1xCDY2+Vm+cLDCO6ZH7L0KlnboRryMiASxYA+C73/ySXWTKj0tO6kSuDvt48DgRbbeqTMpRrhHlab5svz37AkZtb3cPz3UnMh+a7OlqA6Q4EL4fLVAmAC5bBVi2bsYzSVxwqbnAn/OwtmfIUP3v0UsyW/D6F8De9UhSPm2lgc+ZtTpXqUzrnHDxjituD6vFZPSLzayz', |         type => "rsa", | ||||||
|  |         key  => "AAAAB3NzaC1yc2EAAAABIwAAAQEA06iMjK8mfl0MYClE91ilueqOA4Kx394xLZ4bJHFYUdalySAIPLJPQbtfO2cAjSDqJaq+lvCGdDyzQ8L+ZnNIhWea1FNA/QBHBSZEzsKsUPXUiL1gb0RUdPIgr24NJ4gQlLVf5SBRYPXv/JRE80TwEa7st1vkNiBzY+wt2IsLeEr+ekq0YufaODUxMfrHoAbqM4izdlWS9KVSWXdtnaFLnvYuY0d7nU9id8+ZSdLFzLrzIVuPRLVaRg00TYlxyUfLnyhKP+74GAtX9IG+yOwbzXONEjQYXsz6Ivhe6Z+fnWUrtAqyCvlvQxWXPgLNf3tCH9gnXXr3psjzNWpZDTGo6w==" | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     file { '/etc/ssh/ssh_known_hosts': | ||||||
|  |       ensure => file, | ||||||
|  |       owner  => 'root', | ||||||
|  |       group  => 'root', | ||||||
|  |       mode   => '0644', | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     class { 'postgresql::server': |     class { 'postgresql::server': | ||||||
|  | @ -44,15 +51,6 @@ class odoo { | ||||||
|         encoding => 'UTF8', |         encoding => 'UTF8', | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| #    # workaround for http://projects.puppetlabs.com/issues/4695 |  | ||||||
| #    # when PostgreSQL is installed with SQL_ASCII encoding instead of UTF8 |  | ||||||
| #    exec { 'utf8 postgres': |  | ||||||
| #       command => 'sudo -u postgres pg_dropcluster --stop 9.3 main ; pg_createcluster --start --locale en_US.UTF-8 9.3 main', |  | ||||||
| #       unless  => 'sudo -u postgres psql -t -c "\l" | grep template1 | grep -q UTF', |  | ||||||
| #       require => Class['postgresql::server'], |  | ||||||
| #       path    => ['/bin', '/sbin', '/usr/bin', '/usr/sbin'], |  | ||||||
| #    } |  | ||||||
| 
 |  | ||||||
|   file { "/var/log/odoo": |   file { "/var/log/odoo": | ||||||
|       owner => 'root', |       owner => 'root', | ||||||
|       group => 'root', |       group => 'root', | ||||||
|  | @ -111,23 +109,44 @@ class odoo { | ||||||
|                         # für wkhtmltox |                         # für wkhtmltox | ||||||
|                         'xfonts-base', |                         'xfonts-base', | ||||||
|                         'xfonts-75dpi', |                         'xfonts-75dpi', | ||||||
|  |                         'node-less' | ||||||
|                         ]: |                         ]: | ||||||
|                 ensure => present, |                 ensure => present, | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     exec { "/usr/bin/wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb": | ||||||
|  |         alias => "wkhtmltox", | ||||||
|  |         cwd => "/tmp", | ||||||
|  |         creates => '/tmp/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb' | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
| 	file { 'wkhtmltox': |     file { "wkthmltox": | ||||||
| 		name => "/tmp/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb", | 		name => "/tmp/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb", | ||||||
| 		owner => root, | 		owner => root, | ||||||
| 		group => root, | 		group => root, | ||||||
| 		source => "puppet:///modules/odoo/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb" |         ensure => present, | ||||||
| 	} |         alias => "wkhtmltox", | ||||||
|  |         require => Exec["wkhtmltox"] } | ||||||
|  | 
 | ||||||
|  | #	file { 'wkhtmltox': | ||||||
|  | #		name => "/tmp/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb", | ||||||
|  | #		owner => root, | ||||||
|  | #		group => root, | ||||||
|  | #		source => "puppet:///modules/odoo/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb" | ||||||
|  | #	} | ||||||
|  | 
 | ||||||
|  | #    wget::fetch { "wkhtmltox": | ||||||
|  | #      source      => 'http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb', | ||||||
|  | #      destination => '/tmp/', | ||||||
|  | #      timeout     => 0, | ||||||
|  | #      verbose     => true, | ||||||
|  | #    } | ||||||
| 
 | 
 | ||||||
|     package { 'wkhtmltox': |     package { 'wkhtmltox': | ||||||
|         provider => dpkg, |         provider => dpkg, | ||||||
|         ensure => installed, |         ensure => installed, | ||||||
|         source => "/tmp/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb", |         source => "/tmp/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb", | ||||||
|         require => [File['wkhtmltopdf'],Package['xfonts-base']], |         require => [FILE['wkhtmltox'],Package['xfonts-base']], | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     package {['passlib', |     package {['passlib', | ||||||
|  | @ -136,6 +155,7 @@ class odoo { | ||||||
|               'requests', |               'requests', | ||||||
|               'vatnumber', |               'vatnumber', | ||||||
|               'xlsxwriter', |               'xlsxwriter', | ||||||
|  |               'ofxparse' | ||||||
|               ]: |               ]: | ||||||
|         ensure   => installed, |         ensure   => installed, | ||||||
|         provider => 'pip', |         provider => 'pip', | ||||||
|  | @ -167,14 +187,6 @@ class odoo { | ||||||
| 	    ensure => "directory", | 	    ensure => "directory", | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|   	# Postfix setup |  | ||||||
| #	class { '::postfix::server': |  | ||||||
| #	  	myhostname              => 'test.camadeus.at', |  | ||||||
| #	  	mydomain                => 'camadeus.at', |  | ||||||
| #	  	mydestination           => "\$myhostname, localhost.\$mydomain, localhost, $fqdn", |  | ||||||
| #	  	inet_interfaces         => 'localhost', |  | ||||||
| #	} |  | ||||||
| 
 |  | ||||||
| 	# Default nginx file (prevent default server) REQUIRES SSL-key!!! | 	# Default nginx file (prevent default server) REQUIRES SSL-key!!! | ||||||
|     # Conf file |     # Conf file | ||||||
|     file { "/etc/nginx/conf.d/default.conf": |     file { "/etc/nginx/conf.d/default.conf": | ||||||
|  | @ -204,7 +216,7 @@ class odoo { | ||||||
|   	} |   	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| define odoo::instance ($db_pw,$ssl = false, $servername, $odooport, $odooport_longpolling) { | define odoo::instance ($db_pw,$ssl = false, $servername, $odooport, $odooport_longpolling, $gitrepo, $gitbranch) { | ||||||
|     $instance = $title |     $instance = $title | ||||||
| 
 | 
 | ||||||
|     include odoo |     include odoo | ||||||
|  | @ -223,13 +235,6 @@ define odoo::instance ($db_pw,$ssl = false, $servername, $odooport, $odooport_lo | ||||||
|         key => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDBIg6NZV4tTs+J5qUP4/zQAn+Xi3muKqbaSDV8yYm50mH77PcLwbkZVlxdF0/OFCl5f5FCNp4Ag4Px97M35Nv+BweOTCZNMKOHmvtXY1fCRUQnk6ca3NlipImppL0U47SUzt9KkNIsz0FWxLu74LANgxKwrf8Hgim8Nkq8WrlvuoJCqf+542N15cGrf/9eD6yRm7AmdFi7VIYrP4m7TPbXJBGX+cXOo0bKTyaq8mtinbUN5UCi/eJ08wYkm/CGVxL+9cm6HOABw332A8OadAliCZBWqhFT0rBKdoWLxBbTsILALskrddpKLwBLOUIU79YeT0OfNpLCnVi8u67X9inl', |         key => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDBIg6NZV4tTs+J5qUP4/zQAn+Xi3muKqbaSDV8yYm50mH77PcLwbkZVlxdF0/OFCl5f5FCNp4Ag4Px97M35Nv+BweOTCZNMKOHmvtXY1fCRUQnk6ca3NlipImppL0U47SUzt9KkNIsz0FWxLu74LANgxKwrf8Hgim8Nkq8WrlvuoJCqf+542N15cGrf/9eD6yRm7AmdFi7VIYrP4m7TPbXJBGX+cXOo0bKTyaq8mtinbUN5UCi/eJ08wYkm/CGVxL+9cm6HOABw332A8OadAliCZBWqhFT0rBKdoWLxBbTsILALskrddpKLwBLOUIU79YeT0OfNpLCnVi8u67X9inl', | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     $key_stefan="stefan@$instance" |  | ||||||
|     ssh_authorized_key { $key_stefan: |  | ||||||
|         user => $instance, |  | ||||||
|         type => 'ssh-rsa', |  | ||||||
|         key  => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQC0Lv4GOvotyJRzPphIjf+UEzRzWZpGaEt5HiWBx9ih6aBnSLXx0O+PA8+ejN4dfMK3rAu3vdcXcI/egj9eJbIYWeHnE2k/gckCgk3Ttg2aq24cGDcgTDB0MdfLYSeFNxRsrLH4fFpPtvulNyu7ZPuXJj/BaIUHGGas+lUP3r+Bmhj2+guWlTMVMLFMENn3FUlrtMCiL7wIiXGQ+xXHhRAqG55t+CLxX0jaf57uCGkYKlkTfQAmnGMiUnUcxjileUDq8HRlANSqv2XRH/tjonP/bPqs0PySCU9rWEomSpertvdrO/8ZPCo3fjAKCyAAC6GS8uPJlQIoEMo2EVG8DrbX', |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     $key_joerg="joerg@$instance" |     $key_joerg="joerg@$instance" | ||||||
|     ssh_authorized_key { $key_joerg: |     ssh_authorized_key { $key_joerg: | ||||||
|         user => odoo, |         user => odoo, | ||||||
|  | @ -237,13 +242,7 @@ define odoo::instance ($db_pw,$ssl = false, $servername, $odooport, $odooport_lo | ||||||
|         key  => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQC5wf8HJPMWf9+NGbrHxehVB/mWavztXx6v6hgsjvY+mg8V2eAHwKVvm8k9idvg/AqkMR6DbxC5GbMYcYP9drxcE5WhBFV5okR8o5h0/ZvpCmF8FQOZuR0NbRWA9ybVPfkn9thdMv3PI7iAMt+3Nh0g1QBEx/w7RRZ+/3LxSeGOGIFBtWja5hA94SLIunjKTyo2wPxyr3GZoGkG9KTN9f1iI4Imrg5kUXAXtT7rpJ1NdZdphYiuBZiZ9rAHymr9yJkXsSLxNWboqBsFoWSkFVc1CxGeqHNcEKO16wtOeGoJgsURM0wscWi+YjQXCYxLVY8a8JzeRLlMVhojk0zSfwdD', |         key  => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQC5wf8HJPMWf9+NGbrHxehVB/mWavztXx6v6hgsjvY+mg8V2eAHwKVvm8k9idvg/AqkMR6DbxC5GbMYcYP9drxcE5WhBFV5okR8o5h0/ZvpCmF8FQOZuR0NbRWA9ybVPfkn9thdMv3PI7iAMt+3Nh0g1QBEx/w7RRZ+/3LxSeGOGIFBtWja5hA94SLIunjKTyo2wPxyr3GZoGkG9KTN9f1iI4Imrg5kUXAXtT7rpJ1NdZdphYiuBZiZ9rAHymr9yJkXsSLxNWboqBsFoWSkFVc1CxGeqHNcEKO16wtOeGoJgsURM0wscWi+YjQXCYxLVY8a8JzeRLlMVhojk0zSfwdD', | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     $key_christian="christian@$instance" |     ssh_keygen { $instance: } | ||||||
|     ssh_authorized_key { $key_christian: |  | ||||||
|         user => odoo, |  | ||||||
|         type => 'ssh-rsa', |  | ||||||
|         key  => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDt1sWm9vgxSzLLIU8KUJunWmJDpX3KNRgcDI8NeTEVTlfSBWniLzbur1qaQrl1WuC9rMTIZ3JarhknVue/7RPq2fjZU2n9wBCkwgtanvpmv7eLBckyGAmW5ctHWnvLcbEexl3YsgKfQJ10a1xCDY2+Vm+cLDCO6ZH7L0KlnboRryMiASxYA+C73/ySXWTKj0tO6kSuDvt48DgRbbeqTMpRrhHlab5svz37AkZtb3cPz3UnMh+a7OlqA6Q4EL4fLVAmAC5bBVi2bsYzSVxwqbnAn/OwtmfIUP3v0UsyW/D6F8De9UhSPm2lgc+ZtTpXqUzrnHDxjituD6vFZPSLzayz', |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
|     $sudo_entry="$instance ALL = (root) NOPASSWD: /etc/init.d/odoo-server-$instance, /usr/sbin/service odoo-server-$instance *" |     $sudo_entry="$instance ALL = (root) NOPASSWD: /etc/init.d/odoo-server-$instance, /usr/sbin/service odoo-server-$instance *" | ||||||
|     sudo::conf { $instance: |     sudo::conf { $instance: | ||||||
|  | @ -306,43 +305,77 @@ define odoo::instance ($db_pw,$ssl = false, $servername, $odooport, $odooport_lo | ||||||
|       content => template('odoo/restart.sh.erb'), |       content => template('odoo/restart.sh.erb'), | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|     file { "/home/$instance/ext.git": |   file { "/home/$instance/update-source.sh": | ||||||
|       owner => $instance, |       owner => $instance, | ||||||
|       group => $instance, |       group => $instance, | ||||||
|         mode  => '0600', |       mode  => '0755', | ||||||
| 		ensure => "directory", |       ensure  => present, | ||||||
| 		recurse => true, |       content => template('odoo/update-source.sh.erb'), | ||||||
| 		require => Package[git], |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| 	file { "/home/$instance/ext": |     $gitdir="/home/$instance/ext" | ||||||
|  |     $giturl="ssh://git@gitlab.datenpol.at:122/odoo/$gitrepo.git" | ||||||
|  |     vcsrepo { $gitdir: | ||||||
|  |       ensure   => present, | ||||||
|  |       provider => git, | ||||||
|  |       source   => $giturl, | ||||||
|  |       revision => $gitbranch, | ||||||
|  |       user => 'ctba-prod' | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 	file { "/home/$instance/config": | ||||||
| 	    owner => $instance, | 	    owner => $instance, | ||||||
| 	    group => $instance, | 	    group => $instance, | ||||||
| 	    mode  => '0700', | 	    mode  => '0700', | ||||||
| 	    ensure => "directory", | 	    ensure => "directory", | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|     $git_requires = "File[/home/$instance/ext.git]" |       # Odoo config | ||||||
|     $git_create_cmd = "sudo -u $instance git init --bare /home/$instance/ext.git" |       file { "/home/$instance/config/odoo-server.conf": | ||||||
|     $git_unless_cmd = "sudo -u $instance test -e /home/$instance/ext.git/HEAD" |  | ||||||
|     $git_repo = "git_repo_$instance" |  | ||||||
|     exec { $git_repo: |  | ||||||
|         command => $git_create_cmd, |  | ||||||
|         unless  => $git_unless_cmd, |  | ||||||
|         path    => ['/bin', '/sbin', '/usr/bin', '/usr/sbin'], |  | ||||||
|         require => $git_requires, |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|   file { "/home/$instance/ext.git/hooks/post-receive": |  | ||||||
|           owner => $instance, |           owner => $instance, | ||||||
|           group => $instance, |           group => $instance, | ||||||
|           mode  => '0700', |           mode  => '0700', | ||||||
|           ensure  => present, |           ensure  => present, | ||||||
|       content => "#!/bin/bash |           content => template('odoo/odoo-server.conf.erb'), | ||||||
| git --work-tree=/home/$instance/ext --git-dir=/home/$instance/ext.git checkout -f", |  | ||||||
|       require => Exec[$git_repo], |  | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|  | #    file { "/home/$instance/ext.git": | ||||||
|  | #        owner => $instance, | ||||||
|  | #        group => $instance, | ||||||
|  | #        mode  => '0600', | ||||||
|  | #		ensure => "directory", | ||||||
|  | #		recurse => true, | ||||||
|  | #		require => Package[git], | ||||||
|  | #    } | ||||||
|  | 
 | ||||||
|  | #	file { "/home/$instance/ext": | ||||||
|  | #	    owner => $instance, | ||||||
|  | #	    group => $instance, | ||||||
|  | #	    mode  => '0700', | ||||||
|  | #	    ensure => "directory", | ||||||
|  | #	} | ||||||
|  | 
 | ||||||
|  | #    $git_requires = "File[/home/$instance/ext.git]" | ||||||
|  | #    $git_create_cmd = "sudo -u $instance git init --bare /home/$instance/ext.git" | ||||||
|  | #    $git_unless_cmd = "sudo -u $instance test -e /home/$instance/ext.git/HEAD" | ||||||
|  | #    $git_repo = "git_repo_$instance" | ||||||
|  | #    exec { $git_repo: | ||||||
|  | #        command => $git_create_cmd, | ||||||
|  | #        unless  => $git_unless_cmd, | ||||||
|  | #        path    => ['/bin', '/sbin', '/usr/bin', '/usr/sbin'], | ||||||
|  | #        require => $git_requires, | ||||||
|  | #    } | ||||||
|  | 
 | ||||||
|  | # file { "/home/$instance/ext.git/hooks/post-receive": | ||||||
|  | #      owner => $instance, | ||||||
|  | #      group => $instance, | ||||||
|  | #      mode  => '0700', | ||||||
|  | #      ensure  => present, | ||||||
|  | #      content => "#!/bin/bash | ||||||
|  | #git --work-tree=/home/$instance/ext --git-dir=/home/$instance/ext.git checkout -f", | ||||||
|  | #      require => Exec[$git_repo], | ||||||
|  | #  } | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
|       # backup |       # backup | ||||||
|       file { "/home/$instance/odoo-backup.sh": |       file { "/home/$instance/odoo-backup.sh": | ||||||
|  |  | ||||||
|  | @ -13,7 +13,7 @@ | ||||||
| ### END INIT INFO | ### END INIT INFO | ||||||
| 
 | 
 | ||||||
| PATH=/bin:/sbin:/usr/bin:/usr/local/bin | PATH=/bin:/sbin:/usr/bin:/usr/local/bin | ||||||
| DAEMON=/home/<%= @instance %>/ext/ext/odoo/odoo.py | DAEMON=/home/<%= @instance %>/ext/ext/odoo/odoo-bin | ||||||
| NAME=odoo-server-<%= @instance %> | NAME=odoo-server-<%= @instance %> | ||||||
| DESC=odoo-server-<%= @instance %> | DESC=odoo-server-<%= @instance %> | ||||||
| WORKING_DIR=/home/<%= @instance %>/ext/ext/odoo | WORKING_DIR=/home/<%= @instance %>/ext/ext/odoo | ||||||
|  | @ -23,7 +23,7 @@ FILTER="^<%= @instance %>" | ||||||
| USER=<%= @instance %> | USER=<%= @instance %> | ||||||
| 
 | 
 | ||||||
| # Specify an alternate config file (Default: /etc/openerp-server.conf). | # Specify an alternate config file (Default: /etc/openerp-server.conf). | ||||||
| CONFIGFILE="/home/<%= @instance %>/ext/ext/config/odoo-server.conf" | CONFIGFILE="/home/<%= @instance %>/config/odoo-server.conf" | ||||||
| 
 | 
 | ||||||
| PIDFILE=/var/run/$NAME.pid | PIDFILE=/var/run/$NAME.pid | ||||||
| LOGFILE=/var/log/odoo/<%= @instance %>/odoo-server.log | LOGFILE=/var/log/odoo/<%= @instance %>/odoo-server.log | ||||||
|  |  | ||||||
|  | @ -1,5 +1,8 @@ | ||||||
| #!/bin/sh | #!/bin/sh | ||||||
| # info:   restart Odoo server | # info:   restart Odoo server | ||||||
| # author: Camadeus GmbH | # author: datenpol gmbh | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | LOGFILE=deployment-history.txt | ||||||
| sudo /etc/init.d/odoo-server-<%= @instance %> restart | sudo /etc/init.d/odoo-server-<%= @instance %> restart | ||||||
|  | echo "Restart `date`" >> $LOGFILE | ||||||
|  |  | ||||||
|  | @ -0,0 +1,9 @@ | ||||||
|  | #!/bin/bash | ||||||
|  | # author: datenpol gmbh | ||||||
|  | 
 | ||||||
|  | LOGFILE=../deployment-history.txt | ||||||
|  | 
 | ||||||
|  | cd ext | ||||||
|  | git pull | ||||||
|  | git log --pretty=format:"%h - %an, %ad : %s" -1 >> $LOGFILE | ||||||
|  | echo "" >> $LOGFILE | ||||||
|  | @ -2,6 +2,7 @@ | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| HOST='tbd' | HOST='tbd' | ||||||
|  | PORT=22 | ||||||
| 
 | 
 | ||||||
| if [ $# -lt 1 ] || [ $# -gt 1 ]; then | if [ $# -lt 1 ] || [ $# -gt 1 ]; then | ||||||
|     echo "Usage: ./setup_server.sh <init|update>" |     echo "Usage: ./setup_server.sh <init|update>" | ||||||
|  | @ -21,11 +22,14 @@ TYPE=$1 | ||||||
| USER=root | USER=root | ||||||
| 
 | 
 | ||||||
| if [ "$TYPE" = "init" ]; then | if [ "$TYPE" = "init" ]; then | ||||||
| 	ssh ${USER}@$HOST "apt-get update; apt-get install puppet; sudo echo '$HOST' > /etc/hostname; sudo /etc/init.d/hostname.sh start;" | 	ssh -p ${PORT} ${USER}@$HOST "apt-get update; apt-get install puppet;" | ||||||
| 	ssh ${USER}@${HOST} "sudo apt-get install rsync" | 	ssh -p ${PORT} ${USER}@${HOST} "sudo apt-get install rsync" | ||||||
| 	ssh ${USER}@${HOST} "sudo puppet module install puppetlabs-postgresql" | 	ssh -p ${PORT} ${USER}@${HOST} "sudo puppet module install puppetlabs-postgresql" | ||||||
| 	ssh ${USER}@${HOST} "sudo puppet module install saz-sudo" | 	ssh -p ${PORT} ${USER}@${HOST} "sudo puppet module install saz-sudo" | ||||||
| 	ssh ${USER}@${HOST} "sudo puppet module install thias-postfix" | 	ssh -p ${PORT} ${USER}@${HOST} "sudo puppet module install maestrodev-ssh_keygen" | ||||||
|  | 	ssh -p ${PORT} ${USER}@${HOST} "sudo puppet module install puppetlabs-vcsrepo" | ||||||
|  | 	ssh -p ${PORT} ${USER}@${HOST} "sudo puppet module install maestrodev-wget" | ||||||
|  | 
 | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| if [ "$TYPE" = "update" ]; then | if [ "$TYPE" = "update" ]; then | ||||||
|  | @ -33,10 +37,10 @@ if [ "$TYPE" = "update" ]; then | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| # Copy to server | # Copy to server | ||||||
| rsync -av --copy-links "site.pp" "${USER}@${HOST}:/tmp/site.pp" | rsync -av -e "ssh -p ${PORT}" --copy-links "site.pp" "${USER}@${HOST}:/tmp/site.pp" | ||||||
| rsync -arv --copy-links "modules" "${USER}@${HOST}:/tmp" | rsync -arv -e "ssh -p ${PORT}" --copy-links "modules" "${USER}@${HOST}:/tmp" | ||||||
| 
 | 
 | ||||||
| ssh ${USER}@${HOST} "sudo mv -f /tmp/site.pp /etc/puppet/manifests/site.pp" | ssh  -p ${PORT} ${USER}@${HOST} "sudo mv -f /tmp/site.pp /etc/puppet/manifests/site.pp" | ||||||
| ssh ${USER}@${HOST} "sudo rm -rf /etc/puppet/modules/odoo; sudo mv /tmp/modules/odoo /etc/puppet/modules; sudo rm -rf /tmp/modules" | ssh  -p ${PORT} ${USER}@${HOST} "sudo rm -rf /etc/puppet/modules/odoo; sudo mv /tmp/modules/odoo /etc/puppet/modules; sudo rm -rf /tmp/modules" | ||||||
| 
 | 
 | ||||||
| ssh ${USER}@${HOST} "sudo puppet apply /etc/puppet/manifests/site.pp" | ssh  -p ${PORT} ${USER}@${HOST} "sudo puppet apply /etc/puppet/manifests/site.pp" | ||||||
|  |  | ||||||
|  | @ -2,12 +2,24 @@ | ||||||
| node default { | node default { | ||||||
| 
 | 
 | ||||||
| 	TODO | 	TODO | ||||||
|     odoo::instance {'TODO': |     odoo::instance {'TODO-prod': | ||||||
|       db_pw => 'x54ef6t77t6ZZul3', |       db_pw => 'x54ef6t77t6ZZul3', | ||||||
|       ssl => true, |       ssl => true, | ||||||
|       servername => 'TODO.camadeus.at', |       servername => 'TODO.datenpol.at', | ||||||
|       odooport => 8069, |       odooport => 8069, | ||||||
|       odooport_longpolling => 8070, |       odooport_longpolling => 8070, | ||||||
|  |       gitrepo => 'TODO', | ||||||
|  |       gitbranch => 'master' | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     odoo::instance {'TODO-test': | ||||||
|  |       db_pw => '9fd87sdfXXdfTs', | ||||||
|  |       ssl => true, | ||||||
|  |       servername => 'TODO.datenpol.at', | ||||||
|  |       odooport => 8169, | ||||||
|  |       odooport_longpolling => 8170, | ||||||
|  |       gitrepo => 'TODO', | ||||||
|  |       gitbranch => 'develop' | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
		Loading…
	
		Reference in New Issue