Sha256: 6094d83bf2ecbb0ac7d86f911380c416518fea94de4d4e78cac5e7bc051547a8

Contents?: true

Size: 1.19 KB

Versions: 13

Compression:

Stored size: 1.19 KB

Contents

if defined? ForemanRemoteExecution
  module ForemanAnsible
    # Provider for RemoteExecution that allows to run Ansible playbooks.
    # Read the source of other RemoteExecution providers for more.
    class AnsibleProvider < RemoteExecutionProvider
      class << self
        def ssh_password(host)
          host_setting(host, :remote_execution_ssh_password)
        end

        def ssh_key_passphrase(host)
          host_setting(host, :remote_execution_ssh_key_passphrase)
        end

        def humanized_name
          'Ansible'
        end

        def proxy_command_options(template_invocation, host)
          super(template_invocation, host).merge(
            'ansible_inventory' => ::ForemanAnsible::InventoryCreator.new(
              [host], template_invocation
            ).to_hash.to_json,
            :remote_execution_command => ansible_command?(
              template_invocation.template
            )
          )
        end

        def supports_effective_user?
          true
        end

        private

        def ansible_command?(template)
          template.remote_execution_features.
            where(:label => 'ansible_run_host').empty?
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
foreman_ansible-2.2.14 app/models/foreman_ansible/ansible_provider.rb
foreman_ansible-2.2.13 app/models/foreman_ansible/ansible_provider.rb
foreman_ansible-2.2.12 app/models/foreman_ansible/ansible_provider.rb
foreman_ansible-2.2.11 app/models/foreman_ansible/ansible_provider.rb
foreman_ansible-2.2.10 app/models/foreman_ansible/ansible_provider.rb
foreman_ansible-2.2.9 app/models/foreman_ansible/ansible_provider.rb
foreman_ansible-2.2.8 app/models/foreman_ansible/ansible_provider.rb
foreman_ansible-2.2.7 app/models/foreman_ansible/ansible_provider.rb
foreman_ansible-2.2.6 app/models/foreman_ansible/ansible_provider.rb
foreman_ansible-2.2.5 app/models/foreman_ansible/ansible_provider.rb
foreman_ansible-2.2.4 app/models/foreman_ansible/ansible_provider.rb
foreman_ansible-2.2.3 app/models/foreman_ansible/ansible_provider.rb
foreman_ansible-2.2.2 app/models/foreman_ansible/ansible_provider.rb