Arne Mohr
2012-Aug-02 15:12 UTC
[Puppet Users] launching ec2 instance: running java maven build in puppet fails
Hi, i have a Problem with puppet and maven. At the moment I''m trying to launch an ec2 instance which automatically set''s up itself. In order to do so. I''m passing an cloud-init script within the user-data field on startup. #cloud-config apt_upgrade: true runcmd: - chown ubuntu /mnt - [ su, -c, "( git clone https://myRepo /mnt/init )", ubuntu ] - sudo puppet apply /mnt/init/src/main/puppet/init.pp My puppet "script" package { "openjdk-6-jdk": ensure => "installed" } package { "imagemagick": ensure => "installed" } package { "libjpeg62": ensure => "installed" } package { "maven": ensure => "installed" } package { "tomcat7": ensure => "installed" } exec { "build_myApp_server": command => "sudo mvn -f /mnt/init/pom.xml -s /mnt/init/src/main/puppet/mvn_settings.xml clean package |sudo tee -a /mnt/mvn.log", path => "/usr/bin/" } exec { "rm_old_root": command => "sudo rm -Rf /var/lib/tomcat7/webapps/ROOT*", path => "/usr/bin/" } exec { "copy_war": command => "sudo cp /mnt/init/target/myApp*war /var/lib/tomcat7/webapps/ROOT.war", path => "/usr/bin/" } exec { "restart_tomcat": command => "sudo service tomcat7 restart", path => "/usr/bin/" } service { "tomcat7": ensure => "running", enable => true } When the script is executed during the cloud-init phase, the maven build fails or is not going to be executed. I don''t know why. If i execute it on my own by running sudo puppet apply /mnt/init/src/main/puppet/init.pp everything works fine. Maybe somebody has an idea why this setup is not working ? Regards Arne -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/k2-bDK61sekJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Denmat
2012-Aug-03 22:03 UTC
Re: [Puppet Users] launching ec2 instance: running java maven build in puppet fails
Hi, If that is the complete init.pp you have no ordering which could be causing an issue. Try specifying ''require => Package[...]'' and ''require => Exec[...]'' to get your ordering right. See here for details: http://docs.puppetlabs.com/learning/ordering.html THT Den On 03/08/2012, at 1:12, Arne Mohr <arnemohr@googlemail.com> wrote:> Hi, > > i have a Problem with puppet and maven. At the moment I''m trying to launch an ec2 instance which automatically set''s up itself. In order to do so. I''m passing an cloud-init script within the user-data field on startup. > > #cloud-config > apt_upgrade: true > runcmd: > - chown ubuntu /mnt > - [ su, -c, "( git clone https://myRepo /mnt/init )", ubuntu ] > - sudo puppet apply /mnt/init/src/main/puppet/init.pp > > My puppet "script" > > package { "openjdk-6-jdk": > ensure => "installed" > } > > package { "imagemagick": > ensure => "installed" > } > > package { "libjpeg62": > ensure => "installed" > } > > package { "maven": > ensure => "installed" > } > > package { "tomcat7": > ensure => "installed" > } > > exec { "build_myApp_server": > command => "sudo mvn -f /mnt/init/pom.xml -s /mnt/init/src/main/puppet/mvn_settings.xml clean package |sudo tee -a /mnt/mvn.log", > path => "/usr/bin/" > } > > exec { "rm_old_root": > command => "sudo rm -Rf /var/lib/tomcat7/webapps/ROOT*", > path => "/usr/bin/" > } > > exec { "copy_war": > command => "sudo cp /mnt/init/target/myApp*war /var/lib/tomcat7/webapps/ROOT.war", > path => "/usr/bin/" > } > > exec { "restart_tomcat": > command => "sudo service tomcat7 restart", > path => "/usr/bin/" > } > > service { "tomcat7": > ensure => "running", > enable => true > } > > > When the script is executed during the cloud-init phase, the maven build fails or is not going to be executed. I don''t know why. If i execute it on my own by running > > sudo puppet apply /mnt/init/src/main/puppet/init.pp > > everything works fine. > Maybe somebody has an idea why this setup is not working ? > > Regards > Arne > > > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/k2-bDK61sekJ. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.