Created
February 16, 2012 03:15
-
-
Save sycobuny/1841425 to your computer and use it in GitHub Desktop.
Revisions
-
sycobuny revised this gist
Feb 16, 2012 . 1 changed file with 2 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,11 +27,7 @@ default => "${basedir}/${project}", } git::repository { $project: } exec { "git-web-reset-${name}": logoutput => on_failure, @@ -72,7 +68,7 @@ require => Exec["git-web-tag-${name}"], ensure => link, path => "/etc/httpd/conf.d/${project}.conf", target => "$mydir/conf/${project}.conf", } } } -
sycobuny revised this gist
Feb 16, 2012 . 1 changed file with 38 additions and 23 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,17 @@ class git { package { 'git': ensure => installed, } define repository($project = $name, $cwd, $dir = "$cwd/${project}", $repo = "githost:${project}.git", $no_ensure = 0) { $require = $no_ensure ? { 1 => [Package['git']], default => [Package['git'], File[$cwd]], } include git exec { "git-clone-${name}": require => $require, command => "git clone ${repo} ${dir}", @@ -19,35 +21,48 @@ } } define web_project($project = $name, $basedir = "/var/www", $dir = undef) { $mydir = "$dir" ? { /./ => $dir, default => "${basedir}/${project}", } git::repository { $project: cwd => $basedir, repo => "githost:/repo/${project}.git", no_ensure => 1, } exec { "git-web-reset-${name}": logoutput => on_failure, require => Git::Repository[$project], command => "git reset --hard HEAD", cwd => $mydir, user => root, } exec { "git-web-clean-${name}": logoutput => on_failure, require => Exec["git-web-reset-${name}"], command => "git clean -f", cwd => $mydir, user => root, } exec { "git-web-fetch-${name}": logoutput => on_failure, require => Exec["git-web-clean-${name}"], command => "git fetch origin", cwd => $mydir, user => root, } exec { "git-web-tag-${name}": logoutput => on_failure, require => Exec["git-web-fetch-${name}"], command => "git checkout \"release-\$(git tag | cut -d\\- -f2 | sort -rn | head -n1)\"", cwd => $mydir, user => root, } file { "git-web-conf-${name}": @@ -57,7 +72,7 @@ require => Exec["git-web-tag-${name}"], ensure => link, path => "/etc/httpd/conf.d/${project}.conf", target => "$mydir/${project}.conf", } } } -
sycobuny revised this gist
Feb 16, 2012 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,7 +19,9 @@ } } define web_project($project = $name, $basedir = "/var/www", $dir = "$basedir/${project}") { git::repository { $project: cwd => $basedir } exec { "git-web-reset-${name}": require => Git::Repository[$project], command => "git reset --hard HEAD", -
sycobuny revised this gist
Feb 16, 2012 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,6 +14,7 @@ require => $require, command => "git clone ${repo} ${dir}", cwd => $cwd, user => root, creates => $dir, } } @@ -23,27 +24,34 @@ require => Git::Repository[$project], command => "git reset --hard HEAD", cwd => $dir, user => root, } exec { "git-web-clean-${name}": require => Exec["git-web-reset-${name}"], command => "git clean -f", cwd => $dir, user => root, } exec { "git-web-fetch-${name}": require => Exec["git-web-clean-${name}"], command => "git fetch origin", cwd => $dir, user => root, } exec { "git-web-tag-${name}": require => Exec["git-web-fetch-${name}"], command => "git checkout \"release-\$(git tag | cut -d\\- -f2 | sort -rn | head -n1)\"", cwd => $dir, user => root, } file { "git-web-conf-${name}": owner => root, group => root, mode => 0644, require => Exec["git-web-tag-${name}"], ensure => link, path => "/etc/httpd/conf.d/${project}.conf", -
sycobuny revised this gist
Feb 16, 2012 . 1 changed file with 15 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ default => [Package['git-core'], File[$cwd]], } exec { "git-clone-${name}": require => $require, command => "git clone ${repo} ${dir}", cwd => $cwd, @@ -19,28 +19,35 @@ } define web_project($project = $name, $dir = "/var/www/${project}") { exec { "git-web-reset-${name}": require => Git::Repository[$project], command => "git reset --hard HEAD", cwd => $dir, } exec { "git-web-clean-${name}": require => Exec["git-web-reset-${name}"], command => "git clean -f", cwd => $dir, } exec { "git-web-fetch-${name}": require => Exec["git-web-clean-${name}"], command => "git fetch origin", cwd => $dir, } exec { "git-web-tag-${name}": require => Exec["git-web-fetch-${name}"], command => "git checkout \"release-\$(git tag | cut -d\\- -f2 | sort -rn | head -n1)\"", cwd => $dir, } file { "git-web-conf-${name}": require => Exec["git-web-tag-${name}"], ensure => link, path => "/etc/httpd/conf.d/${project}.conf", target => "$dir/${project}.conf", } } } -
sycobuny revised this gist
Feb 16, 2012 . 1 changed file with 16 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,9 +3,24 @@ ensure => installed, } define repository($project = $name, $cwd, $dir = "$cwd/${project}", $repo = "git@githost:${project}.git", $no_ensure => 0) { $require = $no_ensure ? { 1 => [Package['git-core']], default => [Package['git-core'], File[$cwd]], } exec { "web-git-clone-${name}": require => $require, command => "git clone ${repo} ${dir}", cwd => $cwd, creates => $dir, } } define web_project($project = $name, $dir = "/var/www/${project}") { exec { "web-git-reset-${name}": require => Git::Repository[$project], command => "git reset --hard HEAD", cwd => $dir, } -
sycobuny renamed this gist
Feb 16, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
sycobuny renamed this gist
Feb 16, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
sycobuny renamed this gist
Feb 16, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
sycobuny renamed this gist
Feb 16, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
sycobuny created this gist
Feb 16, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ class git { package { 'git-core': ensure => installed, } define web_project($project = $name, $dir = "/var/www/${project}") { exec { "web-git-reset-${name}": require => Package['git-core'], command => "git reset --hard HEAD", cwd => $dir, } exec { "web-git-clean-${name}": require => Exec["web-git-reset-${name}"], command => "git clean -f", cwd => $dir, } exec { "web-git-fetch-${name}": require => Exec["web-git-clean-${name}"], command => "git fetch origin", cwd => $dir, } exec { "web-git-checkout-${name}": require => Exec["web-git-fetch-${name}"], command => "git checkout \"release-\$(git tag | cut -d\\- -f2 | sort -rn | head -n1)\"", cwd => $dir, } } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ node webserver { # various setup for web server $git_web_projects = ['blog', 'analytics', 'main_site'] git::web_project { $git_web_projects: } }