serverless – Manages a Serverless Framework project¶
Synopsis¶
- Provides support for managing Serverless Framework (https://serverless.com/) project deployments and stacks.
Requirements¶
The below requirements are needed on the host that executes this module.
- serverless
- yaml
Parameters¶
Notes¶
Note
- Currently, the serverlesscommand must be in the path of the node executing the task. In the future this may be a flag.
Examples¶
- name: Basic deploy of a service
  serverless:
    service_path: '{{ project_dir }}'
    state: present
- name: Deploy specific functions
  serverless:
    service_path: '{{ project_dir }}'
    functions:
      - my_func_one
      - my_func_two
- name: 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_info module can get a full list of the stack resources, as
# well as stack events and outputs
- cloudformation_info:
    region: us-east-1
    stack_name: '{{ sls.service_name }}'
    stack_resources: true
- name: Deploy a project using a locally installed serverless binary
  serverless:
    stage: dev
    region: us-east-1
    service_path: '{{ project_dir }}'
    serverless_bin_path: node_modules/.bin/serverless
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Status¶
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]
Authors¶
- Ryan Scott Brown (@ryansb)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.
