userdata/default.erb in awstool-0.0.2 vs userdata/default.erb in awstool-0.1.0
- old
+ new
@@ -10,26 +10,36 @@
package_upgrade: true
package_reboot_if_required: true
write_files:
-<% if options['csr_attributes'] %>
+<% if options['puppet_install']['csr_attributes'] %>
- content: |
---
custom_attributes:
- 1.2.840.113549.1.9.7: <%= options['csr_attributes'] %>
- path: /etc/puppetlab/puppet/csr_attributes.yaml
+ 1.2.840.113549.1.9.7: <%= options['puppet_install']['csr_attributes'] %>
+ path: /etc/puppetlabs/puppet/csr_attributes.yaml
permissions: 0600
<% end %>
<% options['facts'].each do |fact, value| %>
- content: |
---
<%= fact %>: <%= value %>
path: /opt/puppetlabs/facter/facts.d/<%= fact %>.yaml
permissions: '0644'
<% end %>
-<%# runcmd: %>
-<%# - rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm %>
-<%# - yum -y install puppet-agent %>
-<%# - puppet agent -t --waitforcert 5 --server henson.uchicago.edu %>
-<%# - puppet agent -t %>
+<% if options['puppet_install'] %>
+runcmd:
+ <% if options['puppet_install']['package_manager'] == 'apt-get' %>
+ - wget https://apt.puppetlabs.com/<%= options['puppet_install']['repo_package'] %>
+ - dpkg -i /<%= options['puppet_install']['repo_package'] %>
+ - apt-get update
+ - apt-get -y install puppet-agent
+ <% elsif options['puppet_install']['package_manager'] == 'yum' %>
+ - rpm -ivh https://yum.puppetlabs.com/<%= options['puppet_install']['repo_package'] %>
+ - yum -y install puppet-agent
+ <% end %>
+ - /opt/puppetlabs/bin/puppet agent -t --waitforcert 5 --server <%= options['puppet_install']['server'] %> <% if options['puppet_install']['environment'] %> --environment <%= options['puppet_install']['environment'] %><% end %>
+ - /opt/puppetlabs/bin/puppet agent -t
+<% else %>
+<% end %>