ansible / ansible.builtin / v2.5.15 / module / serverless Manages a Serverless Framework project | "added in version" 2.3 of ansible.builtin" Authors: Ryan Scott Brown @ryansb preview | supported by communityansible.builtin.serverless (v2.5.15) — module
pip
Install with pip install ansible==2.5.15
Provides support for managing Serverless Framework (https://serverless.com/) project deployments and stacks.
# Basic deploy of a service - serverless: service_path: '{{ project_dir }}' state: present
# Deploy specific functions - serverless: service_path: '{{ project_dir }}' functions: - my_func_one - my_func_two
# deploy a project, then pull its resource list back into Ansible - serverless: stage: dev region: us-east-1 service_path: '{{ project_dir }}' register: sls
# The cloudformation stack is always named the same as the full service, so the # cloudformation_facts module can get a full list of the stack resources, as # well as stack events and outputs - cloudformation_facts: region: us-east-1 stack_name: '{{ sls.service_name }}' stack_resources: true
# Deploy a project but use a locally installed serverless binary instead of the global serverless binary - serverless: stage: dev region: us-east-1 service_path: '{{ project_dir }}' serverless_bin_path: node_modules/.bin/serverless
stage: description: - The name of the serverless framework project stage to deploy to. This uses the serverless framework default "dev". required: false state: choices: - present - absent default: present description: - Goal state of given stage/project required: false deploy: default: true description: - Whether or not to deploy artifacts after building them. When this option is `false` all the functions will be built, but no stack update will be run to send them out. This is mostly useful for generating artifacts to be stored/deployed elsewhere. required: false region: default: us-east-1 description: - AWS region to deploy the service to required: false functions: default: [] description: - A list of specific functions to deploy. If this is not provided, all functions in the service will be deployed. required: false service_path: description: - The path to the root of the Serverless Service to be operated on. required: true serverless_bin_path: description: - The path of a serverless framework binary relative to the 'service_path' eg. node_module/.bin/serverless required: false version_added: '2.4' version_added_collection: ansible.builtin
command: description: Full `serverless` command run by this module, in case you want to re-run the command outside the module. returned: always sample: serverless deploy --stage production type: string service_name: description: The service name specified in the serverless.yml that was just deployed. returned: always sample: my-fancy-service-dev type: string state: description: Whether the stack for the serverless project is present/absent. returned: always type: string