Sha256: 56e7e8e49c01a7360eb981eaa196f1b86a2494f4958bbddc9dc2fdc65e6ef26c

Contents?: true

Size: 421 Bytes

Versions: 1

Compression:

Stored size: 421 Bytes

Contents

require 'securerandom'
module ForemanAnsible
  # Service to list an inventory to be passed to the ansible-playbook binary
  class InventoryCreator
    attr_reader :hosts

    def initialize(hosts)
      @hosts = hosts
    end

    def tempfile
      tempfile = Tempfile.new("foreman-#{SecureRandom.uuid}-inventory")
      tempfile.write(hosts.map(&:fqdn).join('\n'))
      tempfile.close
      tempfile
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foreman_ansible-1.0 app/services/foreman_ansible/inventory_creator.rb