Foreman VMware Cloud-Init

/etc/cloud/cloud.cfg

cloud_init_modules:
 - bootcmd

cloud_config_modules:
 - runcmd

cloud_final_modules:
 - scripts-per-once
 - scripts-per-boot
 - scripts-per-instance
 - scripts-user
 - resolv-conf
 - ca-certs
 - yum-add-repo
 - write-files
 - users-groups
 - package-update-upgrade-install
 - runcmd
 - puppet
 - phone-home

system_info:
  distro: rhel
  paths:
    cloud_dir: /var/lib/cloud
    templates_dir: /etc/cloud/templates
  ssh_svcname: sshd

# vim:syntax=yaml

#cloud-config
hostname: <%= @host.name %>
fqdn: <%= @host %>
manage_etc_hosts: true
users:
  - name: root
    ssh-authorized-keys:
      - ssh-ed25519 AAAA.....Vw4L0 sturbi@sturbi.de
      - ssh-rsa AAAAB3N....ji1pU4v foreman-proxy@foreman.sturbi.de

yum_repos:
    puppet6:
        baseurl: http://yum.puppetlabs.com/puppet/el/7/x86_64/
        enabled: true
        gpgcheck: false
        name: Puppet 6

package_update: true
package_upgrade: true

packages:
    - vim
    - tmux
    - mailx

package_reboot_if_required: true

<% if @host.puppetmaster -%>

packages:
    - puppet-agent

puppet:
    conf_file: '/etc/puppetlabs/puppet/puppet.conf'
    ssl_dir: '/opt/puppetlabs/puppet/ssl/'
    conf:
        agent:
            server: "<%= @host.puppetmaster %>"
            certname: "<%= @host.name %>"
        ca_cert: |
            -------BEGIN CERTIFICATE-------
            MIICIjAN.......ZwjH8CAwEAAQ==
            -------END CERTIFICATE-------

<% end %>

phone_home:
  url: <%= foreman_url('built') %>
  post: []
  tries: 10

# Template for VMWare customization via open-vm-tools
identity:
  LinuxPrep:
    domain: <%= @host.domain %>
    hostName: <%= @host.shortname %>
    hwClockUTC: true
    timeZone: 'Europe/Berlin'

globalIPSettings:
  dnsSuffixList: [<%= @host.domain %>]
  <%- @host.interfaces.each do |interface| -%>
  <%- next unless interface.subnet -%>
  dnsServerList: [<%= interface.subnet.dns_primary %>, <%= interface.subnet.dns_secondary %>]
  <%- end -%>

nicSettingMap:
<%- @host.interfaces.each do |interface| -%>
<%- next unless interface.subnet -%>
  - adapter:
      dnsDomain: <%= interface.domain %>
      dnsServerList: [<%= interface.subnet.dns_primary %>, <%= interface.subnet.dns_secondary %>]
      gateway: [<%= interface.subnet.gateway %>]
      ip: <%= interface.ip %>
      subnetMask: <%= interface.subnet.mask %>
<%- end -%>

Close Menu