Skip to content

Commit e259dfb

Browse files
DCtheGeeksdwheeler
authored andcommitted
Fixes #4671, #3768 - Added PsDscRunAsCredential and cleanup (#4821)
* Fixes #4671 - Added PsDscRunAsCredential and cleanup * Fix #3768 - Removing trailing slash * Style cleanup and remove bad chars
1 parent 1a138e0 commit e259dfb

34 files changed

+1202
-822
lines changed

dsc/reference/resources/linux/lnxArchiveResource.md

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
2-
ms.date: 06/12/2017
3-
keywords: dsc,powershell,configuration,setup
4-
title: DSC for Linux nxArchive Resource
2+
ms.date: 09/20/2019
3+
keywords: dsc,powershell,configuration,setup
4+
title: DSC for Linux nxArchive Resource
55
---
6-
76
# DSC for Linux nxArchive Resource
87

9-
The **nxArchive** resource in PowerShell Desired State Configuration (DSC) provides a mechanism to unpack archive (.tar, .zip) files at a specific path on a Linux node.
8+
The **nxArchive** resource in PowerShell Desired State Configuration (DSC) provides a mechanism to
9+
unpack archive (.tar, .zip) files at a specific path on a Linux node.
1010

1111
## Syntax
1212

13-
```
13+
```Syntax
1414
nxArchive <string> #ResourceName
1515
{
1616
SourcePath = <string>
@@ -24,35 +24,41 @@ nxArchive <string> #ResourceName
2424

2525
## Properties
2626

27-
| Property | Description |
27+
|Property |Description |
28+
|---|---|
29+
|SourcePath |Specifies the source path of the archive file. This should be a .tar, .zip, or .tar.gz file. |
30+
|DestinationPath |Specifies the location where you want to ensure the archive contents are extracted. |
31+
|Checksum |Defines the type to use when determining whether the source archive has been updated. Values are: **ctime**, **mtime**, or **md5**. The default value is **md5**. |
32+
|Force |Certain file operations (such as overwriting a file or deleting a directory that is not empty) will result in an error. Using the **Force** property overrides such errors. The default value is `$false`. |
33+
34+
## Common properties
35+
36+
|Property |Description |
2837
|---|---|
29-
| SourcePath| Specifies the source path of the archive file. This should be a .tar, .zip, or .tar.gz file. |
30-
| DestinationPath| Specifies the location where you want to ensure the archive contents are extracted.|
31-
| Checksum| Defines the type to use when determining whether the source archive has been updated. Values are: "ctime", "mtime", or "md5". The default value is "md5".|
32-
| Force| Certain file operations (such as overwriting a file or deleting a directory that is not empty) will result in an error. Using the **Force** property overrides such errors. The default value is **$false**.|
33-
| DependsOn | Indicates that the configuration of another resource must run before this resource is configured. For example, if the **ID** of the resource configuration script block that you want to run first is **ResourceName** and its type is **ResourceType**, the syntax for using this property is `DependsOn = "[ResourceType]ResourceName"`.|
34-
| Ensure| Determines whether to check if the content of the archive exists at the **Destination**. Set this property to "Present" to ensure the contents exist. Set it to "Absent" to ensure they do not exist. The default value is "Present".|
38+
|DependsOn |Indicates that the configuration of another resource must run before this resource is configured. For example, if the ID of the resource configuration script block that you want to run first is ResourceName and its type is ResourceType, the syntax for using this property is `DependsOn = "[ResourceType]ResourceName"`. |
39+
|Ensure |Determines whether to check if the content of the archive exists at the **Destination**. Set this property to **Present** to ensure the contents exist. Set it to **Absent** to ensure they do not exist. The default value is **Present**. |
3540

3641
## Example
3742

38-
The following example shows how to use the **nxArchive** resource to ensure that the contents of an archive file called `website.tar` exist and are extracted at a given destination.
43+
The following example shows how to use the **nxArchive** resource to ensure that the contents of an
44+
archive file called `website.tar` exist and are extracted at a given destination.
3945

40-
```
46+
```powershell
4147
Import-DSCResource -Module nx
4248
4349
nxFile SyncArchiveFromWeb
4450
{
4551
Ensure = "Present"
46-
SourcePath = http://release.contoso.com/releases/website.tar
52+
SourcePath = "http://release.contoso.com/releases/website.tar"
4753
DestinationPath = "/usr/release/staging/website.tar"
4854
Type = "File"
49-
Checksum = mtime
55+
Checksum = "mtime"
5056
}
5157
5258
nxArchive SyncWebDir
5359
{
54-
SourcePath = /usr/release/staging/website.tar
55-
DestinationPath = /usr/local/apache2/htdocs/
60+
SourcePath = "/usr/release/staging/website.tar"
61+
DestinationPath = "/usr/local/apache2/htdocs/"
5662
Force = $false
5763
DependsOn = "[nxFile]SyncArchiveFromWeb"
5864
}
Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,64 @@
11
---
2-
ms.date: 06/12/2017
3-
keywords: dsc,powershell,configuration,setup
4-
title: DSC for Linux nxEnvironment Resource
2+
ms.date: 09/20/2019
3+
keywords: dsc,powershell,configuration,setup
4+
title: DSC for Linux nxEnvironment Resource
55
---
6-
76
# DSC for Linux nxEnvironment Resource
87

9-
The **nxEnvironment** resource in PowerShell Desired State Configuration (DSC) provides a mechanism to manage system environment variables on a Linux node.
8+
The **nxEnvironment** resource in PowerShell Desired State Configuration (DSC) provides a mechanism
9+
to manage system environment variables on a Linux node.
1010

1111
## Syntax
1212

13-
```
13+
```Syntax
1414
nxEnvironment <string> #ResourceName
1515
{
1616
Name = <string>
1717
[ Value = <string>
18-
[ Ensure = <string> { Absent | Present } ]
1918
[ Path = <bool> }
2019
[ DependsOn = <string[]> ]
21-
20+
[ Ensure = <string> { Absent | Present } ]
2221
}
2322
```
2423

2524
## Properties
2625

27-
| Property | Description |
26+
|Property |Description |
2827
|---|---|
29-
| Name| Indicates the name of the environment variable for which you want to ensure a specific state.|
30-
| Value| The value to assign to the environment variable.|
31-
| Ensure| Determines whether to check if the variable exists. Set this property to "Present" to ensure the variable exists. Set it to "Absent" to ensure the variable does not exist. The default value is "Present".|
32-
| Path| Defines the environment variable that is being configured. Set this property to **$true** if the variable is the **Path** variable; otherwise, set it to **$false**. The default is **$false**. If the variable being configured is the **Path** variable, the value provided through the **Value** property will be appended to the existing value.|
33-
| DependsOn | Indicates that the configuration of another resource must run before this resource is configured. For example, if the **ID** of the resource configuration script block that you want to run first is **ResourceName** and its type is **ResourceType**, the syntax for using this property is `DependsOn = "[ResourceType]ResourceName"`.|
28+
|Name |Indicates the name of the environment variable for which you want to ensure a specific state. |
29+
|Value |The value to assign to the environment variable. |
30+
|Path |Defines the environment variable that is being configured. Set this property to `$true` if the variable is the **Path** variable; otherwise, set it to `$false`. The default is `$false`. If the variable being configured is the **Path** variable, the value provided through the **Value** property will be appended to the existing value. |
31+
32+
## Common properties
33+
34+
|Property |Description |
35+
|---|---|
36+
|DependsOn |Indicates that the configuration of another resource must run before this resource is configured. For example, if the ID of the resource configuration script block that you want to run first is ResourceName and its type is ResourceType, the syntax for using this property is `DependsOn = "[ResourceType]ResourceName"`. |
37+
|Ensure |Determines whether to check if the variable exists. Set this property to **Present** to ensure the variable exists. Set it to **Absent** to ensure the variable does not exist. The default value is **Present**. |
3438

3539
## Additional Information
3640

37-
* If **Path** is absent or set to **$false**, environment variables are managed in `/etc/environment`. Your programs or scripts may require configuration to source the `/etc/environment` file to access the managed environment variables.
38-
* If **Path** is set to **$true**, the environment variable is managed in the file `/etc/profile.d/DSCenvironment.sh`. This file will be created if it does not exist. If **Ensure** is set to "Absent" and **Path** is set to **$true**, an existing environment variable will only be removed from `/etc/profile.d/DSCenvironment.sh` and not from other files.
41+
- If **Path** is absent or set to `$false`, environment variables are managed in `/etc/environment`.
42+
Your programs or scripts may require configuration to source the `/etc/environment` file to access
43+
the managed environment variables.
44+
- If **Path** is set to `$true`, the environment variable is managed in the file
45+
`/etc/profile.d/DSCenvironment.sh`. This file will be created if it does not exist. If **Ensure**
46+
is set to **Absent** and **Path** is set to `$true`, an existing environment variable will only be
47+
removed from `/etc/profile.d/DSCenvironment.sh` and not from other files.
3948

4049
## Example
4150

42-
The following example shows how to use the **nxEnvironment** resource to ensure that **TestEnvironmentVariable** is present and has the value "Test-Value". If **TestEnvironmentVariable** is not present, it will be created.
51+
The following example shows how to use the **nxEnvironment** resource to ensure that
52+
**TestEnvironmentVariable** is present and has the value "Test-Value". If
53+
**TestEnvironmentVariable** is not present, it will be created.
4354

44-
```
55+
```powershell
4556
Import-DSCResource -Module nx
4657
47-
4858
nxEnvironment EnvironmentExample
4959
{
50-
Ensure = Present
51-
Name = TestEnvironmentVariable
52-
Value = TestValue
60+
Ensure = "Present"
61+
Name = "TestEnvironmentVariable"
62+
Value = "TestValue"
5363
}
5464
```

dsc/reference/resources/linux/lnxFileLineResource.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,50 @@
11
---
2-
ms.date: 06/12/2017
3-
keywords: dsc,powershell,configuration,setup
4-
title: DSC for Linux nxFileLine Resource
2+
ms.date: 09/20/2019
3+
keywords: dsc,powershell,configuration,setup
4+
title: DSC for Linux nxFileLine Resource
55
---
66
# DSC for Linux nxFileLine Resource
77

8-
The **nxFileLine** resource in PowerShell Desired State Configuration (DSC) provides a mechanism to manage lines within a configuration file on a Linux node.
8+
The **nxFileLine** resource in PowerShell Desired State Configuration (DSC) provides a mechanism to
9+
manage lines within a configuration file on a Linux node.
910

1011
## Syntax
1112

12-
```
13+
```Syntax
1314
nxFileLine <string> #ResourceName
1415
{
1516
FilePath = <string>
1617
ContainsLine = <string>
1718
[ DoesNotContainPattern = <string> ]
1819
[ DependsOn = <string[]> ]
19-
2020
}
2121
```
2222

2323
## Properties
2424

25-
| Property | Description |
25+
|Property |Description |
26+
|---|---|
27+
|FilePath |The full path to the file to manage lines in on the target node. |
28+
|ContainsLine |A line to ensure exists in the file. This line will be appended to the file if it does not exist in the file. **ContainsLine** is mandatory, but can be set to an empty string (`ContainsLine = ""`) if it is not needed. |
29+
|DoesNotContainPattern |A regular expression pattern for lines that should not exist in the file. For any lines that exist in the file that match this regular expression, the line will be removed from the file. |
30+
31+
## Common properties
32+
33+
|Property |Description |
2634
|---|---|
27-
| FilePath| The full path to the file to manage lines in on the target node.|
28-
| ContainsLine| A line to ensure exists in the file. This line will be appended to the file if it does not exist in the file. **ContainsLine** is mandatory, but can be set to an empty string (`ContainsLine = ""`) if it is not needed.|
29-
| DoesNotContainPattern| A regular expression pattern for lines that should not exist in the file. For any lines that exist in the file that match this regular expression, the line will be removed from the file.|
30-
| DependsOn | Indicates that the configuration of another resource must run before this resource is configured. For example, if the **ID** of the resource configuration script block that you want to run first is **ResourceName** and its type is **ResourceType**, the syntax for using this property is `DependsOn = "[ResourceType]ResourceName"`.|
35+
|DependsOn |Indicates that the configuration of another resource must run before this resource is configured. For example, if the ID of the resource configuration script block that you want to run first is ResourceName and its type is ResourceType, the syntax for using this property is `DependsOn = "[ResourceType]ResourceName"`. |
3136

3237
## Example
3338

34-
This example demonstrates using the **nxFileLine** resource to configure the `/etc/sudoers` file, ensuring that the user: monuser is configured to not requiretty.
39+
This example demonstrates using the **nxFileLine** resource to configure the `/etc/sudoers` file,
40+
ensuring that the user: monuser is configured to not requiretty.
3541

3642
```powershell
3743
Import-DscResource -Module nx
3844
3945
nxFileLine DoNotRequireTTY
4046
{
41-
FilePath = /etc/sudoers
47+
FilePath = "/etc/sudoers"
4248
ContainsLine = 'Defaults:monuser !requiretty'
4349
DoesNotContainPattern = "Defaults:monuser[ ]+requiretty"
4450
}

0 commit comments

Comments
 (0)