Skip to content

Commit

Permalink
Adds chef environment default (+1 squashed commit)
Browse files Browse the repository at this point in the history
Squashed commits:
[bd6683f] Adds firewall settings

Adds firewall clarification to readme

Moves firewall from attribute to resource parameter

Remove attributes from repo as all interaction is done via resources (#42)

- This repository provides resources so attributes are not needed
  • Loading branch information
spuder committed Aug 8, 2016
1 parent bc1e0e4 commit 56f5849
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ This cookbook is used for installing the [Octopus Deploy](http://octopusdeploy.c
## NOTICE: Pre-Release
This is pre release and there will be major changes to this before its final release. The recipes for installation and configuration will be switched into resources so people can use the library easier. Once this is found stable it will be released as version 1.0.0, until this point lock down to any minor version that you use.


## Resource/Provider
### octopus_deploy_server
#### Actions
Expand Down Expand Up @@ -60,13 +59,14 @@ end
- :app_path: The Octopus Deploy Instance application directory (Defaults to C:\Octopus\Applications)
- :trusted_cert: The Octopus Deploy Instance trusted Server cert
- :port: The Octopus Deploy Instance port to listen on for listening tentacle (Defaults to 10933)
- :configure_firewall: Whether cookbook will open firewall on listen tentacles (Defaults to false)
- :polling: Whether this Octopus Deploy Instance is a polling tentacle (Defaults to False)
- :cert_file: Where to export the Octopus Deploy Instance cert (Defaults to C:\Octopus\tentacle_cert.txt)
- :upgrades_enabled: Whether to upgrade or downgrade the tentacle version if the windows installer version does not match what is provided in the resource. (Defaults to True)
- :server: Url to Octopus Deploy Server (e.g https://octopus.example.com)
- :api_key: Api Key used to register Tentacle to Octopus Server
- :roles: Array of roles to apply to Tentacle when registering with Octopus Deploy Server (e.g ["web-server","app-server"])
- :environment: Which environment the Tentacle will become part of when registering with Octopus Deploy Server
- :environment: Which environment the Tentacle will become part of when registering with Octopus Deploy Server (Defaults to node.chef_environment )

#### Example
Install version 3.2.24 of Octopus Deploy Tentacle
Expand All @@ -89,7 +89,7 @@ octopus_deploy_tentacle 'Tentacle' do
server 'https://octopus.example.com'
api_key '12345678910'
roles ['database']
environment 'prod'
configure_firewall true
end
```

Expand All @@ -102,14 +102,10 @@ octopus_deploy_tentacle 'Tentacle' do
server 'https://octopus.example.com'
api_key '12345678910'
roles ['web-default']
environment 'dev'
polling true
end
```




## Assumptions

One major assumption of this cookbook is that you already have .net40 installed on your server. If you do not then you might need to do that before this cookbook. In addition, some of the resources in here require Chef version 12 in order to work.
Expand Down
1 change: 1 addition & 0 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
version '0.5.2'

depends 'windows', '~> 1.38'
depends 'windows_firewall', '~> 3.0.2'
supports 'windows'

provides 'octopus_deploy_server[OctopusServer]'
Expand Down
13 changes: 12 additions & 1 deletion providers/tentacle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,20 @@
trusted_cert = new_resource.trusted_cert
polling = new_resource.polling
port = resolve_port(polling, new_resource.port)
configure_firewall = new_resource.configure_firewall
service_name = service_name(instance)
cert_file = new_resource.cert_file

firewall = windows_firewall_rule 'Octopus Deploy Tentacle' do
action :create
localport port.to_s
dir :in
protocol 'TCP'
firewall_action :allow
only_if { configure_firewall }
not_if { polling }
end

install = octopus_deploy_tentacle name do
action :install
checksum checksum
Expand Down Expand Up @@ -126,7 +137,7 @@
action [:enable, :start]
end

new_resource.updated_by_last_action(actions_updated?([install, create_home_dir, generate_cert, create_instance, configure, service]))
new_resource.updated_by_last_action(actions_updated?([firewall, install, create_home_dir, generate_cert, create_instance, configure, service]))
end

action :register do
Expand Down
3 changes: 2 additions & 1 deletion resources/tentacle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@
attribute :app_path, kind_of: String, default: 'C:\Octopus\Applications'
attribute :trusted_cert, kind_of: String
attribute :polling, kind_of: [TrueClass, FalseClass], default: false
attribute :configure_firewall, kind_of: [TrueClass, FalseClass], default: false
attribute :port, kind_of: [Fixnum, NilClass], default: nil
attribute :cert_file, kind_of: String, default: 'C:\Octopus\tentacle_cert.txt'
attribute :upgrades_enabled, kind_of: [TrueClass, FalseClass], default: true
attribute :server, kind_of: String
attribute :api_key, kind_of: String
attribute :roles, kind_of: Array
attribute :environment, kind_of: String
attribute :environment, kind_of: String, default: node.chef_environment

0 comments on commit 56f5849

Please sign in to comment.