Class AnsiblePlayer
Used for running Ansible playbooks within unit tests.
Namespace: Neon.Xunit
Assembly: Neon.Xunit.dll
Syntax
public static class AnsiblePlayer
Methods
Play(string, params string[])
Plays a playbook within a temporary directory using neon ansible play -- [args] playbook.
note
This method will have Ansible gather facts by default which can be quite slow. Consider using PlayNoGather(string, params string[]) instead for unit tests that don't required the facts.
Declaration
public static AnsiblePlayResults Play(string playbook, params string[] args)
Parameters
Type | Name | Description |
---|---|---|
string | playbook | The playbook text. |
string[] | args | Optional command line arguments to be included in the command. |
Returns
Type | Description |
---|---|
AnsiblePlayResults | An AnsiblePlayResults describing what happened. |
Remarks
note
Use this method for playbooks that need to read or write files.
PlayInFolder(string, string, params string[])
Plays a playbook within a specific working directory using neon ansible play -- [args] playbook.
note
This method will have Ansible gather facts by default which can be quite slow. Consider using PlayInFolderNoGather(string, string, params string[]) instead for unit tests that don't required the facts.
Declaration
public static AnsiblePlayResults PlayInFolder(string workDir, string playbook, params string[] args)
Parameters
Type | Name | Description |
---|---|---|
string | workDir | The playbook working directory (or |
string | playbook | The playbook text. |
string[] | args | Optional command line arguments to be included in the command. |
Returns
Type | Description |
---|---|
AnsiblePlayResults | An AnsiblePlayResults describing what happened. |
Remarks
note
Use this method for playbooks that need to read or write files.
PlayInFolderNoGather(string, string, params string[])
Plays a playbook without gathering facts by default within a specific working directory using neon ansible play -- [args] playbook.
Declaration
public static AnsiblePlayResults PlayInFolderNoGather(string workDir, string playbook, params string[] args)
Parameters
Type | Name | Description |
---|---|---|
string | workDir | The playbook working directory (or |
string | playbook | The playbook text. |
string[] | args | Optional command line arguments to be included in the command. |
Returns
Type | Description |
---|---|
AnsiblePlayResults | An AnsiblePlayResults describing what happened. |
Remarks
note
Use this method for playbooks that need to read or write files.
This method will add gather_facts: no to the playbook when this argument isn't already present.
PlayNoGather(string, params string[])
Plays a playbook without gathering facts by default within a temporary directory using neon ansible play -- [args] playbook.
Declaration
public static AnsiblePlayResults PlayNoGather(string playbook, params string[] args)
Parameters
Type | Name | Description |
---|---|---|
string | playbook | The playbook text. |
string[] | args | Optional command line arguments to be included in the command. |
Returns
Type | Description |
---|---|
AnsiblePlayResults | An AnsiblePlayResults describing what happened. |
Remarks
note
Use this method for playbooks that need to read or write files.
This method will add gather_facts: no to the playbook when this argument isnt already present.