Class: Dapp::Dimg::Builder::Ansible

Inherits:
Base
  • Object
show all
Defined in:
lib/dapp/dimg/builder/ansible.rb

Constant Summary collapse

ANSIBLE_IMAGE_VERSION =
"2.4.1.0-1"

Instance Attribute Summary

Attributes inherited from Base

#dimg

Instance Method Summary collapse

Methods inherited from Base

#before_build_check, #before_dimg_should_be_built_check, #before_install, #before_install?, #before_install_checksum, #before_setup, #before_setup?, #before_setup_checksum, #build_artifact, #build_artifact?, #build_artifact_checksum, #initialize, #install, #install?, #install_checksum, #setup, #setup?, #setup_checksum

Constructor Details

This class inherits a constructor from Dapp::Dimg::Builder::Base

Instance Method Details

#ansible_binObject



6
7
8
# File 'lib/dapp/dimg/builder/ansible.rb', line 6

def ansible_bin
  "/.dapp/deps/ansible/#{ANSIBLE_IMAGE_VERSION}/bin/ansible"
end

#ansible_containerObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/dapp/dimg/builder/ansible.rb', line 18

def ansible_container
  @ansible_container ||= begin
    is_container_exist = proc{dimg.dapp.shellout("#{dimg.dapp.host_docker} inspect #{ansible_container_name}").exitstatus.zero?}
    if !is_container_exist.call
      dimg.dapp.lock("dappdeps.container.#{ansible_container_name}", default_timeout: 600) do
        if !is_container_exist.call
          dimg.dapp.log_secondary_process(dimg.dapp.t(code: 'process.ansible_container_creating', data: {name: ansible_container_name}), short: true) do
            dimg.dapp.shellout!(
              ["#{dimg.dapp.host_docker} create",
               "--name #{ansible_container_name}",
               "--volume /.dapp/deps/ansible/#{ANSIBLE_IMAGE_VERSION} #{ansible_image}"].join(' ')
            )
          end
        end
      end
    end
    ansible_container_name
  end
end

#ansible_container_nameObject



14
15
16
# File 'lib/dapp/dimg/builder/ansible.rb', line 14

def ansible_container_name
  "dappdeps_ansible_#{ANSIBLE_IMAGE_VERSION}"
end

#ansible_imageObject



10
11
12
# File 'lib/dapp/dimg/builder/ansible.rb', line 10

def ansible_image
  "dappdeps/ansible:#{ANSIBLE_IMAGE_VERSION}"
end