chef 16.0.257 → 16.0.275
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +30 -16
- data/chef.gemspec +1 -1
- data/lib/chef/knife/environment_compare.rb +1 -1
- data/lib/chef/knife/list.rb +1 -1
- data/lib/chef/knife/supermarket_install.rb +1 -1
- data/lib/chef/knife/yaml_convert.rb +2 -2
- data/lib/chef/provider/execute.rb +1 -1
- data/lib/chef/provider/package/freebsd/base.rb +2 -1
- data/lib/chef/provider/package/homebrew.rb +1 -1
- data/lib/chef/provider/package/macports.rb +0 -2
- data/lib/chef/provider/package/windows.rb +26 -51
- data/lib/chef/provider/user/dscl.rb +1 -1
- data/lib/chef/resource/alternatives.rb +65 -4
- data/lib/chef/resource/apt_package.rb +31 -2
- data/lib/chef/resource/apt_preference.rb +34 -5
- data/lib/chef/resource/apt_repository.rb +22 -15
- data/lib/chef/resource/apt_update.rb +6 -4
- data/lib/chef/resource/archive_file.rb +5 -4
- data/lib/chef/resource/bash.rb +1 -1
- data/lib/chef/resource/batch.rb +1 -1
- data/lib/chef/resource/bff_package.rb +1 -1
- data/lib/chef/resource/breakpoint.rb +1 -1
- data/lib/chef/resource/build_essential.rb +8 -4
- data/lib/chef/resource/cab_package.rb +1 -1
- data/lib/chef/resource/chef_client_cron.rb +12 -9
- data/lib/chef/resource/chef_client_scheduled_task.rb +9 -6
- data/lib/chef/resource/chef_client_systemd_timer.rb +10 -7
- data/lib/chef/resource/chef_gem.rb +6 -2
- data/lib/chef/resource/chef_handler.rb +1 -1
- data/lib/chef/resource/chef_sleep.rb +7 -4
- data/lib/chef/resource/chef_vault_secret.rb +3 -3
- data/lib/chef/resource/chocolatey_config.rb +5 -3
- data/lib/chef/resource/chocolatey_feature.rb +5 -3
- data/lib/chef/resource/chocolatey_package.rb +5 -3
- data/lib/chef/resource/chocolatey_source.rb +5 -3
- data/lib/chef/resource/cookbook_file.rb +3 -2
- data/lib/chef/resource/cron.rb +15 -15
- data/lib/chef/resource/cron_access.rb +7 -4
- data/lib/chef/resource/cron_d.rb +37 -23
- data/lib/chef/resource/csh.rb +1 -1
- data/lib/chef/resource/directory.rb +1 -1
- data/lib/chef/resource/dmg_package.rb +18 -15
- data/lib/chef/resource/dnf_package.rb +1 -1
- data/lib/chef/resource/dpkg_package.rb +1 -1
- data/lib/chef/resource/execute.rb +2 -2
- data/lib/chef/resource/file.rb +5 -4
- data/lib/chef/resource/freebsd_package.rb +1 -1
- data/lib/chef/resource/gem_package.rb +6 -6
- data/lib/chef/resource/group.rb +1 -1
- data/lib/chef/resource/homebrew_cask.rb +1 -1
- data/lib/chef/resource/homebrew_package.rb +1 -1
- data/lib/chef/resource/homebrew_tap.rb +1 -1
- data/lib/chef/resource/hostname.rb +4 -4
- data/lib/chef/resource/http_request.rb +1 -1
- data/lib/chef/resource/ifconfig.rb +7 -7
- data/lib/chef/resource/ips_package.rb +1 -1
- data/lib/chef/resource/kernel_module.rb +1 -1
- data/lib/chef/resource/ksh.rb +1 -1
- data/lib/chef/resource/launchd.rb +1 -1
- data/lib/chef/resource/link.rb +4 -4
- data/lib/chef/resource/locale.rb +1 -1
- data/lib/chef/resource/log.rb +1 -1
- data/lib/chef/resource/macos_userdefaults.rb +1 -1
- data/lib/chef/resource/macosx_service.rb +1 -1
- data/lib/chef/resource/macports_package.rb +1 -1
- data/lib/chef/resource/mdadm.rb +1 -1
- data/lib/chef/resource/mount.rb +1 -1
- data/lib/chef/resource/msu_package.rb +1 -1
- data/lib/chef/resource/ohai.rb +1 -1
- data/lib/chef/resource/ohai_hint.rb +1 -1
- data/lib/chef/resource/openbsd_package.rb +1 -1
- data/lib/chef/resource/openssl_dhparam.rb +1 -1
- data/lib/chef/resource/openssl_ec_private_key.rb +1 -1
- data/lib/chef/resource/openssl_ec_public_key.rb +1 -1
- data/lib/chef/resource/openssl_rsa_private_key.rb +1 -1
- data/lib/chef/resource/openssl_rsa_public_key.rb +1 -1
- data/lib/chef/resource/openssl_x509_certificate.rb +1 -1
- data/lib/chef/resource/openssl_x509_crl.rb +1 -1
- data/lib/chef/resource/openssl_x509_request.rb +1 -1
- data/lib/chef/resource/osx_profile.rb +1 -1
- data/lib/chef/resource/package.rb +1 -1
- data/lib/chef/resource/pacman_package.rb +1 -1
- data/lib/chef/resource/paludis_package.rb +1 -1
- data/lib/chef/resource/perl.rb +1 -1
- data/lib/chef/resource/plist.rb +1 -1
- data/lib/chef/resource/portage_package.rb +1 -1
- data/lib/chef/resource/powershell_package.rb +1 -1
- data/lib/chef/resource/powershell_package_source.rb +1 -1
- data/lib/chef/resource/powershell_script.rb +1 -1
- data/lib/chef/resource/python.rb +1 -1
- data/lib/chef/resource/reboot.rb +1 -1
- data/lib/chef/resource/registry_key.rb +1 -1
- data/lib/chef/resource/remote_directory.rb +1 -1
- data/lib/chef/resource/remote_file.rb +1 -2
- data/lib/chef/resource/rhsm_errata.rb +1 -3
- data/lib/chef/resource/rhsm_errata_level.rb +1 -1
- data/lib/chef/resource/rhsm_register.rb +1 -2
- data/lib/chef/resource/rhsm_repo.rb +1 -2
- data/lib/chef/resource/rhsm_subscription.rb +1 -3
- data/lib/chef/resource/route.rb +1 -1
- data/lib/chef/resource/rpm_package.rb +5 -2
- data/lib/chef/resource/ruby.rb +1 -1
- data/lib/chef/resource/ruby_block.rb +1 -4
- data/lib/chef/resource/scm/_scm.rb +4 -3
- data/lib/chef/resource/scm/git.rb +1 -1
- data/lib/chef/resource/scm/subversion.rb +2 -2
- data/lib/chef/resource/script.rb +1 -1
- data/lib/chef/resource/service.rb +1 -1
- data/lib/chef/resource/smartos_package.rb +1 -1
- data/lib/chef/resource/snap_package.rb +1 -1
- data/lib/chef/resource/solaris_package.rb +1 -1
- data/lib/chef/resource/ssh_known_hosts_entry.rb +1 -1
- data/lib/chef/resource/sudo.rb +4 -4
- data/lib/chef/resource/swap_file.rb +2 -2
- data/lib/chef/resource/sysctl.rb +61 -2
- data/lib/chef/resource/systemd_unit.rb +2 -2
- data/lib/chef/resource/timezone.rb +1 -1
- data/lib/chef/resource/user.rb +2 -2
- data/lib/chef/resource/user_ulimit.rb +24 -22
- data/lib/chef/resource/windows_ad_join.rb +1 -1
- data/lib/chef/resource/windows_auto_run.rb +2 -2
- data/lib/chef/resource/windows_certificate.rb +1 -1
- data/lib/chef/resource/windows_dfs_folder.rb +1 -1
- data/lib/chef/resource/windows_dfs_namespace.rb +1 -1
- data/lib/chef/resource/windows_dfs_server.rb +1 -1
- data/lib/chef/resource/windows_env.rb +10 -1
- data/lib/chef/resource/windows_feature.rb +57 -2
- data/lib/chef/resource/windows_feature_dism.rb +15 -2
- data/lib/chef/resource/windows_feature_powershell.rb +29 -2
- data/lib/chef/resource/windows_firewall_rule.rb +9 -5
- data/lib/chef/resource/windows_font.rb +10 -1
- data/lib/chef/resource/windows_package.rb +63 -3
- data/lib/chef/resource/windows_pagefile.rb +30 -2
- data/lib/chef/resource/windows_path.rb +18 -1
- data/lib/chef/resource/windows_printer.rb +25 -5
- data/lib/chef/resource/windows_printer_port.rb +29 -1
- data/lib/chef/resource/windows_security_policy.rb +1 -1
- data/lib/chef/resource/windows_service.rb +1 -1
- data/lib/chef/resource/windows_share.rb +21 -1
- data/lib/chef/resource/windows_shortcut.rb +13 -2
- data/lib/chef/resource/windows_task.rb +122 -8
- data/lib/chef/resource/windows_uac.rb +20 -1
- data/lib/chef/resource/windows_workgroup.rb +19 -3
- data/lib/chef/resource/yum_package.rb +88 -6
- data/lib/chef/resource/yum_repository.rb +28 -11
- data/lib/chef/resource/zypper_package.rb +29 -3
- data/lib/chef/resource/zypper_repository.rb +17 -5
- data/lib/chef/resource_inspector.rb +1 -1
- data/lib/chef/scan_access_control.rb +1 -1
- data/lib/chef/version.rb +1 -1
- data/spec/functional/resource/link_spec.rb +3 -3
- data/spec/functional/resource/remote_file_spec.rb +1 -1
- data/spec/integration/knife/raw_spec.rb +4 -4
- data/spec/integration/knife/redirection_spec.rb +2 -2
- data/spec/support/platform_helpers.rb +0 -13
- data/spec/support/shared/functional/http.rb +2 -2
- data/spec/support/shared/unit/mock_shellout.rb +1 -1
- data/spec/unit/file_access_control_spec.rb +1 -1
- data/spec/unit/mixin/shell_out_spec.rb +25 -31
- data/spec/unit/provider/apt_repository_spec.rb +27 -27
- data/spec/unit/provider/zypper_repository_spec.rb +17 -17
- data/spec/unit/provider_resolver_spec.rb +2 -2
- metadata +10 -10
data/lib/chef/resource/sysctl.rb
CHANGED
@@ -25,11 +25,70 @@ class Chef
|
|
25
25
|
provides(:sysctl) { true }
|
26
26
|
provides(:sysctl_param) { true }
|
27
27
|
|
28
|
-
description "Use the sysctl resource to set or remove kernel parameters using the sysctl"\
|
28
|
+
description "Use the **sysctl** resource to set or remove kernel parameters using the sysctl"\
|
29
29
|
" command line tool and configuration files in the system's sysctl.d directory. "\
|
30
30
|
"Configuration files managed by this resource are named 99-chef-KEYNAME.conf. If"\
|
31
31
|
" an existing value was already set for the value it will be backed up to the node"\
|
32
32
|
" and restored if the :remove action is used later."
|
33
|
+
examples <<~DOC
|
34
|
+
**Set vm.swappiness**:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
sysctl 'vm.swappiness' do
|
38
|
+
value 19
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
42
|
+
**Remove kernel.msgmax**:
|
43
|
+
|
44
|
+
**Note**: This only removes the sysctl.d config for kernel.msgmax. The value will be set back to the kernel default value.
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
sysctl 'kernel.msgmax' do
|
48
|
+
action :remove
|
49
|
+
end
|
50
|
+
```
|
51
|
+
|
52
|
+
**Adding Comments to sysctl configuration files**:
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
sysctl 'vm.swappiness' do
|
56
|
+
value 19
|
57
|
+
comment "define how aggressively the kernel will swap memory pages."
|
58
|
+
end
|
59
|
+
```
|
60
|
+
|
61
|
+
This produces /etc/sysctl.d/99-chef-vm.swappiness.conf as follows:
|
62
|
+
|
63
|
+
```
|
64
|
+
# define how aggressively the kernel will swap memory pages.
|
65
|
+
vm.swappiness = 1
|
66
|
+
```
|
67
|
+
|
68
|
+
**Converting sysctl settings from shell scripts**:
|
69
|
+
|
70
|
+
Example of existing settings:
|
71
|
+
|
72
|
+
```bash
|
73
|
+
fs.aio-max-nr = 1048576 net.ipv4.ip_local_port_range = 9000 65500 kernel.sem = 250 32000 100 128
|
74
|
+
```
|
75
|
+
|
76
|
+
Converted to sysctl resources:
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
sysctl 'fs.aio-max-nr' do
|
80
|
+
value '1048576'
|
81
|
+
end
|
82
|
+
|
83
|
+
sysctl 'net.ipv4.ip_local_port_range' do
|
84
|
+
value '9000 65500'
|
85
|
+
end
|
86
|
+
|
87
|
+
sysctl 'kernel.sem' do
|
88
|
+
value '250 32000 100 128'
|
89
|
+
end
|
90
|
+
```
|
91
|
+
DOC
|
33
92
|
|
34
93
|
introduced "14.0"
|
35
94
|
|
@@ -44,7 +103,7 @@ class Chef
|
|
44
103
|
property :value, [Array, String, Integer, Float],
|
45
104
|
description: "The value to set.",
|
46
105
|
coerce: proc { |v| coerce_value(v) },
|
47
|
-
required:
|
106
|
+
required: [:apply]
|
48
107
|
|
49
108
|
property :comment, [Array, String],
|
50
109
|
description: "Comments, placed above the resource setting in the generated file. For multi-line comments, use an array of strings, one per line.",
|
@@ -27,7 +27,7 @@ class Chef
|
|
27
27
|
|
28
28
|
provides(:systemd_unit) { true }
|
29
29
|
|
30
|
-
description "Use the systemd_unit resource to create, manage, and run systemd units."
|
30
|
+
description "Use the **systemd_unit** resource to create, manage, and run systemd units."
|
31
31
|
introduced "12.11"
|
32
32
|
|
33
33
|
default_action :nothing
|
@@ -52,7 +52,7 @@ class Chef
|
|
52
52
|
description: "The user account that the systemd unit process is run under. The path to the unit for that user would be something like '/etc/systemd/user/sshd.service'. If no user account is specified, the systemd unit will run under a 'system' account, with the path to the unit being something like '/etc/systemd/system/sshd.service'."
|
53
53
|
|
54
54
|
property :content, [String, Hash],
|
55
|
-
description: "A string or hash that contains a systemd
|
55
|
+
description: "A string or hash that contains a systemd [unit file](https://www.freedesktop.org/software/systemd/man/systemd.unit.html) definition that describes the properties of systemd-managed entities, such as services, sockets, devices, and so on. In #{Chef::Dist::PRODUCT} 14.4 or later, repeatable options can be implemented with an array."
|
56
56
|
|
57
57
|
property :triggers_reload, [TrueClass, FalseClass],
|
58
58
|
description: "Specifies whether to trigger a daemon reload when creating or deleting a unit.",
|
@@ -26,7 +26,7 @@ class Chef
|
|
26
26
|
|
27
27
|
provides :timezone
|
28
28
|
|
29
|
-
description "Use the timezone resource to change the system timezone on Windows, Linux, and macOS hosts. Timezones are specified in tz database format, with a complete list of available TZ values for Linux and macOS here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones and for Windows here: https://ss64.com/nt/timezones.html."
|
29
|
+
description "Use the **timezone** resource to change the system timezone on Windows, Linux, and macOS hosts. Timezones are specified in tz database format, with a complete list of available TZ values for Linux and macOS here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones and for Windows here: https://ss64.com/nt/timezones.html."
|
30
30
|
introduced "14.6"
|
31
31
|
|
32
32
|
property :timezone, String,
|
data/lib/chef/resource/user.rb
CHANGED
@@ -23,7 +23,7 @@ class Chef
|
|
23
23
|
class User < Chef::Resource
|
24
24
|
unified_mode true
|
25
25
|
|
26
|
-
description "Use the user resource to add users, update existing users, remove users, and to lock/unlock user passwords."
|
26
|
+
description "Use the **user** resource to add users, update existing users, remove users, and to lock/unlock user passwords."
|
27
27
|
|
28
28
|
default_action :create
|
29
29
|
allowed_actions :create, :remove, :modify, :manage, :lock, :unlock
|
@@ -55,7 +55,7 @@ class Chef
|
|
55
55
|
default: false, desired_state: false
|
56
56
|
|
57
57
|
property :manage_home, [ TrueClass, FalseClass ],
|
58
|
-
description: "Manage a user
|
58
|
+
description: "Manage a user's home directory.\nWhen used with the :create action, a user's home directory is created based on HOME_DIR. If the home directory is missing, it is created unless CREATE_HOME in /etc/login.defs is set to no. When created, a skeleton set of files and subdirectories are included within the home directory.\nWhen used with the :modify action, a user's home directory is moved to HOME_DIR. If the home directory is missing, it is created unless CREATE_HOME in /etc/login.defs is set to no. The contents of the user's home directory are moved to the new location.",
|
59
59
|
default: false, desired_state: false
|
60
60
|
|
61
61
|
property :force, [ TrueClass, FalseClass ],
|
@@ -26,32 +26,34 @@ class Chef
|
|
26
26
|
|
27
27
|
provides :user_ulimit
|
28
28
|
|
29
|
+
description "Use the **user_ulimit** resource to create individual ulimit files that are installed into the `/etc/security/limits.d/` directory."
|
29
30
|
introduced "16.0"
|
30
|
-
description "Use the user_ulimit resource to create individual ulimit files that are installed into the `/etc/security/limits.d/` directory."
|
31
31
|
examples <<~DOC
|
32
|
-
|
33
|
-
```ruby
|
34
|
-
user_ulimit 'tomcat' do
|
35
|
-
filehandle_limit 8192
|
36
|
-
end
|
37
|
-
```
|
32
|
+
**Set filehandle limit for the tomcat user**:
|
38
33
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
end
|
45
|
-
```
|
34
|
+
```ruby
|
35
|
+
user_ulimit 'tomcat' do
|
36
|
+
filehandle_limit 8192
|
37
|
+
end
|
38
|
+
```
|
46
39
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
40
|
+
**Specify a username that differs from the name given to the resource block**:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
user_ulimit 'Bump filehandle limits for tomcat user' do
|
44
|
+
username 'tomcat'
|
45
|
+
filehandle_limit 8192
|
46
|
+
end
|
47
|
+
```
|
48
|
+
|
49
|
+
**Set filehandle limit for the tomcat user with a non-default filename**:
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
user_ulimit 'tomcat' do
|
53
|
+
filehandle_limit 8192
|
54
|
+
filename 'tomcat_filehandle_limits.conf'
|
55
|
+
end
|
56
|
+
```
|
55
57
|
DOC
|
56
58
|
|
57
59
|
property :username, String, name_property: true
|
@@ -23,7 +23,7 @@ class Chef
|
|
23
23
|
class WindowsAdJoin < Chef::Resource
|
24
24
|
provides :windows_ad_join
|
25
25
|
|
26
|
-
description "Use the windows_ad_join resource to join a Windows Active Directory domain."
|
26
|
+
description "Use the **windows_ad_join** resource to join a Windows Active Directory domain."
|
27
27
|
introduced "14.0"
|
28
28
|
|
29
29
|
property :domain_name, String,
|
@@ -23,7 +23,7 @@ class Chef
|
|
23
23
|
class WindowsAutorun < Chef::Resource
|
24
24
|
provides(:windows_auto_run) { true }
|
25
25
|
|
26
|
-
description "Use the windows_auto_run resource to set applications to run at login."
|
26
|
+
description "Use the **windows_auto_run** resource to set applications to run at login."
|
27
27
|
introduced "14.0"
|
28
28
|
|
29
29
|
property :program_name, String,
|
@@ -32,7 +32,7 @@ class Chef
|
|
32
32
|
|
33
33
|
property :path, String,
|
34
34
|
coerce: proc { |x| x.tr("/", "\\") }, # make sure we have windows paths for the registry
|
35
|
-
description: "The path to the program that will run at login.
|
35
|
+
description: "The path to the program that will run at login."
|
36
36
|
|
37
37
|
property :args, String,
|
38
38
|
description: "Any arguments to be used with the program."
|
@@ -28,7 +28,7 @@ class Chef
|
|
28
28
|
class WindowsCertificate < Chef::Resource
|
29
29
|
provides :windows_certificate
|
30
30
|
|
31
|
-
description "Use the windows_certificate resource to install a certificate into the Windows certificate store from a file. The resource grants read-only access to the private key for designated accounts. Due to current limitations in WinRM, installing certificates remotely may not work if the operation requires a user profile. Operations on the local machine store should still work."
|
31
|
+
description "Use the **windows_certificate** resource to install a certificate into the Windows certificate store from a file. The resource grants read-only access to the private key for designated accounts. Due to current limitations in WinRM, installing certificates remotely may not work if the operation requires a user profile. Operations on the local machine store should still work."
|
32
32
|
introduced "14.7"
|
33
33
|
|
34
34
|
property :source, String,
|
@@ -23,7 +23,7 @@ class Chef
|
|
23
23
|
class WindowsDfsFolder < Chef::Resource
|
24
24
|
provides :windows_dfs_folder
|
25
25
|
|
26
|
-
description "
|
26
|
+
description "Use the **windows_dfs_folder** resource to creates a folder within DFS as many levels deep as required."
|
27
27
|
introduced "15.0"
|
28
28
|
|
29
29
|
property :folder_path, String,
|
@@ -23,7 +23,7 @@ class Chef
|
|
23
23
|
class WindowsDfsNamespace < Chef::Resource
|
24
24
|
provides :windows_dfs_namespace
|
25
25
|
|
26
|
-
description "
|
26
|
+
description "Use the **windows_dfs_namespace** resource to creates a share and DFS namespace on a Windows server."
|
27
27
|
introduced "15.0"
|
28
28
|
|
29
29
|
property :namespace_name, String,
|
@@ -23,7 +23,7 @@ class Chef
|
|
23
23
|
class WindowsDfsServer < Chef::Resource
|
24
24
|
provides :windows_dfs_server
|
25
25
|
|
26
|
-
description "
|
26
|
+
description "Use the **windows_dfs_server** resource to set system-wide DFS settings."
|
27
27
|
introduced "15.0"
|
28
28
|
|
29
29
|
property :use_fqdn, [TrueClass, FalseClass],
|
@@ -25,7 +25,16 @@ class Chef
|
|
25
25
|
provides :windows_env
|
26
26
|
provides :env # backwards compat with the pre-Chef 14 resource name
|
27
27
|
|
28
|
-
description "Use the windows_env resource to manage environment keys in Microsoft Windows. After an environment key is set, Microsoft Windows must be restarted before the environment key will be available to the Task Scheduler."
|
28
|
+
description "Use the **windows_env** resource to manage environment keys in Microsoft Windows. After an environment key is set, Microsoft Windows must be restarted before the environment key will be available to the Task Scheduler."
|
29
|
+
examples <<~DOC
|
30
|
+
**Set an environment variable**:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
windows_env 'ComSpec' do
|
34
|
+
value 'C:\\Windows\\system32\\cmd.exe'
|
35
|
+
end
|
36
|
+
```
|
37
|
+
DOC
|
29
38
|
|
30
39
|
default_action :create
|
31
40
|
allowed_actions :create, :delete, :modify
|
@@ -23,8 +23,63 @@ class Chef
|
|
23
23
|
class WindowsFeature < Chef::Resource
|
24
24
|
provides(:windows_feature) { true }
|
25
25
|
|
26
|
-
description "Use the windows_feature resource to add, remove or entirely delete Windows features and roles. This resource calls the 'windows_feature_dism' or 'windows_feature_powershell' resources depending on the specified installation method, and defaults to DISM, which is available on both Workstation and Server editions of Windows."
|
26
|
+
description "Use the **windows_feature** resource to add, remove or entirely delete Windows features and roles. This resource calls the 'windows_feature_dism' or 'windows_feature_powershell' resources depending on the specified installation method, and defaults to DISM, which is available on both Workstation and Server editions of Windows."
|
27
27
|
introduced "14.0"
|
28
|
+
examples <<~DOC
|
29
|
+
**Install the DHCP Server feature**:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
windows_feature 'DHCPServer' do
|
33
|
+
action :install
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
**Install the .Net 3.5.1 feature using repository files on DVD**:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
windows_feature "NetFx3" do
|
41
|
+
action :install
|
42
|
+
source 'd:\\sources\\sxs'
|
43
|
+
end
|
44
|
+
```
|
45
|
+
|
46
|
+
**Remove Telnet Server and Client features**:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
windows_feature %w(TelnetServer TelnetClient) do
|
50
|
+
action :remove
|
51
|
+
end
|
52
|
+
```
|
53
|
+
|
54
|
+
**Add the SMTP Server feature using the PowerShell provider**:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
windows_feature 'smtp-server' do
|
58
|
+
action :install
|
59
|
+
all true
|
60
|
+
install_method :windows_feature_powershell
|
61
|
+
end
|
62
|
+
```
|
63
|
+
|
64
|
+
**Install multiple features using one resource with the PowerShell provider**:
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
windows_feature %w(Web-Asp-Net45 Web-Net-Ext45) do
|
68
|
+
action :install
|
69
|
+
install_method :windows_feature_powershell
|
70
|
+
end
|
71
|
+
```
|
72
|
+
|
73
|
+
**Install the Network Policy and Access Service feature, including the management tools**:
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
windows_feature 'NPAS' do
|
77
|
+
action :install
|
78
|
+
management_tools true
|
79
|
+
install_method :windows_feature_powershell
|
80
|
+
end
|
81
|
+
```
|
82
|
+
DOC
|
28
83
|
|
29
84
|
property :feature_name, [Array, String],
|
30
85
|
description: "The name of the feature(s) or role(s) to install if they differ from the resource block's name. The same feature may have different names depending on the underlying installation method being used (ie DHCPServer vs DHCP; DNS-Server-Full-Role vs DNS).",
|
@@ -42,7 +97,7 @@ class Chef
|
|
42
97
|
default: false
|
43
98
|
|
44
99
|
property :install_method, Symbol,
|
45
|
-
description: "The underlying installation method to use for feature installation. Specify
|
100
|
+
description: "The underlying installation method to use for feature installation. Specify `:windows_feature_dism` for DISM or `:windows_feature_powershell` for PowerShell.",
|
46
101
|
equal_to: %i{windows_feature_dism windows_feature_powershell windows_feature_servermanagercmd},
|
47
102
|
default: :windows_feature_dism
|
48
103
|
|
@@ -24,8 +24,21 @@ class Chef
|
|
24
24
|
class WindowsFeatureDism < Chef::Resource
|
25
25
|
provides(:windows_feature_dism) { true }
|
26
26
|
|
27
|
-
description "Use the windows_feature_dism resource to add, remove, or entirely delete Windows features and roles using DISM."
|
27
|
+
description "Use the **windows_feature_dism** resource to add, remove, or entirely delete Windows features and roles using DISM."
|
28
28
|
introduced "14.0"
|
29
|
+
examples <<~DOC
|
30
|
+
**Installing the TelnetClient service**:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
windows_feature_dism "TelnetClient"
|
34
|
+
```
|
35
|
+
|
36
|
+
**Installing two features by using an array**:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
windows_feature_dism %w(TelnetClient TFTP)
|
40
|
+
```
|
41
|
+
DOC
|
29
42
|
|
30
43
|
property :feature_name, [Array, String],
|
31
44
|
description: "The name of the feature(s) or role(s) to install if they differ from the resource name.",
|
@@ -36,7 +49,7 @@ class Chef
|
|
36
49
|
description: "Specify a local repository for the feature install."
|
37
50
|
|
38
51
|
property :all, [TrueClass, FalseClass],
|
39
|
-
description: "Install all sub-features. When set to
|
52
|
+
description: "Install all sub-features. When set to `true`, this is the equivalent of specifying the `/All` switch to `dism.exe`",
|
40
53
|
default: false
|
41
54
|
|
42
55
|
property :timeout, Integer,
|
@@ -25,8 +25,35 @@ class Chef
|
|
25
25
|
class WindowsFeaturePowershell < Chef::Resource
|
26
26
|
provides(:windows_feature_powershell) { true }
|
27
27
|
|
28
|
-
description "Use the windows_feature_powershell resource to add, remove, or entirely delete Windows features and roles using PowerShell. This resource offers significant speed benefits over the windows_feature_dism resource, but requires installation of the Remote Server Administration Tools on non-server releases of Windows."
|
28
|
+
description "Use the **windows_feature_powershell** resource to add, remove, or entirely delete Windows features and roles using PowerShell. This resource offers significant speed benefits over the windows_feature_dism resource, but requires installation of the Remote Server Administration Tools on non-server releases of Windows."
|
29
29
|
introduced "14.0"
|
30
|
+
examples <<~DOC
|
31
|
+
**Add the SMTP Server feature**:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
windows_feature_powershell "smtp-server" do
|
35
|
+
action :install
|
36
|
+
all true
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
**Install multiple features using one resource**:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
windows_feature_powershell ['Web-Asp-Net45', 'Web-Net-Ext45'] do
|
44
|
+
action :install
|
45
|
+
end
|
46
|
+
```
|
47
|
+
|
48
|
+
**Install the Network Policy and Access Service feature**:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
windows_feature_powershell 'NPAS' do
|
52
|
+
action :install
|
53
|
+
management_tools true
|
54
|
+
end
|
55
|
+
```
|
56
|
+
DOC
|
30
57
|
|
31
58
|
property :feature_name, [Array, String],
|
32
59
|
description: "The name of the feature(s) or role(s) to install if they differ from the resource block's name.",
|
@@ -37,7 +64,7 @@ class Chef
|
|
37
64
|
description: "Specify a local repository for the feature install."
|
38
65
|
|
39
66
|
property :all, [TrueClass, FalseClass],
|
40
|
-
description: "Install all subfeatures. When set to
|
67
|
+
description: "Install all subfeatures. When set to `true`, this is the equivalent of specifying the `-InstallAllSubFeatures` switch with `Add-WindowsFeature`.",
|
41
68
|
default: false
|
42
69
|
|
43
70
|
property :timeout, Integer,
|
@@ -26,10 +26,11 @@ class Chef
|
|
26
26
|
class WindowsFirewallRule < Chef::Resource
|
27
27
|
provides :windows_firewall_rule
|
28
28
|
|
29
|
-
description "Use the windows_firewall_rule resource to create, change or remove Windows firewall rules."
|
29
|
+
description "Use the **windows_firewall_rule** resource to create, change or remove Windows firewall rules."
|
30
30
|
introduced "14.7"
|
31
31
|
examples <<~DOC
|
32
|
-
Allowing port 80 access
|
32
|
+
**Allowing port 80 access**:
|
33
|
+
|
33
34
|
```ruby
|
34
35
|
windows_firewall_rule 'IIS' do
|
35
36
|
local_port '80'
|
@@ -38,7 +39,8 @@ class Chef
|
|
38
39
|
end
|
39
40
|
```
|
40
41
|
|
41
|
-
Allow protocol ICMPv6 with ICMP Type
|
42
|
+
**Allow protocol ICMPv6 with ICMP Type**:
|
43
|
+
|
42
44
|
```ruby
|
43
45
|
windows_firewall_rule 'CoreNet-Rule' do
|
44
46
|
rule_name 'CoreNet-ICMP6-LR2-In'
|
@@ -49,7 +51,8 @@ class Chef
|
|
49
51
|
end
|
50
52
|
```
|
51
53
|
|
52
|
-
Blocking WinRM over HTTP on a particular IP
|
54
|
+
**Blocking WinRM over HTTP on a particular IP**:
|
55
|
+
|
53
56
|
```ruby
|
54
57
|
windows_firewall_rule 'Disable WinRM over HTTP' do
|
55
58
|
local_port '5985'
|
@@ -59,7 +62,8 @@ class Chef
|
|
59
62
|
end
|
60
63
|
```
|
61
64
|
|
62
|
-
Deleting an existing rule
|
65
|
+
**Deleting an existing rule**
|
66
|
+
|
63
67
|
```ruby
|
64
68
|
windows_firewall_rule 'Remove the SSH rule' do
|
65
69
|
rule_name 'ssh'
|