Docsite things.

This commit is contained in:
Michael DeHaan 2014-06-18 15:21:52 -05:00 committed by Matt Martz
parent b22e2160cf
commit dfd4f18095
4 changed files with 19 additions and 14 deletions

View file

@ -13,5 +13,5 @@ Before we dive into the really fun parts -- playbooks, configuration management,
intro_patterns intro_patterns
intro_adhoc intro_adhoc
intro_configuration intro_configuration
intro_windows

View file

@ -67,8 +67,7 @@ Browse this index to see what is available.
In many cases, it may not be neccessary to even write or use an Ansible module. In many cases, it may not be neccessary to even write or use an Ansible module.
In particular, the "win_script" module can be used to run arbitrary powershell scripts, allowing Windows administrators familiar with powershell a very In particular, the "win_script" module can be used to run arbitrary powershell scripts, allowing Windows administrators familiar with powershell a very native way to do things, as in the following playbook::
native way to do things, as in the following playbook:
- hosts: windows - hosts: windows
tasks: tasks:
@ -108,9 +107,9 @@ Additional modules may be submitted as pull requests to github.
System Prep System Prep
``````````` ```````````
In order for Ansible to manage your windows machines, you will have to enable Powershell remoting first, which also enables WinRM:: In order for Ansible to manage your windows machines, you will have to enable Powershell remoting first, which also enables WinRM.
From the Windows host, launch the Powershell Client. For information on Powershell, visit 'Microsoft's Using Powershell article <http://technet.microsoft.com/en-us/library/dn425048.aspx>' From the Windows host, launch the Powershell Client. For information on Powershell, visit `Microsoft's Using Powershell article <http://technet.microsoft.com/en-us/library/dn425048.aspx>`_.
In the powershell session, run the following to enable PS Remoting and set the execution policy In the powershell session, run the following to enable PS Remoting and set the execution policy
@ -134,9 +133,9 @@ By default, Powershell remoting enables an HTTP listener. The following commands
An SSL certificate for server authentication is required to create the HTTPS listener. The existence of an existing certificate in the computer account can be verified by using the MMC snap-in, as documented ' An SSL certificate for server authentication is required to create the HTTPS listener. The existence of an existing certificate in the computer account can be verified by using the MMC snap-in, as documented '
A best practice for SSL certificates is generating them from an internal or external certificate authority. An existing certificate could be located in the computer account certificate store 'using the following article <http://technet.microsoft.com/en-us/library/cc754431.aspx#BKMK_computer>'. A best practice for SSL certificates is generating them from an internal or external certificate authority. An existing certificate could be located in the computer account certificate store `using the following article <http://technet.microsoft.com/en-us/library/cc754431.aspx#BKMK_computer>`_.
Alternatively, a self-signed SSL certificate can be generated in powershell using 'the following technet article <http://social.technet.microsoft.com/wiki/contents/articles/4714.how-to-generate-a-self-signed-certificate-using-powershell.aspx>'. At a minimum, the subject name should match the hostname, and Server Authentication is required. Once the self signed certificate is obtained, the certificate thumbprint can be identified using 'How to: Retrieve the Thumbprint of a Certificate <http://msdn.microsoft.com/en-us/library/ms734695%28v=vs.110%29.aspx>' Alternatively, a self-signed SSL certificate can be generated in powershell using 'the following technet article <http://social.technet.microsoft.com/wiki/contents/articles/4714.how-to-generate-a-self-signed-certificate-using-powershell.aspx>'. At a minimum, the subject name should match the hostname, and Server Authentication is required. Once the self signed certificate is obtained, the certificate thumbprint can be identified using `How to: Retrieve the Thumbprint of a Certificate <http://msdn.microsoft.com/en-us/library/ms734695%28v=vs.110%29.aspx>`_
.. code-block:: bash .. code-block:: bash
@ -192,7 +191,7 @@ Running individual commands uses the 'raw' module, as opposed to the shell or co
register: ipconfig register: ipconfig
- debug: var=ipconfig - debug: var=ipconfig
And for a final example, here's how to use the win_stat module to test for file existance. Note that the data returned byt he win_stat module is slightly different than what is provided by the Linux equivalent. And for a final example, here's how to use the win_stat module to test for file existance. Note that the data returned byt he win_stat module is slightly different than what is provided by the Linux equivalent::
- name: test stat module - name: test stat module
hosts: windows hosts: windows
@ -211,7 +210,7 @@ And for a final example, here's how to use the win_stat module to test for file
- "stat_file.stat.size > 0" - "stat_file.stat.size > 0"
- "stat_file.stat.md5" - "stat_file.stat.md5"
Again, recall that the Windows modules are all listed in the Windows category of modules, with the exception that the "raw", "script", and "fetch" modules are also available. These modules do not start with a "win_" prefix. Again, recall that the Windows modules are all listed in the Windows category of modules, with the exception that the "raw", "script", and "fetch" modules are also available. These modules do not start with a "win" prefix.
.. _windows_contributions: .. _windows_contributions:
@ -232,3 +231,4 @@ form of new modules, tweaks to existing modules, documentation, or something els
`irc.freenode.net <http://irc.freenode.net>`_ `irc.freenode.net <http://irc.freenode.net>`_
#ansible IRC chat channel #ansible IRC chat channel

View file

@ -218,12 +218,11 @@ Version Comparison Filters
To compare a version number, such as checking if the ``ansible_distribution_version`` To compare a version number, such as checking if the ``ansible_distribution_version``
version is greater than or equal to '12.04', you can use the ``version_compare`` filter:: version is greater than or equal to '12.04', you can use the ``version_compare`` filter::
The ``version_compare`` filter can also be used to evaluate the ``ansible_distribution_version``:: The `version_compare` filter can also be used to evaluate the `ansible_distribution_version`::
{{ ansible_distribution_version | version_compare('12.04', '>=') }} {{ ansible_distribution_version | version_compare('12.04', '>=') }}
If ``ansible_distribution_version`` is greater than or equal to 12, this filter will return True, otherwise If ``ansible_distribution_version`` is greater than or equal to 12, this filter will return True, otherwise it will return False.
it will return False.
The ``version_compare`` filter accepts the following operators:: The ``version_compare`` filter accepts the following operators::
@ -234,10 +233,10 @@ be used. The default is ``False``, and if set as ``True`` will use more strict
{{ sample_version_var | version_compare('1.0', operator='lt', strict=True) }} {{ sample_version_var | version_compare('1.0', operator='lt', strict=True) }}
.. _random_filter .. _random_filter:
Random Number Filter Random Number Filter
-------------------------- --------------------
.. versionadded:: 1.6 .. versionadded:: 1.6

View file

@ -123,6 +123,12 @@ def list_modules(module_dir):
if os.path.isdir(d): if os.path.isdir(d):
files2 = glob.glob("%s/*" % d) files2 = glob.glob("%s/*" % d)
for f in files2: for f in files2:
if f.endswith(".ps1"):
# windows powershell modules have documentation stubs in python docstring
# format (they are not executed) so skip the ps1 format files
continue
tokens = f.split("/") tokens = f.split("/")
module = tokens[-1] module = tokens[-1]
category = tokens[-2] category = tokens[-2]