From db2e1d92274a1a29fc9c1b869c7f00835a44a8c7 Mon Sep 17 00:00:00 2001 From: Alicia Cozine <879121+acozine@users.noreply.github.com> Date: Wed, 16 Oct 2019 10:24:38 -0500 Subject: [PATCH] Backport/2.9/docs (#63521) * Update stat.py (#63289) Reword awkward documentation language. (cherry picked from commit b46299ff86f273c729d0817db90cb52fda04e2d3) * Update win_disk_facts.py example (#63266) Fix incorrect index for second disk (should be `disks[1]` not `disks[0]`) (cherry picked from commit ce1c8c24f7aa85e90cc2ac5ffa1c3381e16c0c1e) * Fix broken link (#63185) (cherry picked from commit 021d095625304a44911da55046f0648aa1db49ee) * Typo on line 161 (#63133) fix module name for azure_rm_manageddisk in one example (cherry picked from commit 81a614684ae0434e4ce7336447c41d9b8ffce41d) * docs: add Centos and Ubuntu to examples for playbook conditionals (#63085) Co-Authored-By: Sandra McCann (cherry picked from commit 19587b35da4eb16e25d3b9d333401592575ce764) * Spot instance code error (#63246) Adds 'instance_initiated_shutdown_behavior: terminate' to spot instance example for greater efficiency. (cherry picked from commit 5ed163ce3f0814985add5352209ef5621482e428) * Pass a JSON file to the Lambda's payload (#63261) * Add an example of passing a JSON file to the Lambda's payload Events passed to Lambda are commonly in JSON format, the change provides an example of using JSON file as an alternative to the inline YAML payload in the other examples. (cherry picked from commit 1d5206f53e7cb5f12cb57d1fc5fe98ac4cdf6198) * Update ec2.py (#63260) Change the explanation of spot_wait_timeout (cherry picked from commit 719170e5c1361532bd65f5d9817055c2822e54cc) * fix aruba_config examples (#63136) (cherry picked from commit 6ff5968781c77469472be4719036efbe9f6a66f0) * [ec2_launch_template] Update examples (#63152) - Update tasks names for existing examples - Add a new example showing how to delete a launch template (cherry picked from commit 32980f214a4df97aee871ffd86168bb1cff804a8) --- docs/docsite/rst/dev_guide/testing_units.rst | 6 ++--- .../rst/user_guide/playbooks_conditionals.rst | 2 ++ lib/ansible/modules/cloud/amazon/ec2.py | 3 ++- .../cloud/amazon/ec2_launch_template.py | 23 +++++++++++-------- .../modules/cloud/amazon/execute_lambda.py | 8 ++++++- .../cloud/azure/azure_rm_manageddisk.py | 2 +- lib/ansible/modules/files/stat.py | 2 +- .../modules/network/aruba/aruba_config.py | 2 +- lib/ansible/modules/windows/win_disk_facts.py | 2 +- 9 files changed, 32 insertions(+), 18 deletions(-) diff --git a/docs/docsite/rst/dev_guide/testing_units.rst b/docs/docsite/rst/dev_guide/testing_units.rst index ab760852394..be243b75984 100644 --- a/docs/docsite/rst/dev_guide/testing_units.rst +++ b/docs/docsite/rst/dev_guide/testing_units.rst @@ -76,10 +76,10 @@ install all the required dependencies needed for unit tests. For example: When using ``ansible-test`` with ``--tox`` requires tox >= 2.5.0 -The full list of requirements can be found at `test/runner/requirements -`_. Requirements +The full list of requirements can be found at `test/lib/ansible_test/_data/requirements +`_. Requirements files are named after their respective commands. See also the `constraints -`_ +`_ applicable to all commands. diff --git a/docs/docsite/rst/user_guide/playbooks_conditionals.rst b/docs/docsite/rst/user_guide/playbooks_conditionals.rst index fad0834ffe2..d07d942de49 100644 --- a/docs/docsite/rst/user_guide/playbooks_conditionals.rst +++ b/docs/docsite/rst/user_guide/playbooks_conditionals.rst @@ -352,6 +352,7 @@ Possible values (sample, not complete list):: Archlinux ClearLinux Coreos + CentOS Debian Fedora Gentoo @@ -363,6 +364,7 @@ Possible values (sample, not complete list):: Slackware SMGL SUSE + Ubuntu VMwareESX .. See `OSDIST_LIST` diff --git a/lib/ansible/modules/cloud/amazon/ec2.py b/lib/ansible/modules/cloud/amazon/ec2.py index a1da2795a54..f17e825ecfe 100644 --- a/lib/ansible/modules/cloud/amazon/ec2.py +++ b/lib/ansible/modules/cloud/amazon/ec2.py @@ -118,7 +118,7 @@ options: spot_wait_timeout: version_added: "1.5" description: - - How long to wait for the spot instance request to be fulfilled. + - How long to wait for the spot instance request to be fulfilled. Affects 'Request valid until' for setting spot request lifespan. default: 600 type: int count: @@ -370,6 +370,7 @@ EXAMPLES = ''' vpc_subnet_id: subnet-29e63245 assign_public_ip: yes spot_launch_group: report_generators + instance_initiated_shutdown_behavior: terminate # Examples using pre-existing network interfaces - ec2: diff --git a/lib/ansible/modules/cloud/amazon/ec2_launch_template.py b/lib/ansible/modules/cloud/amazon/ec2_launch_template.py index 85a269e5353..13567f2880c 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_launch_template.py +++ b/lib/ansible/modules/cloud/amazon/ec2_launch_template.py @@ -286,24 +286,29 @@ options: ''' EXAMPLES = ''' -- name: Make instance with an instance_role +- name: Create an ec2 launch template ec2_launch_template: - name: "test-with-instance-role" - image_id: "ami-foobarbaz" + name: "my_template" + image_id: "ami-04b762b4289fba92b" key_name: my_ssh_key instance_type: t2.micro iam_instance_profile: myTestProfile disable_api_termination: true -- name: Make one with a different instance type, but leave the older version as default +- name: > + Create a new version of an existing ec2 launch template with a different instance type, + while leaving an older version as the default version ec2_launch_template: - name: "test-with-instance-role" - image_id: "ami-foobarbaz" + name: "my_template" default_version: 1 - key_name: my_ssh_key instance_type: c5.4xlarge - iam_instance_profile: myTestProfile - disable_api_termination: true + +- name: Delete an ec2 launch template + ec2_launch_template: + name: "my_template" + state: absent + +# This module does not yet allow deletion of specific versions of launch templates ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/amazon/execute_lambda.py b/lib/ansible/modules/cloud/amazon/execute_lambda.py index ebe5bf69273..3d88c480870 100644 --- a/lib/ansible/modules/cloud/amazon/execute_lambda.py +++ b/lib/ansible/modules/cloud/amazon/execute_lambda.py @@ -106,7 +106,13 @@ EXAMPLES = ''' wait: true tail_log: true register: response - # the response will have a `logs` key that will contain a log (up to 4KB) of the function execution in Lambda. + # the response will have a `logs` key that will contain a log (up to 4KB) of the function execution in Lambda + +# Pass the Lambda event payload as a json file. +- execute_lambda: + name: test-function + payload: "{{ lookup('file','lambda_event.json') }}" + register: response - execute_lambda: name: test-function diff --git a/lib/ansible/modules/cloud/azure/azure_rm_manageddisk.py b/lib/ansible/modules/cloud/azure/azure_rm_manageddisk.py index e630f1bcdd6..5ea2240d2f0 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_manageddisk.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_manageddisk.py @@ -158,7 +158,7 @@ EXAMPLES = ''' disk_size_gb: 4 - name: Delete managed disk - azure_rm_manage_disk: + azure_rm_manageddisk: name: mymanageddisk location: eastus resource_group: myResourceGroup diff --git a/lib/ansible/modules/files/stat.py b/lib/ansible/modules/files/stat.py index 14ff90cb909..b05d701237d 100644 --- a/lib/ansible/modules/files/stat.py +++ b/lib/ansible/modules/files/stat.py @@ -342,7 +342,7 @@ stat: sample: False version_added: 2.2 executable: - description: Tells you if the invoking user has the execute the path + description: Tells you if the invoking user has execute permission on the path returned: success, path exists and user can execute the path type: bool sample: False diff --git a/lib/ansible/modules/network/aruba/aruba_config.py b/lib/ansible/modules/network/aruba/aruba_config.py index fa5a28eb3c9..2123dfbe841 100644 --- a/lib/ansible/modules/network/aruba/aruba_config.py +++ b/lib/ansible/modules/network/aruba/aruba_config.py @@ -184,7 +184,7 @@ EXAMPLES = """ - name: diff the running-config against a provided config aruba_config: diff_against: intended - intended: "{{ lookup('file', 'master.cfg') }}" + intended_config: "{{ lookup('file', 'master.cfg') }}" - name: configure interface settings aruba_config: diff --git a/lib/ansible/modules/windows/win_disk_facts.py b/lib/ansible/modules/windows/win_disk_facts.py index 2a9f293545a..a9a77a29c5a 100644 --- a/lib/ansible/modules/windows/win_disk_facts.py +++ b/lib/ansible/modules/windows/win_disk_facts.py @@ -50,7 +50,7 @@ EXAMPLES = r''' - name: Output second disk serial number debug: - var: ansible_facts.disks[0].serial_number + var: ansible_facts.disks[1].serial_number ''' RETURN = r'''