def update_authorized_keys(public_key)
      auth_key_file = "/root/.ssh/authorized_keys"

      FileUtils.mkdir_p(File.dirname(auth_key_file)) # make sure the directory exists

      key_exists = false

      File.open(auth_key_file, "r") do |file|
        file.each_line { |line| key_exists = true if line == public_key }
      end if File.exists?(auth_key_file)

      if key_exists
        puts "Public ssh key for root already exists in #{auth_key_file}"
      else
        puts "Appending public ssh key to #{auth_key_file}"
        File.open(auth_key_file, "a") { |f| f.puts(public_key) }
      end

      # make sure it's private
      FileUtils.chmod(0600, auth_key_file)
      true
    end
def update_authorized_keys(public_key)
      auth_key_file = "/root/.ssh/authorized_keys"

      FileUtils.mkdir_p(File.dirname(auth_key_file)) # make sure the directory exists

      key_exists = false

      File.open(auth_key_file, "r") do |file|
        file.each_line { |line| key_exists = true if line == public_key }
      end if File.exists?(auth_key_file)

      if key_exists
        puts "Public ssh key for root already exists in #{auth_key_file}"
      else
        puts "Appending public ssh key to #{auth_key_file}"
        File.open(auth_key_file, "a") { |f| f.puts(public_key) }
      end

      # make sure it's private
      FileUtils.chmod(0600, auth_key_file)
      true
    end
Add public key to ssh authorized_keys file

 If the file does not exist, it will be created.
 If the key already exists, it will not be added again.

 === Parameters
 public_key(String):: public ssh key

 === Return