-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from opus-codium/decommission-tasks
Switch to tasks for decommissioning nodes
- Loading branch information
Showing
7 changed files
with
70 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"description": "Deactivate nodes in PuppetDB", | ||
"files": ["ruby_task_helper/files/task_helper.rb"], | ||
"input_method": "stdin", | ||
"parameters": { | ||
"nodes": { | ||
"description": "The nodes to deactivate", | ||
"type": "Array[String[1]]" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
require_relative '../../ruby_task_helper/files/task_helper' | ||
|
||
class DeactivateNodes < TaskHelper | ||
def task(nodes:, **_kwargs) | ||
# Prepend AIO path if it exist and is not in $PATH | ||
if File.directory?('/opt/puppetlabs/puppet/bin') && | ||
!ENV['PATH'].split(':').include?('/opt/puppetlabs/puppet/bin') | ||
ENV['PATH'] = "/opt/puppetlabs/puppet/bin:#{ENV['PATH']}" | ||
end | ||
|
||
system('puppet', 'node', 'deactivate', *nodes) || raise(TaskHelper::Error.new('Failed to deactivate nodes', 'deactivate_nodes', 'puppet exited with a non-null error code')) | ||
|
||
nil | ||
end | ||
end | ||
|
||
DeactivateNodes.run if $PROGRAM_NAME == __FILE__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"description": "Revoke certificates on the Puppet Server", | ||
"files": ["ruby_task_helper/files/task_helper.rb"], | ||
"input_method": "stdin", | ||
"parameters": { | ||
"certificates": { | ||
"description": "The certificates to revoke", | ||
"type": "Array[String[1]]" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
require_relative '../../ruby_task_helper/files/task_helper' | ||
|
||
class RevokeCertificates < TaskHelper | ||
def task(certificates:, **_kwargs) | ||
# Prepend AIO path if it exist and is not in $PATH | ||
if File.directory?('/opt/puppetlabs/puppet/bin') && | ||
!ENV['PATH'].split(':').include?('/opt/puppetlabs/puppet/bin') | ||
ENV['PATH'] = "/opt/puppetlabs/puppet/bin:#{ENV['PATH']}" | ||
end | ||
|
||
system('puppetserver', 'ca', 'revoke', '--certname', certificates.join(',')) || raise(TaskHelper::Error.new('Failed to revoke certificates', 'revoke_certificates', 'puppetserver exited with a non-null error code')) | ||
|
||
nil | ||
end | ||
end | ||
|
||
RevokeCertificates.run if $PROGRAM_NAME == __FILE__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters