Class: AnsibleGalaxy::Roles::Private
- Inherits:
-
Object
- Object
- AnsibleGalaxy::Roles::Private
- Includes:
- Contracts
- Defined in:
- lib/ansible_galaxy/roles.rb
Overview
Authenticated Access to Roles
Instance Method Summary collapse
- #find(name) ⇒ Object
- #find_id(name) ⇒ Object
-
#initialize(options = {}) ⇒ Private
constructor
A new instance of Private.
- #refresh(names) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Private
Returns a new instance of Private.
13 14 15 16 17 18 |
# File 'lib/ansible_galaxy/roles.rb', line 13 def initialize( = {}) username = .fetch 'username', ENV['ANSIBLE_GALAXY_USERNAME'] password = .fetch 'password', ENV['ANSIBLE_GALAXY_PASSWORD'] @auth = "#{username}:#{password}" @my = AnsibleGalaxy::Me.new() end |
Instance Method Details
#find(name) ⇒ Object
21 22 23 |
# File 'lib/ansible_galaxy/roles.rb', line 21 def find(name) @my.roles.select { |role| role['name'] == name } end |
#find_id(name) ⇒ Object
26 27 28 |
# File 'lib/ansible_galaxy/roles.rb', line 26 def find_id(name) find(name).first['id'] end |
#refresh(names) ⇒ Object
31 32 33 34 35 |
# File 'lib/ansible_galaxy/roles.rb', line 31 def refresh(names) Typhoeus::Hydra.new.tap do |hydra| names.each { |name| hydra.queue refresh_role name } end.run end |