├── test └── integration │ └── default.yml ├── roles ├── StackStorm.st2repo │ ├── vars │ │ ├── stable.yml │ │ ├── unstable.yml │ │ ├── staging-stable.yml │ │ └── staging-unstable.yml │ ├── defaults │ │ └── main.yml │ ├── tasks │ │ ├── main.yml │ │ ├── st2repo_debian.yml │ │ └── st2repo_redhat.yml │ └── meta │ │ └── main.yml ├── StackStorm.ewc │ ├── vars │ │ ├── enterprise.yml │ │ ├── enterprise-unstable.yml │ │ ├── staging-enterprise.yml │ │ └── staging-enterprise-unstable.yml │ ├── handlers │ │ └── main.yml │ ├── templates │ │ ├── rbac_assignments │ │ │ └── assignments.yml.j2 │ │ └── rbac_roles │ │ │ └── roles.yml.j2 │ ├── tasks │ │ ├── ewc_repos_cleanup_redhat.yml │ │ ├── ewc_repos_cleanup_debian.yml │ │ ├── ldap.yml │ │ ├── ewc_repos_redhat.yml │ │ ├── ewc_repos_setup.yml │ │ ├── main.yml │ │ ├── rbac.yml │ │ ├── license.yml │ │ └── ewc_repos_debian.yml │ ├── meta │ │ └── main.yml │ └── defaults │ │ └── main.yml ├── StackStorm.mongodb │ ├── defaults │ │ └── main.yml │ ├── vars │ │ ├── main.yml │ │ ├── redhat_8.yml │ │ ├── redhat.yml │ │ └── debian.yml │ ├── handlers │ │ └── main.yml │ ├── meta │ │ └── main.yml │ └── tasks │ │ ├── mongodb_auth.yml │ │ ├── main.yml │ │ ├── mongodb_debian.yml │ │ └── mongodb_redhat.yml ├── StackStorm.st2 │ ├── tasks │ │ ├── flush_handlers.yml │ │ ├── config.yml │ │ ├── proxy.yml │ │ ├── version.yml │ │ ├── datastore.yml │ │ ├── packs.yml │ │ ├── user.yml │ │ ├── request_ppa.yml │ │ ├── auth.yml │ │ └── main.yml │ ├── vars │ │ ├── redhat.yml │ │ ├── redhat_8.yml │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── handlers │ │ └── main.yml │ └── defaults │ │ └── main.yml ├── StackStorm.nodejs │ ├── defaults │ │ └── main.yml │ ├── tasks │ │ ├── main.yml │ │ ├── nodejs_debian.yml │ │ └── nodejs_redhat.yml │ └── meta │ │ └── main.yml ├── StackStorm.nginx │ ├── vars │ │ ├── redhat.yml │ │ └── redhat_8.yml │ ├── handlers │ │ └── main.yml │ ├── meta │ │ └── main.yml │ └── tasks │ │ ├── main.yml │ │ ├── nginx_debian.yml │ │ └── nginx_redhat.yml ├── StackStorm.rabbitmq │ ├── handlers │ │ └── main.yml │ ├── vars │ │ └── main.yml │ ├── defaults │ │ └── main.yml │ ├── meta │ │ └── main.yml │ └── tasks │ │ └── main.yml ├── StackStorm.st2chatops │ ├── handlers │ │ └── main.yml │ ├── vars │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── defaults │ │ └── main.yml │ └── tasks │ │ └── main.yml ├── StackStorm.ewc_smoketests │ ├── templates │ │ ├── rbac_assignments │ │ │ └── assignments.yml.j2 │ │ └── rbac_roles │ │ │ └── roles.yml.j2 │ ├── meta │ │ └── main.yml │ ├── defaults │ │ └── main.yml │ └── tasks │ │ ├── teardown.yml │ │ └── main.yml ├── StackStorm.st2web │ ├── vars │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── defaults │ │ └── main.yml │ └── tasks │ │ ├── certificate.yml │ │ └── main.yml ├── StackStorm.epel │ ├── meta │ │ └── main.yml │ └── tasks │ │ └── main.yml └── StackStorm.st2smoketests │ └── tasks │ ├── st2chatops.yml │ └── main.yml ├── ansible.cfg ├── Gemfile ├── .gitignore ├── .github └── FUNDING.yml ├── ansible.cfg.galaxy ├── stackstorm.yml ├── .yamllint ├── .kitchen-docker ├── centos7 │ └── Dockerfile └── centos8 │ └── Dockerfile ├── .circleci └── config.yml ├── meta └── main.yml ├── .kitchen.yml ├── Vagrantfile ├── .travis.yml ├── README.md └── LICENSE /test/integration/default.yml: -------------------------------------------------------------------------------- 1 | ../../stackstorm.yml -------------------------------------------------------------------------------- /roles/StackStorm.st2repo/vars/stable.yml: -------------------------------------------------------------------------------- 1 | --- 2 | key_id: 3CE01873543A4CCE 3 | -------------------------------------------------------------------------------- /roles/StackStorm.st2repo/vars/unstable.yml: -------------------------------------------------------------------------------- 1 | --- 2 | key_id: 1CDF3CE710B2CCF3 3 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc/vars/enterprise.yml: -------------------------------------------------------------------------------- 1 | --- 2 | enterprise_key_id: E8518D3790C81C76 3 | -------------------------------------------------------------------------------- /roles/StackStorm.st2repo/vars/staging-stable.yml: -------------------------------------------------------------------------------- 1 | --- 2 | key_id: 527B93CA96ADF311 3 | -------------------------------------------------------------------------------- /roles/StackStorm.st2repo/vars/staging-unstable.yml: -------------------------------------------------------------------------------- 1 | --- 2 | key_id: 9A2236A8CEC0C6A8 3 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc/vars/enterprise-unstable.yml: -------------------------------------------------------------------------------- 1 | --- 2 | enterprise_key_id: AEFF7A20DC68594D 3 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc/vars/staging-enterprise.yml: -------------------------------------------------------------------------------- 1 | --- 2 | enterprise_key_id: 216C528AB257619D 3 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc/vars/staging-enterprise-unstable.yml: -------------------------------------------------------------------------------- 1 | --- 2 | enterprise_key_id: D8A9369569165CC0 3 | -------------------------------------------------------------------------------- /roles/StackStorm.mongodb/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # MongoDB default version 3 | mongodb_version: "4.0" 4 | -------------------------------------------------------------------------------- /roles/StackStorm.st2/tasks/flush_handlers.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - meta: flush_handlers 3 | tags: st2, st2_packs 4 | -------------------------------------------------------------------------------- /roles/StackStorm.st2/vars/redhat.yml: -------------------------------------------------------------------------------- 1 | # List of python2 variables 2 | --- 3 | passlib: python-passlib 4 | -------------------------------------------------------------------------------- /roles/StackStorm.st2/vars/redhat_8.yml: -------------------------------------------------------------------------------- 1 | # List of python3 variables 2 | --- 3 | passlib: python3-passlib 4 | -------------------------------------------------------------------------------- /roles/StackStorm.nodejs/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # nodejs version to install 3 | nodejs_major_version: "10" 4 | -------------------------------------------------------------------------------- /ansible.cfg: -------------------------------------------------------------------------------- 1 | # See also `ansible.cfg.galaxy` if installed from Ansible Galaxy 2 | [defaults] 3 | roles_path=roles/ 4 | -------------------------------------------------------------------------------- /roles/StackStorm.nginx/vars/redhat.yml: -------------------------------------------------------------------------------- 1 | selinux_dependencies: 2 | - libsemanage-python 3 | - libselinux-python 4 | -------------------------------------------------------------------------------- /roles/StackStorm.nginx/vars/redhat_8.yml: -------------------------------------------------------------------------------- 1 | selinux_dependencies: 2 | - python3-libsemanage 3 | - python3-libselinux 4 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'test-kitchen' 4 | gem 'kitchen-ansible' 5 | gem 'kitchen-docker' 6 | gem 'kitchen-sync' 7 | -------------------------------------------------------------------------------- /roles/StackStorm.mongodb/vars/main.yml: -------------------------------------------------------------------------------- 1 | # Extract mongodb "major.minor" version 2 | mongodb_major_minor_version: "{{ (mongodb_version|string)[:3] }}" 3 | -------------------------------------------------------------------------------- /roles/StackStorm.mongodb/vars/redhat_8.yml: -------------------------------------------------------------------------------- 1 | mongo_dependencies: 2 | - python3-urllib3 3 | - python3-pyOpenSSL 4 | - python3-pyasn1 5 | -------------------------------------------------------------------------------- /roles/StackStorm.mongodb/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: restart mongodb 3 | become: yes 4 | service: 5 | name: mongod 6 | state: restarted 7 | -------------------------------------------------------------------------------- /roles/StackStorm.rabbitmq/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: restart rabbitmq 3 | become: yes 4 | service: 5 | name: rabbitmq-server 6 | state: restarted 7 | -------------------------------------------------------------------------------- /roles/StackStorm.rabbitmq/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | rabbitmq_on_el8: "{{ (ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_major_version == '8') }}" 3 | -------------------------------------------------------------------------------- /roles/StackStorm.st2chatops/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: restart st2chatops 3 | become: yes 4 | service: 5 | name: st2chatops 6 | state: restarted 7 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: reload ewc_rbac 4 | become: yes 5 | command: st2-apply-rbac-definitions --config-file /etc/st2/st2.conf 6 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc/templates/rbac_assignments/assignments.yml.j2: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | username: {{ item.name }} 4 | roles: 5 | {{ item.roles | to_nice_yaml(2) | indent(2) }} 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # KitchenCI 2 | .kitchen/ 3 | .kitchen.local.yml 4 | 5 | # Ansible Retry 6 | *.retry 7 | 8 | # Vagrant 9 | .vagrant/ 10 | 11 | # Log files 12 | *.log 13 | -------------------------------------------------------------------------------- /roles/StackStorm.mongodb/vars/redhat.yml: -------------------------------------------------------------------------------- 1 | mongo_dependencies: 2 | - python-urllib3 3 | - pyOpenSSL 4 | - python-pyasn1 5 | - python-ndg_httpsclient 6 | -------------------------------------------------------------------------------- /roles/StackStorm.st2repo/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # StackStorm PackageCloud repository to install: stable, unstable, staging-stable, staging-unstable. 3 | st2repo_name: stable 4 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc_smoketests/templates/rbac_assignments/assignments.yml.j2: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | username: {{ item.name }} 4 | roles: 5 | {{ item.roles | to_nice_yaml(2) | indent(2) }} 6 | -------------------------------------------------------------------------------- /roles/StackStorm.nodejs/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install nodejs on {{ ansible_facts.distribution }} 3 | include_tasks: nodejs_{{ ansible_os_family | lower }}.yml 4 | tags: nodejs 5 | -------------------------------------------------------------------------------- /roles/StackStorm.st2repo/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Add st2repo on {{ ansible_facts.distribution }} 3 | include_tasks: st2repo_{{ ansible_os_family | lower }}.yml 4 | tags: st2repo 5 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc/templates/rbac_roles/roles.yml.j2: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: {{ item.name }} 4 | description: {{ item.description }} 5 | permission_grants: 6 | {{ item.permission_grants | to_nice_yaml(2) | indent(2) }} 7 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # https://stackstorm.com/2020/06/12/sponsoring-stackstorm/ 2 | # FAQ: https://stackstorm.com/donate/ 3 | # Expenses: https://github.com/StackStorm/discussions/issues/36 4 | community_bridge: stackstorm 5 | -------------------------------------------------------------------------------- /roles/StackStorm.st2web/vars/main.yml: -------------------------------------------------------------------------------- 1 | # Default st2web immutable vars 2 | --- 3 | # Default StackStorm WebUI package name to install 4 | # For enterprise 'bwc-ui' replaces 'st2web' package 5 | st2web_package_name: st2web 6 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc_smoketests/templates/rbac_roles/roles.yml.j2: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: {{ item.name }} 4 | description: {{ item.description }} 5 | permission_grants: 6 | {{ item.permission_grants | to_nice_yaml(2) | indent(2) }} 7 | -------------------------------------------------------------------------------- /roles/StackStorm.st2chatops/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | supported_hubot_adapters: 3 | - slack 4 | - botframework 5 | - hipchat 6 | - xmpp 7 | - flowdock 8 | - yammer 9 | - spark 10 | - irc 11 | - mattermost 12 | - matteruser 13 | - shell 14 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc/tasks/ewc_repos_cleanup_redhat.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Cleanup repo list file from disk 3 | become: yes 4 | yum_repository: 5 | name: "StackStorm_{{ ewc_repo }}" 6 | state: absent 7 | tags: 8 | - ewc 9 | - enterprise 10 | -------------------------------------------------------------------------------- /roles/StackStorm.nginx/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: restart nginx 3 | become: yes 4 | service: 5 | name: nginx 6 | state: restarted 7 | 8 | - name: reload nginx 9 | become: yes 10 | service: 11 | name: nginx 12 | state: reloaded 13 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc/tasks/ewc_repos_cleanup_debian.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Cleanup repo list file from disk 3 | become: yes 4 | file: 5 | path: /etc/apt/sources.list.d/StackStorm_{{ ewc_repo }} 6 | state: absent 7 | tags: 8 | - ewc 9 | - enterprise 10 | -------------------------------------------------------------------------------- /roles/StackStorm.epel/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | description: Install EPEL repository 4 | author: mierdin 5 | company: StackStorm 6 | license: Apache 2.0 7 | min_ansible_version: 2.5 8 | platforms: 9 | - name: EL 10 | versions: 11 | - 7 12 | - 8 13 | galaxy_tags: 14 | - system 15 | -------------------------------------------------------------------------------- /roles/StackStorm.rabbitmq/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | rabbitmq_plugins: [] 3 | # To enable the management plugin (in which case you'd want at least one user tagged with administrator): 4 | #rabbitmq_plugins: 5 | # - rabbitmq_management 6 | # Set to "present" to install latest version, or specify specific version 7 | rabbitmq_version: "present" 8 | -------------------------------------------------------------------------------- /ansible.cfg.galaxy: -------------------------------------------------------------------------------- 1 | # If installed `ansible-st2` via ansible-galaxy. 2 | # All the project roles are located under the 'roles' dir. 3 | # See why: https://github.com/StackStorm/ansible-st2/issues/45 4 | # 5 | # Use this `ansible.cfg` workaround to help Ansible find StackStorm roles: 6 | 7 | [defaults] 8 | roles_path = /etc/ansible/roles/:/etc/ansible/roles/StackStorm.stackstorm/roles/ 9 | -------------------------------------------------------------------------------- /roles/StackStorm.mongodb/vars/debian.yml: -------------------------------------------------------------------------------- 1 | # Use the following URL to find the key: https://www.mongodb.org/static/pgp/server-{{ mongodb_major_minor_version }}.asc 2 | mongodb_apt_keys: 3 | "3.2": "42F3E95A2C4F08279C4960ADD68FA50FEA312927" 4 | "3.4": "0C49F3730359A14518585931BC711F9BA15703C6" 5 | "3.6": "2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5" 6 | "4.0": "9DA31620334BD75D9DCB49F368818C72E52529D4" 7 | -------------------------------------------------------------------------------- /roles/StackStorm.rabbitmq/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | description: Install Rabbitmq-server 4 | author: humblearner 5 | company: StackStorm 6 | license: Apache 7 | min_ansible_version: 2.5 8 | platforms: 9 | - name: Ubuntu 10 | versions: 11 | - bionic 12 | - xenial 13 | - name: EL 14 | versions: 15 | - 7 16 | - 8 17 | galaxy_tags: 18 | - system 19 | -------------------------------------------------------------------------------- /roles/StackStorm.nodejs/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | description: Install nodejs 4 | author: humblearner 5 | company: StackStorm 6 | license: Apache 7 | min_ansible_version: 2.5 8 | tags: nodejs 9 | platforms: 10 | - name: Ubuntu 11 | versions: 12 | - bionic 13 | - xenial 14 | - name: EL 15 | versions: 16 | - 7 17 | - 8 18 | galaxy_tags: 19 | - system 20 | -------------------------------------------------------------------------------- /roles/StackStorm.nginx/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | description: Install nginx org 4 | author: humblearner 5 | company: StackStorm 6 | license: Apache 2.0 7 | min_ansible_version: 2.5 8 | tags: nginx 9 | platforms: 10 | - name: Ubuntu 11 | versions: 12 | - bionic 13 | - xenial 14 | - name: EL 15 | versions: 16 | - 7 17 | - 8 18 | galaxy_tags: 19 | - web 20 | - nginx 21 | -------------------------------------------------------------------------------- /roles/StackStorm.mongodb/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | description: Install MongoDB 4 | author: humblearner 5 | company: StackStorm 6 | license: Apache 7 | min_ansible_version: 2.5 8 | platforms: 9 | - name: Ubuntu 10 | versions: 11 | - bionic 12 | - xenial 13 | - name: EL 14 | versions: 15 | - 7 16 | - 8 17 | galaxy_tags: 18 | - system 19 | dependencies: 20 | - role: StackStorm.epel 21 | when: ansible_facts.os_family == 'RedHat' 22 | -------------------------------------------------------------------------------- /roles/StackStorm.st2repo/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | description: Install StackStorm Community package repository 4 | author: armab 5 | company: StackStorm 6 | license: Apache 2.0 7 | min_ansible_version: 2.5 8 | platforms: 9 | - name: Ubuntu 10 | versions: 11 | - bionic 12 | - xenial 13 | - name: EL 14 | versions: 15 | - 7 16 | - 8 17 | galaxy_tags: 18 | - system 19 | - stackstorm 20 | - repositories 21 | - packagecloud 22 | -------------------------------------------------------------------------------- /roles/StackStorm.st2web/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | description: Install st2web 4 | author: humblearner 5 | company: StackStorm 6 | license: Apache 7 | min_ansible_version: 2.5 8 | tags: st2web 9 | platforms: 10 | - name: Ubuntu 11 | versions: 12 | - bionic 13 | - xenial 14 | - name: EL 15 | versions: 16 | - 7 17 | - 8 18 | galaxy_tags: 19 | - system 20 | dependencies: 21 | - role: StackStorm.nginx 22 | - role: StackStorm.st2repo 23 | - role: StackStorm.st2 24 | -------------------------------------------------------------------------------- /roles/StackStorm.st2web/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # defaults file for st2web 3 | st2web_revision: 1 4 | 5 | # String with custom SSL certificate. If not provided, self-signed certificate will be generated. 6 | st2web_ssl_certificate: null 7 | 8 | # String with custom SSL certificate private key. If not provided, self-signed certificate will be generated. 9 | st2web_ssl_certificate_key: null 10 | 11 | # String with a custom nginx configuration file to replace st2.conf. If not provided, the default st2.conf will be used. 12 | st2web_nginx_config: null 13 | -------------------------------------------------------------------------------- /roles/StackStorm.mongodb/tasks/mongodb_auth.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install pip (for the installation of pymongo) 3 | become: yes 4 | package: 5 | name: python-pip 6 | state: present 7 | tags: [databases, mongodb] 8 | 9 | - name: Install pymongo (for the mongodb_user module) 10 | # Use pip because system packages are too old for adequate mongodb support. 11 | # https://docs.mongodb.com/ecosystem/drivers/driver-compatibility-reference/#python-driver-compatibility 12 | become: yes 13 | pip: 14 | name: "pymongo>=3.10.1,<4.0.0" 15 | tags: [databases, mongodb] 16 | -------------------------------------------------------------------------------- /roles/StackStorm.st2chatops/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | description: Install st2chatops 4 | author: humblearner 5 | company: StackStorm 6 | license: Apache 2.0 7 | min_ansible_version: 2.5 8 | platforms: 9 | - name: Ubuntu 10 | versions: 11 | - bionic 12 | - xenial 13 | - name: EL 14 | versions: 15 | - 7 16 | - 8 17 | galaxy_tags: 18 | - system 19 | - st2 20 | - devops 21 | - chatops 22 | - automation 23 | - hubot 24 | dependencies: 25 | - role: StackStorm.nodejs 26 | - role: StackStorm.st2 27 | -------------------------------------------------------------------------------- /roles/StackStorm.epel/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Check if EPEL is installed 3 | stat: 4 | path: /etc/yum.repos.d/epel.repo 5 | register: epel_installed 6 | when: ansible_facts.os_family == "RedHat" 7 | tags: epel 8 | 9 | - name: Install EPEL repo 10 | become: yes 11 | yum: 12 | name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_facts.distribution_major_version }}.noarch.rpm" 13 | state: present 14 | register: _task 15 | retries: 5 16 | delay: 3 17 | until: _task is succeeded 18 | when: ansible_facts.os_family == "RedHat" and not epel_installed.stat.exists 19 | tags: epel 20 | -------------------------------------------------------------------------------- /roles/StackStorm.mongodb/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Retrieve variables 3 | include_vars: "{{ item }}" 4 | with_first_found: 5 | - "{{ ansible_os_family | lower }}_{{ ansible_distribution_major_version }}.yml" 6 | - "{{ ansible_os_family | lower }}.yml" 7 | tags: [databases, mongodb] 8 | 9 | - name: Install mongodb on {{ ansible_facts.distribution }} 10 | include_tasks: mongodb_{{ ansible_os_family | lower }}.yml 11 | tags: [databases, mongodb] 12 | 13 | - name: Start & Enable mongodb 14 | become: yes 15 | service: 16 | name: mongod 17 | state: started 18 | enabled: yes 19 | tags: [databases, mongodb] 20 | -------------------------------------------------------------------------------- /stackstorm.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install st2 3 | hosts: all 4 | environment: "{{ st2_proxy_env | default({}) }}" 5 | roles: 6 | - StackStorm.mongodb 7 | - StackStorm.rabbitmq 8 | - StackStorm.st2repo 9 | - StackStorm.st2 10 | - StackStorm.nginx 11 | - StackStorm.st2web 12 | - StackStorm.nodejs 13 | - StackStorm.st2chatops 14 | - StackStorm.st2smoketests 15 | - role: StackStorm.ewc 16 | when: ewc_license is defined and ewc_license is not none and ewc_license | length > 1 17 | - role: StackStorm.ewc_smoketests 18 | when: ewc_license is defined and ewc_license is not none and ewc_license | length > 1 19 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | --- 2 | # Based on ansible-lint config 3 | extends: default 4 | 5 | rules: 6 | braces: {max-spaces-inside: 1, level: error} 7 | brackets: {max-spaces-inside: 1, level: error} 8 | colons: {max-spaces-after: -1, level: error} 9 | commas: {max-spaces-after: -1, level: error} 10 | comments: disable 11 | comments-indentation: disable 12 | document-start: disable 13 | empty-lines: {max: 3, level: error} 14 | hyphens: {level: error} 15 | indentation: disable 16 | key-duplicates: enable 17 | line-length: disable 18 | new-line-at-end-of-file: disable 19 | new-lines: {type: unix} 20 | trailing-spaces: disable 21 | truthy: disable 22 | -------------------------------------------------------------------------------- /roles/StackStorm.st2/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | description: Install StackStorm and all its components 4 | author: armab 5 | company: StackStorm 6 | license: Apache 2.0 7 | min_ansible_version: 2.5 8 | platforms: 9 | - name: Ubuntu 10 | versions: 11 | - bionic 12 | - xenial 13 | - name: EL 14 | versions: 15 | - 7 16 | - 8 17 | galaxy_tags: 18 | - system 19 | - stackstorm 20 | - st2 21 | - automation 22 | - remediation 23 | - devops 24 | dependencies: 25 | - role: StackStorm.epel 26 | when: ansible_facts.os_family == 'RedHat' 27 | - role: StackStorm.st2repo 28 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | description: Install EWC Entperprise components, setup RBAC and LDAP 4 | author: lakshmi-kannan 5 | company: StackStorm 6 | license: Apache 2.0 7 | min_ansible_version: 2.5 8 | platforms: 9 | - name: Ubuntu 10 | versions: 11 | - bionic 12 | - xenial 13 | - name: EL 14 | versions: 15 | - 7 16 | - 8 17 | galaxy_tags: 18 | - system 19 | - stackstorm 20 | - bwc 21 | - ewc 22 | - repositories 23 | - packagecloud 24 | dependencies: 25 | - role: StackStorm.st2repo 26 | - role: StackStorm.st2 27 | - role: StackStorm.st2web 28 | -------------------------------------------------------------------------------- /roles/StackStorm.st2/tasks/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Change '[{{ _conf_section_name }}]' options in st2.conf 3 | become: yes 4 | ini_file: 5 | dest: /etc/st2/st2.conf 6 | section: "{{ _conf_section_name }}" 7 | option: "{{ _conf_option.0 }}" 8 | value: "{{ _conf_option.1 | string }}" 9 | # dict2items not available until 2.6, so use Jinja's dictsort instead 10 | loop: "{{ _conf_options | dictsort }}" 11 | loop_control: 12 | loop_var: _conf_option 13 | # prevent logging passwords, auth URIs, and secrets 14 | no_log: "{{ _conf_option.0 in st2_config_no_log[_conf_section_name]|default([]) }}" 15 | notify: 16 | - restart st2 17 | tags: st2, config 18 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc_smoketests/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | description: Test EWC enteprise components were installed correctly. 4 | author: lakshmi-kannan 5 | company: StackStorm 6 | license: Apache 2.0 7 | min_ansible_version: 2.5 8 | platforms: 9 | - name: Ubuntu 10 | versions: 11 | - bionic 12 | - xenial 13 | - name: EL 14 | versions: 15 | - 7 16 | - 8 17 | galaxy_tags: 18 | - stackstorm 19 | - bwc 20 | - ewc 21 | - repositories 22 | - packagecloud 23 | dependencies: 24 | - role: StackStorm.st2repo 25 | - role: StackStorm.st2 26 | - role: StackStorm.st2web 27 | - role: StackStorm.ewc 28 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc_smoketests/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | ewc_smoke_tests_user: ewc_smoke_tests_user 4 | ewc_smoke_tests_password: holyjolly 5 | 6 | ewc_smoke_tests_rbac: 7 | roles: 8 | - name: ewc_smoke_tests_basic 9 | description: "This role has access only to action core.local in pack 'core'" 10 | permission_grants: 11 | 12 | - resource_uid: "action:core:local" 13 | permission_types: 14 | - "action_execute" 15 | - "action_view" 16 | 17 | - permission_types: 18 | - "runner_type_list" 19 | 20 | assignments: 21 | - name: "{{ ewc_smoke_tests_user }}" 22 | roles: 23 | - ewc_smoke_tests_basic 24 | -------------------------------------------------------------------------------- /roles/StackStorm.st2/handlers/main.yml: -------------------------------------------------------------------------------- 1 | - name: restart st2 2 | become: yes 3 | service: 4 | name: "{{ item }}" 5 | state: restarted 6 | loop: "{{ st2_services }}" 7 | 8 | - name: reload st2 9 | become: yes 10 | command: st2ctl reload --register-all 11 | 12 | - name: restart st2actionrunner 13 | become: yes 14 | service: 15 | name: st2actionrunner 16 | state: restarted 17 | 18 | - name: restart st2auth 19 | become: yes 20 | service: 21 | name: st2auth 22 | state: restarted 23 | 24 | - name: restart st2api 25 | become: yes 26 | service: 27 | name: st2api 28 | state: restarted 29 | 30 | - name: restart st2stream 31 | become: yes 32 | service: 33 | name: st2stream 34 | state: restarted 35 | -------------------------------------------------------------------------------- /.kitchen-docker/centos7/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM stackstorm/packagingtest:centos7-systemd 2 | 3 | RUN mkdir -p /var/run/sshd 4 | RUN useradd -d /home/<%= @username %> -m -s /bin/bash <%= @username %> 5 | RUN echo <%= "#{@username}:#{@password}" %> | chpasswd 6 | RUN echo '<%= @username %> ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers 7 | RUN mkdir -p /home/<%= @username %>/.ssh 8 | RUN chown -R <%= @username %> /home/<%= @username %>/.ssh 9 | RUN chmod 0700 /home/<%= @username %>/.ssh 10 | RUN touch /home/<%= @username %>/.ssh/authorized_keys 11 | RUN chown <%= @username %> /home/<%= @username %>/.ssh/authorized_keys 12 | RUN chmod 0600 /home/<%= @username %>/.ssh/authorized_keys 13 | RUN echo '<%= IO.read(@public_key).strip %>' >> /home/<%= @username %>/.ssh/authorized_keys 14 | -------------------------------------------------------------------------------- /.kitchen-docker/centos8/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM stackstorm/packagingtest:centos8-systemd 2 | 3 | RUN mkdir -p /var/run/sshd 4 | RUN useradd -d /home/<%= @username %> -m -s /bin/bash <%= @username %> 5 | RUN echo <%= "#{@username}:#{@password}" %> | chpasswd 6 | RUN echo '<%= @username %> ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers 7 | RUN mkdir -p /home/<%= @username %>/.ssh 8 | RUN chown -R <%= @username %> /home/<%= @username %>/.ssh 9 | RUN chmod 0700 /home/<%= @username %>/.ssh 10 | RUN touch /home/<%= @username %>/.ssh/authorized_keys 11 | RUN chown <%= @username %> /home/<%= @username %>/.ssh/authorized_keys 12 | RUN chmod 0600 /home/<%= @username %>/.ssh/authorized_keys 13 | RUN echo '<%= IO.read(@public_key).strip %>' >> /home/<%= @username %>/.ssh/authorized_keys 14 | -------------------------------------------------------------------------------- /roles/StackStorm.st2/tasks/proxy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Update proxy env vars in StackStorm service config files 3 | - name: proxy | Configure StackStorm services 4 | become: yes 5 | lineinfile: 6 | dest: /etc/{{ 'default' if ansible_facts.pkg_mgr == 'apt' else 'sysconfig' }}/{{ item.0 }} 7 | create: yes 8 | regexp: '^{{ item.1 }}=' 9 | line: "{{ item.1 }}={{ ansible_facts.env.get(item.1) }}" 10 | # NB: Empty ENV var cast to 'None' string in Ansible 11 | state: "{{ 'present' if ansible_facts.env.get(item.1, 'None') != 'None' else 'absent' }}" 12 | vars: 13 | _services: [st2api, st2actionrunner] 14 | _proxy_vars: [http_proxy, https_proxy, no_proxy] 15 | loop: '{{ _services|product(_proxy_vars)|list }}' 16 | notify: 17 | - restart st2actionrunner 18 | - restart st2api 19 | -------------------------------------------------------------------------------- /roles/StackStorm.st2/tasks/version.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Getting the current st2 version is required to understand which 'st2_services' to restart 3 | - name: Get installed st2 version 4 | command: /opt/stackstorm/st2/bin/python -c 'import st2common; print(st2common.__version__)' 5 | changed_when: no 6 | check_mode: no 7 | register: _st2_version_installed 8 | 9 | # Injecting 'st2_services' var in the middle of play verified to work with 'restart st2' handler as handlers flushed as last step 10 | - name: Redefine list of services based on st2 version 11 | set_fact: 12 | st2_services: "{{ st2_services }} + {{ item.1 }}" 13 | # dict2items not available until 2.6, so use Jinja's dictsort instead 14 | loop: "{{ st2_services_versioned | dictsort }}" 15 | when: item.0 is version_compare(st2_version_installed, '<=') 16 | -------------------------------------------------------------------------------- /roles/StackStorm.nginx/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install nginx on {{ ansible_facts.distribution }} 3 | include_tasks: nginx_{{ ansible_os_family | lower }}.yml 4 | tags: nginx 5 | 6 | - name: Create common virtual host folders 7 | become: yes 8 | file: 9 | state: directory 10 | path: "{{ item }}" 11 | loop: 12 | - /etc/nginx/sites-available/ 13 | - /etc/nginx/sites-enabled/ 14 | tags: nginx 15 | 16 | - name: Ensure site-enabled is loaded 17 | become: yes 18 | lineinfile: 19 | state: present 20 | dest: /etc/nginx/nginx.conf 21 | regexp: 'include /etc/nginx/sites-enabled/' 22 | insertafter: ' include /etc/nginx/conf.d/' 23 | line: ' include /etc/nginx/sites-enabled/*;' 24 | tags: nginx 25 | 26 | - name: Start & Enable nginx 27 | become: yes 28 | service: 29 | name: nginx 30 | state: started 31 | enabled: yes 32 | tags: nginx 33 | -------------------------------------------------------------------------------- /roles/StackStorm.st2chatops/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # st2chatops version to install. `present` to install available package, `latest` to get automatic updates, or pin it to numeric version like `2.2.0`. 2 | st2chatops_version: latest 3 | 4 | # Please provide ST2_API_KEY using "st2 apikey create -k" 5 | st2chatops_st2_api_key: CHANGE-ME-PLEASE 6 | 7 | # Hubot Adapter to be used for st2chatops. 8 | # For supported adapters, please check: https://github.com/StackStorm/ansible-st2/blob/master/roles/st2chatops/vars/main.yml 9 | # 10 | # Example, for slack: st2chatops_hubot_adapter: slack 11 | st2chatops_hubot_adapter: shell 12 | 13 | # Hash to configure values for the adapter in "/opt/stackstorm/chatops/st2chatops.env" 14 | # Original: https://github.com/StackStorm/st2chatops/blob/master/st2chatops.env 15 | # 16 | # Example, for slack: st2chatops_config: {"HUBOT_SLACK_TOKEN":"xoxb-CHANGE-ME-PLEASE"} 17 | st2chatops_config: {} 18 | -------------------------------------------------------------------------------- /roles/StackStorm.nginx/tasks/nginx_debian.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Add nginx key 3 | become: yes 4 | apt_key: 5 | url: http://nginx.org/keys/nginx_signing.key 6 | id: 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 7 | state: present 8 | register: _task 9 | retries: 5 10 | delay: 3 11 | until: _task is succeeded 12 | tags: nginx 13 | 14 | - name: Add nginx repos 15 | become: yes 16 | apt_repository: 17 | repo: "deb http://nginx.org/packages/ubuntu/ {{ ansible_facts.distribution_release|lower }} nginx" 18 | state: present 19 | tags: nginx 20 | 21 | - name: Install nginx 22 | become: yes 23 | apt: 24 | name: nginx 25 | state: present 26 | register: _task 27 | retries: 5 28 | delay: 3 29 | until: _task is succeeded 30 | tags: nginx 31 | 32 | - name: Remove default site 33 | become: yes 34 | file: 35 | path: /etc/nginx/sites-enabled/default 36 | state: absent 37 | tags: nginx 38 | -------------------------------------------------------------------------------- /roles/StackStorm.st2/tasks/datastore.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Make stackstorm encryption keys directory 3 | become: yes 4 | file: 5 | path: "{{ st2_datastore_key_file | dirname }}" 6 | state: directory 7 | mode: 0750 8 | owner: root 9 | group: st2 10 | 11 | - name: Generate st2 encryption key 12 | become: yes 13 | command: st2-generate-symmetric-crypto-key --key-path {{ st2_datastore_key_file }} 14 | args: 15 | creates: "{{ st2_datastore_key_file }}" 16 | 17 | - name: Fix permissions on datastore encryption key 18 | become: yes 19 | file: 20 | path: "{{ st2_datastore_key_file }}" 21 | mode: 0640 22 | owner: root 23 | group: st2 24 | 25 | - name: Configure encryption key in st2.conf 26 | become: yes 27 | ini_file: 28 | path: /etc/st2/st2.conf 29 | section: keyvalue 30 | option: encryption_key_path 31 | value: "{{ st2_datastore_key_file }}" 32 | notify: restart st2api 33 | -------------------------------------------------------------------------------- /roles/StackStorm.st2/tasks/packs.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Get list of installed st2 packs 4 | command: st2 pack list -j 5 | changed_when: no 6 | check_mode: no 7 | register: _st2_packs_installed 8 | become: yes 9 | become_user: root 10 | # Fix privilege escalation ENV in Dockerized environment 11 | environment: 12 | HOME: /root 13 | tags: st2, st2_packs 14 | 15 | # This gets the names of the currently installed st2 packs from a json list of dicts 16 | - name: Parse list of installed st2 packs 17 | set_fact: 18 | st2_packs_installed: "{{ _st2_packs_installed.stdout|from_json|map(attribute='name')|list() }}" 19 | tags: st2, st2_packs, 20 | 21 | - name: Install st2 packs 22 | command: st2 pack install "{{ item }}" 23 | loop: "{{ st2_packs }}" 24 | when: item not in st2_packs_installed 25 | become: yes 26 | become_user: root 27 | # Fix privilege escalation ENV in Dockerized environment 28 | environment: 29 | HOME: /root 30 | tags: st2, st2_packs 31 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | # CircleCI is used only for linter and syntax checks 2 | version: 2 3 | jobs: 4 | # Run Ansible-lint checks 5 | ansible-lint: 6 | docker: 7 | - image: yokogawa/ansible-lint:v4.3.7 8 | steps: 9 | - checkout 10 | - run: 11 | name: Ansible YAML syntax check 12 | command: | 13 | ansible-playbook --syntax-check stackstorm.yml 14 | - run: 15 | name: Ansible-lint check 16 | command: | 17 | ansible-lint --version 18 | ansible-lint -x 106,204,208 -v roles/*/*/*.yaml roles/*/*/*.yml stackstorm.yml 19 | 20 | # Run YAML lint checks 21 | yaml-lint: 22 | docker: 23 | - image: sdesbure/yamllint 24 | steps: 25 | - checkout 26 | - run: 27 | name: YAML lint checks 28 | command: yamllint . 29 | 30 | workflows: 31 | version: 2 32 | lint: 33 | jobs: 34 | - ansible-lint 35 | - yaml-lint 36 | 37 | experimental: 38 | notify: 39 | branches: 40 | only: 41 | - master 42 | -------------------------------------------------------------------------------- /roles/StackStorm.st2smoketests/tasks/st2chatops.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Verify st2chatops using bin/hubot 3 | # when editing, make sure it works for at least 2 adapters: 'shell' and 'slack' 4 | shell: set -o pipefail && timeout 10 bash -c '(sleep 5; echo exit ) | bin/hubot' 5 | args: 6 | chdir: /opt/stackstorm/chatops/ 7 | executable: /bin/bash 8 | environment: 9 | HUBOT_LOG_LEVEL: debug 10 | register: hubot_output 11 | failed_when: no 12 | changed_when: no 13 | 14 | # Additional task to provide better error message 15 | - name: Fail if st2chatops couldn't load st2 commands 16 | fail: 17 | msg: | 18 | Please check you 'st2chatops' configuration! 19 | Expected message "{{ item }}" not found in 'hubot' output. 20 | Full chatops log: {{ hubot_output.stdout }} 21 | when: item not in hubot_output.stdout 22 | loop: 23 | - "DEBUG Loading adapter {{ st2chatops_hubot_adapter }}" 24 | - "DEBUG Loading scripts from /opt/stackstorm/chatops/src/scripts" 25 | - "DEBUG Added command: pack get" 26 | - "commands are loaded" 27 | -------------------------------------------------------------------------------- /roles/StackStorm.st2repo/tasks/st2repo_debian.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install prereqs (Debian) 3 | become: yes 4 | apt: 5 | name: 6 | - debian-archive-keyring 7 | - apt-transport-https 8 | state: present 9 | register: _task 10 | retries: 5 11 | delay: 3 12 | until: _task is succeeded 13 | tags: st2repo 14 | 15 | - name: "Including ID variable for {{ st2repo_name }}" 16 | include_vars: 17 | file: "{{ st2repo_name }}.yml" 18 | 19 | - name: Add keys to keyring 20 | become: yes 21 | apt_key: 22 | id: "{{ key_id }}" 23 | url: https://packagecloud.io/StackStorm/{{ st2repo_name }}/gpgkey 24 | state: present 25 | register: _task 26 | retries: 5 27 | delay: 3 28 | until: _task is succeeded 29 | tags: st2repo 30 | 31 | - name: Add StackStorm repo 32 | become: yes 33 | apt_repository: 34 | repo: 'deb https://packagecloud.io/StackStorm/{{ st2repo_name }}/{{ ansible_facts.distribution|lower }}/ {{ ansible_facts.distribution_release|lower }} main' 35 | state: present 36 | update_cache: yes 37 | tags: st2repo 38 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc/tasks/ldap.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Setup st2.conf auth backend to LDAP 3 | become: yes 4 | # Unfortunately, ``with_dict`` also logs the dict which could leak passwords. 5 | no_log: yes 6 | ini_file: 7 | dest: /etc/st2/st2.conf 8 | section: auth 9 | option: backend 10 | value: ldap 11 | backup: yes 12 | # Don't even setup LDAP if backend_kwargs is not defined 13 | when: ewc_ldap.backend_kwargs is defined and ewc_ldap.backend_kwargs|length > 0 14 | notify: 15 | - restart st2auth 16 | 17 | - name: Setup st2.conf auth backend_kwargs for LDAP 18 | become: yes 19 | # Unfortunately, ``with_dict`` also logs the dict which could leak passwords. 20 | no_log: yes 21 | ini_file: 22 | dest: /etc/st2/st2.conf 23 | section: auth 24 | option: backend_kwargs 25 | value: "{{ ewc_ldap.backend_kwargs | to_json | string }}" 26 | backup: yes 27 | # Don't even setup LDAP if backend_kwargs is not defined 28 | when: ewc_ldap.backend_kwargs is defined and ewc_ldap.backend_kwargs|length > 0 29 | notify: 30 | - restart st2auth 31 | -------------------------------------------------------------------------------- /roles/StackStorm.nodejs/tasks/nodejs_debian.yml: -------------------------------------------------------------------------------- 1 | - name: Ensure apt-transport-https is installed 2 | become: yes 3 | apt: 4 | name: apt-transport-https 5 | state: present 6 | register: _task 7 | retries: 5 8 | delay: 3 9 | until: _task is succeeded 10 | tags: nodejs 11 | 12 | - name: Add nodesource key 13 | become: yes 14 | apt_key: 15 | url: https://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0x1655A0AB68576280 16 | id: "68576280" 17 | state: present 18 | register: _task 19 | retries: 5 20 | delay: 3 21 | until: _task is succeeded 22 | tags: nodejs 23 | 24 | - name: Add nodesource repos debs 25 | become: yes 26 | apt_repository: 27 | repo: "deb https://deb.nodesource.com/node_{{ nodejs_major_version }}.x {{ ansible_facts.distribution_release }} main" 28 | state: present 29 | tags: nodejs 30 | 31 | - name: Install nodejs 32 | become: yes 33 | apt: 34 | name: nodejs={{ nodejs_major_version }}.* 35 | state: present 36 | register: _task 37 | retries: 5 38 | delay: 3 39 | until: _task is succeeded 40 | tags: nodejs 41 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc_smoketests/tasks/teardown.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Remove EWC smoke tests user from htpasswd file 4 | become: yes 5 | htpasswd: 6 | path: /etc/st2/htpasswd 7 | name: "{{ ewc_smoke_tests_user }}" 8 | state: absent 9 | changed_when: no 10 | notify: 11 | - reload ewc_rbac 12 | tags: 13 | - ewc-smoke-tests 14 | 15 | - name: Remove RBAC smoke tests roles # This doesn't cleanup role from DB. 16 | become: yes 17 | file: 18 | state: absent 19 | path: /opt/stackstorm/rbac/roles/{{ item.name }}.yml 20 | loop: "{{ ewc_smoke_tests_rbac.roles }}" 21 | when: ewc_smoke_tests_rbac.roles is defined 22 | changed_when: no 23 | notify: 24 | - reload ewc_rbac 25 | tags: 26 | - ewc-smoke-tests 27 | 28 | - name: Remove RBAC smoke tests assignments # This doesn't cleanup assignment from DB. 29 | become: yes 30 | file: 31 | state: absent 32 | path: /opt/stackstorm/rbac/assignments/{{ ewc_smoke_tests_user }}.yml 33 | when: ewc_smoke_tests_rbac.assignments is defined 34 | changed_when: no 35 | notify: 36 | - reload ewc_rbac 37 | tags: 38 | - ewc-smoke-tests 39 | -------------------------------------------------------------------------------- /meta/main.yml: -------------------------------------------------------------------------------- 1 | # "Fake role" meta which allows installing `ansible-st2` via ansible-galaxy. 2 | # All the project roles are located under the 'roles' dir. 3 | # See why: https://github.com/StackStorm/ansible-st2/issues/45 4 | # 5 | # `ansible.cfg` workaround to find stackstorm roles: 6 | # 7 | # [defaults] 8 | # roles_path = /etc/ansible/roles/:/etc/ansible/roles/StackStorm.stackstorm/roles/ 9 | --- 10 | galaxy_info: 11 | description: Install StackStorm (IFTTT for Ops) with all the components like Web UI, ChatOps, EWC and dependant services including RabbitMQ, MongoDB, nginx. 12 | author: armab 13 | company: StackStorm 14 | license: Apache 2.0 15 | min_ansible_version: 2.5 16 | platforms: 17 | - name: Ubuntu 18 | versions: 19 | - bionic 20 | - xenial 21 | - name: EL 22 | versions: 23 | - 7 24 | - 8 25 | categories: 26 | - system 27 | - ops 28 | - devops 29 | - chatops 30 | - automation 31 | - remediation 32 | - workflows 33 | - stackstorm 34 | - st2 35 | - st2web 36 | - st2chatops 37 | - bwc 38 | - ewc 39 | - rabbitmq 40 | - mongodb 41 | - nginx 42 | -------------------------------------------------------------------------------- /roles/StackStorm.st2/vars/main.yml: -------------------------------------------------------------------------------- 1 | # Default st2 immutable vars 2 | --- 3 | # List of available `st2` services: 4 | # https://github.com/StackStorm/st2/blob/master/st2common/bin/st2ctl#L17 5 | st2_services: 6 | - st2actionrunner 7 | - st2garbagecollector 8 | - st2notifier 9 | - st2rulesengine 10 | - st2sensorcontainer 11 | - st2api 12 | - st2stream 13 | - st2auth 14 | 15 | # List of additional stackstorm services associated with specific st2 version release 16 | st2_services_versioned: 17 | "2.8": 18 | - st2workflowengine 19 | "2.9": 20 | - st2timersengine 21 | "2.10": 22 | - st2scheduler 23 | 24 | # Placeholder for st2 installed version, determined during run 25 | st2_version_installed: "{{ _st2_version_installed.stdout }}" 26 | 27 | # Where to store the ST2 datastore encryption key (automatically generated during install) 28 | st2_datastore_key_file: /etc/st2/keys/datastore_key.json 29 | 30 | # List of config vars (by section) that should have no_log: true to avoid showing up in ansible output 31 | st2_config_no_log: 32 | coordination: 33 | - url 34 | database: 35 | - username 36 | - password 37 | messaging: 38 | - url 39 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc/tasks/ewc_repos_redhat.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Fixes "Failure talking to yum: Cannot retrieve repository metadata (repomd.xml) for repository: StackStorm_stable. Please verify its path and try again" when installing st2 3 | - name: Update ca-certificates package 4 | become: yes 5 | yum: 6 | name: ca-certificates 7 | state: latest 8 | register: _task 9 | retries: 5 10 | delay: 3 11 | until: _task is succeeded 12 | tags: 13 | - ewc 14 | - enterprise 15 | - skip_ansible_lint 16 | 17 | - name: "Add packagecloud.io repository: StackStorm/{{ ewc_repo }}" 18 | become: yes 19 | no_log: yes 20 | yum_repository: 21 | name: "StackStorm_{{ ewc_repo }}" 22 | description: "StackStorm_{{ ewc_repo }}" 23 | file: "StackStorm_{{ ewc_repo }}" 24 | baseurl: https://{{ ewc_read_token }}:@packagecloud.io/StackStorm/{{ ewc_repo }}/el/{{ ansible_facts.distribution_major_version }}/$basearch 25 | repo_gpgcheck: yes 26 | gpgkey: "https://{{ ewc_read_token }}:@packagecloud.io/StackStorm/{{ ewc_repo }}/gpgkey" 27 | sslcacert: /etc/pki/tls/certs/ca-bundle.crt 28 | metadata_expire: 300 29 | gpgcheck: no 30 | enabled: yes 31 | sslverify: yes 32 | register: added_ewc_rpm_repository 33 | tags: 34 | - ewc 35 | - enterprise 36 | -------------------------------------------------------------------------------- /roles/StackStorm.mongodb/tasks/mongodb_debian.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: apt | Add mongodb key 3 | become: yes 4 | apt_key: 5 | # Don't use mongodb.org key location due to SNI verification problems under Ubuntu Trusty 6 | keyserver: "hkp://keyserver.ubuntu.com:80" 7 | id: "{{ mongodb_apt_keys[mongodb_major_minor_version] }}" 8 | state: present 9 | register: _task 10 | retries: 5 11 | delay: 3 12 | until: _task is succeeded 13 | tags: [databases, mongodb] 14 | 15 | - name: apt | Add mongodb repository 16 | become: yes 17 | apt_repository: 18 | repo: 'deb http://repo.mongodb.org/apt/{{ ansible_facts.distribution|lower }} {{ ansible_facts.distribution_release|lower }}/mongodb-org/{{ mongodb_major_minor_version }} multiverse' 19 | state: present 20 | tags: [databases, mongodb] 21 | 22 | - name: apt | Install mongodb 23 | become: yes 24 | apt: 25 | name: 26 | # re-installing different version of 'mongodb-org' meta package doesn't automatically 27 | # upgrade or downgrade its dependencies. So we need to explicitly list them one-by-one. 28 | - mongodb-org={{ mongodb_version }}* 29 | - mongodb-org-shell={{ mongodb_version }}* 30 | - mongodb-org-server={{ mongodb_version }}* 31 | - mongodb-org-mongos={{ mongodb_version }}* 32 | - mongodb-org-tools={{ mongodb_version }}* 33 | state: present 34 | register: _task 35 | retries: 5 36 | delay: 3 37 | until: _task is succeeded 38 | notify: restart mongodb 39 | tags: [databases, mongodb] 40 | -------------------------------------------------------------------------------- /roles/StackStorm.st2repo/tasks/st2repo_redhat.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Fixes "Failure talking to yum: Cannot retrieve repository metadata (repomd.xml) for repository: StackStorm_stable. Please verify its path and try again" when installing st2 3 | - name: Update ca-certificates package 4 | become: yes 5 | yum: 6 | name: ca-certificates 7 | state: latest 8 | register: _task 9 | retries: 5 10 | delay: 3 11 | until: _task is succeeded 12 | tags: [st2repo, skip_ansible_lint] 13 | 14 | # See: https://github.com/docker-library/docs/tree/master/centos#package-documentation 15 | # We ship `nginx.conf` via `st2` package doc files, for example 16 | - name: Enable shipping package documentation files for EL 17 | become: yes 18 | ini_file: 19 | dest: /etc/yum.conf 20 | section: main 21 | option: tsflags 22 | value: nodocs 23 | state: absent 24 | when: ansible_facts.os_family == "RedHat" 25 | tags: st2repo 26 | 27 | - name: Add StackStorm repo 28 | become: yes 29 | yum_repository: 30 | name: "StackStorm_{{ st2repo_name }}" 31 | description: "StackStorm_{{ st2repo_name }}" 32 | file: "StackStorm_{{ st2repo_name }}" 33 | baseurl: https://packagecloud.io/StackStorm/{{ st2repo_name }}/el/{{ ansible_facts.distribution_major_version }}/$basearch 34 | repo_gpgcheck: yes 35 | gpgkey: "https://packagecloud.io/StackStorm/{{ st2repo_name }}/gpgkey" 36 | sslcacert: /etc/pki/tls/certs/ca-bundle.crt 37 | metadata_expire: 300 38 | gpgcheck: no 39 | enabled: yes 40 | sslverify: yes 41 | tags: st2repo 42 | -------------------------------------------------------------------------------- /roles/StackStorm.st2web/tasks/certificate.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Verify if custom SSL certificate was correctly specified 3 | fail: 4 | msg: "When using custom certificate, both 'st2web_ssl_certificate' and 'st2web_ssl_certificate_key' must be provided" 5 | # no XOR in Yaml 6 | when: (st2web_ssl_certificate and not st2web_ssl_certificate_key) or (not st2web_ssl_certificate and st2web_ssl_certificate_key) 7 | 8 | - name: Create SSL certificate directory 9 | become: yes 10 | file: 11 | state: directory 12 | dest: /etc/ssl/st2 13 | mode: 0700 14 | owner: root 15 | group: root 16 | 17 | - name: Save custom SSL certificate 18 | become: yes 19 | copy: 20 | content: "{{ item.cert }}" 21 | dest: "{{ item.path }}" 22 | mode: 0600 23 | owner: root 24 | group: root 25 | loop: 26 | - cert: "{{ st2web_ssl_certificate }}" 27 | path: /etc/ssl/st2/st2.crt 28 | - cert: "{{ st2web_ssl_certificate_key }}" 29 | path: /etc/ssl/st2/st2.key 30 | no_log: yes 31 | notify: 32 | - restart nginx 33 | when: st2web_ssl_certificate and st2web_ssl_certificate_key 34 | 35 | - name: Generate self-signed SSL certificate 36 | become: yes 37 | shell: openssl req -x509 -newkey rsa:2048 -keyout /etc/ssl/st2/st2.key -out /etc/ssl/st2/st2.crt -days 365 -nodes -subj "/C=US/ST=California/L=Palo Alto/O=StackStorm/OU=Information Technology/CN=$(hostname)" 38 | args: 39 | creates: /etc/ssl/st2/st2.key 40 | notify: 41 | - restart nginx 42 | when: not st2web_ssl_certificate and not st2web_ssl_certificate_key 43 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # EWC PackageCloud repository to install: enterprise, enterprise-unstable, staging-enterprise, staging-enterprise-unstable. 3 | ewc_repo: "enterprise" 4 | # `present` to install available package, `latest` to get automatic updates, or pin it to numeric version like `2.2.0`. 5 | ewc_version: latest 6 | # used only if 'ewc_version' is numeric 7 | ewc_revision: 1 8 | 9 | # EWC license to install EWC enterprise bits 10 | ewc_license: null 11 | 12 | # Specify roles and assignments for EWC RBAC. 13 | # Roles are pushed as YML files to /opt/stackstorm/rbac/roles 14 | # Assignments are pushed as YML files to /opt/stackstorm/rbac/assignments/ 15 | # The schema for roles and assignments follow the exact schema definition 16 | # define in https://ewc-docs.extremenetworks.com/rbac.html#defining-roles-and-permission-grants 17 | # and https://ewc-docs.extremenetworks.com/rbac.html#defining-user-role-assignments. 18 | 19 | ewc_rbac_default_roles: [] 20 | 21 | ewc_rbac_default_assignments: 22 | - name: "{{ st2_system_user }}" 23 | roles: 24 | - admin 25 | 26 | - name: "{{ st2_auth_username }}" 27 | roles: 28 | - system_admin 29 | 30 | ewc_rbac: 31 | roles: "{{ ewc_rbac_default_roles }}" 32 | 33 | assignments: "{{ ewc_rbac_default_assignments }}" 34 | 35 | 36 | # By specifying a valid configuration for LDAP, 37 | # (See https://ewc-docs.extremenetworks.com/authentication.html#ldap ) 38 | # LDAP auth backend is setup for st2 and EWC. 39 | # Note that you just need to provide the backend_kwargs. 40 | ewc_ldap: 41 | backend_kwargs: {} 42 | -------------------------------------------------------------------------------- /roles/StackStorm.st2smoketests/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Small suite of smoke tests to execute to ensure that the playbook has deployed as expected 3 | 4 | - meta: flush_handlers 5 | tags: 6 | - smoke-tests 7 | 8 | - name: Make sure packs are reloaded 9 | become: yes 10 | command: st2ctl reload --register-all 11 | changed_when: no 12 | tags: 13 | - smoke-tests 14 | 15 | - name: st2 installed 16 | command: st2 --version 17 | changed_when: no 18 | tags: 19 | - smoke-tests 20 | 21 | - name: get authentication token 22 | command: st2 auth "{{ st2_auth_username }}" -p "{{ st2_auth_password }}" -t 23 | register: st2_token 24 | changed_when: no 25 | tags: 26 | - smoke-tests 27 | 28 | - name: st2 run core.local -- date -R 29 | command: st2 run core.local -- date -R 30 | environment: 31 | ST2_AUTH_TOKEN: "{{ st2_token.stdout }}" 32 | changed_when: no 33 | tags: 34 | - smoke-tests 35 | 36 | - name: Check web-ui is up 37 | uri: 38 | url: https://localhost/ 39 | validate_certs: no 40 | changed_when: no 41 | tags: 42 | - smoke-tests 43 | 44 | - name: Install st2 pack from exchange 45 | become: yes 46 | environment: 47 | ST2_AUTH_TOKEN: "{{ st2_token.stdout }}" 48 | command: "st2 pack install st2" 49 | changed_when: no 50 | tags: 51 | - smoke-tests 52 | 53 | - name: Verify if st2 pack was installed 54 | environment: 55 | ST2_AUTH_TOKEN: "{{ st2_token.stdout }}" 56 | command: st2 pack get st2 57 | changed_when: no 58 | check_mode: no 59 | tags: 60 | - smoke-tests 61 | 62 | - name: Verify st2chatops 63 | import_tasks: st2chatops.yml 64 | # st2chatops is installed 65 | when: st2chatops_version is defined 66 | tags: 67 | - smoke-tests 68 | - st2chatops 69 | -------------------------------------------------------------------------------- /.kitchen.yml: -------------------------------------------------------------------------------- 1 | --- 2 | driver: 3 | name: docker 4 | privileged: true 5 | use_sudo: false 6 | 7 | transport: 8 | name: sftp 9 | 10 | provisioner: 11 | name: ansible_playbook 12 | hosts: all 13 | roles_path: roles 14 | ansible_verbose: true 15 | ansible_verbosity: 2 16 | idempotency_test: true 17 | extra_vars: 18 | st2repo_name: <%= ENV['ST2_REPO'] || 'stable' %> 19 | ewc_repo: <%= ENV['EWC_REPO'] || 'enterprise' %> 20 | ewc_license: "<%= ENV['LICENSE'] ? ENV[ENV['LICENSE']] : ENV['BWC_LICENSE_ENTERPRISE'] %>" 21 | st2chatops_hubot_adapter: slack 22 | st2chatops_config: 23 | HUBOT_SLACK_TOKEN: <%= ENV['HUBOT_SLACK_TOKEN'] %> 24 | 25 | platforms: 26 | # Ubuntu Xenial with Systemd 27 | - name: ubuntu-16.04 28 | driver_config: 29 | image: stackstorm/packagingtest:xenial-systemd 30 | platform: ubuntu 31 | run_command: /sbin/init 32 | volume: 33 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 34 | # Ubuntu Bionic with Systemd 35 | - name: ubuntu-18.04 36 | driver_config: 37 | image: stackstorm/packagingtest:bionic-systemd 38 | platform: ubuntu 39 | run_command: /sbin/init 40 | volume: 41 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 42 | # CentOS7 with Systemd 43 | - name: centos-7 44 | driver_config: 45 | platform: centos 46 | dockerfile: .kitchen-docker/centos7/Dockerfile 47 | run_command: /sbin/init 48 | volume: 49 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 50 | # CentOS8 with Systemd 51 | - name: centos-8 52 | driver_config: 53 | platform: centos 54 | dockerfile: .kitchen-docker/centos8/Dockerfile 55 | run_command: /sbin/init 56 | volume: 57 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 58 | 59 | suites: 60 | - name: default 61 | -------------------------------------------------------------------------------- /roles/StackStorm.st2/tasks/user.yml: -------------------------------------------------------------------------------- 1 | # Create system user, on whose behalf remote/local action runners would work 2 | # See: http://docs.stackstorm.com/install/config.html#configure-ssh 3 | --- 4 | - name: user | Create system user 5 | become: yes 6 | user: 7 | name: "{{ st2_system_user }}" 8 | home: "/home/{{ st2_system_user }}" 9 | generate_ssh_key: yes 10 | ssh_key_file: "{{ st2_ssh_key_file }}" 11 | state: present 12 | register: _user 13 | 14 | - name: user | Authorize key-based access for system user 15 | vars: 16 | ansible_ssh_pipelining: true 17 | become: yes 18 | become_user: "{{ st2_system_user }}" 19 | authorized_key: 20 | user: "{{ st2_system_user }}" 21 | key: "{{ _user.ssh_public_key }}" 22 | state: present 23 | 24 | - name: user | Add system user to sudoers 25 | become: yes 26 | lineinfile: 27 | create: yes 28 | dest: /etc/sudoers.d/st2 29 | mode: 0440 30 | regexp: "^{{ st2_system_user }} ALL=" 31 | line: "{{ st2_system_user }} ALL=(ALL) NOPASSWD: SETENV: ALL" 32 | state: "{{ 'present' if st2_system_user_in_sudoers else 'absent' }}" 33 | validate: 'visudo -cf %s' 34 | 35 | - name: user | Disable requiretty 36 | become: yes 37 | replace: 38 | dest: "/etc/sudoers" 39 | regexp: '^Defaults\s+\+?requiretty' 40 | replace: '# Defaults requiretty' 41 | when: st2_system_user_in_sudoers | bool 42 | 43 | - name: user | Configure system user in /etc/st2/st2.conf 44 | become: yes 45 | ini_file: 46 | dest: /etc/st2/st2.conf 47 | section: system_user 48 | option: user 49 | value: "{{ st2_system_user }}" 50 | backup: yes 51 | 52 | - name: user | Configure system user ssh key in /etc/st2/st2.conf 53 | become: yes 54 | ini_file: 55 | dest: /etc/st2/st2.conf 56 | section: system_user 57 | option: ssh_key_file 58 | value: "{{ _user.ssh_key_file }}" 59 | backup: yes 60 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc/tasks/ewc_repos_setup.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create packagecloud dir 3 | become: yes 4 | file: 5 | path: "/etc/packagecloud" 6 | mode: "u=rwx,g=rx,o=rx" 7 | owner: st2 8 | group: st2 9 | state: directory 10 | tags: 11 | - ewc 12 | - enterprise 13 | 14 | - name: Handle ewc_license change 15 | include_tasks: license.yml 16 | tags: 17 | - ewc 18 | - enterprise 19 | 20 | - name: Get read token for repo from packagecloud 21 | become: yes 22 | no_log: yes 23 | changed_when: no 24 | uri: 25 | url: https://{{ ewc_license }}:@packagecloud.io/install/repositories/StackStorm/{{ ewc_repo }}/tokens.text 26 | # creates: "/etc/packagecloud/StackStorm_{{ ewc_repo }}_read_token.txt" # Don't download if file already exists 27 | dest: "/etc/packagecloud/StackStorm_{{ ewc_repo }}_read_token.txt" 28 | force_basic_auth: yes 29 | method: POST 30 | status_code: 201,200 31 | headers: 32 | Content-Type: "application/x-www-form-urlencoded" 33 | body: "name={{ ansible_facts.nodename }}" 34 | register: _task 35 | retries: 5 36 | delay: 3 37 | until: _task is succeeded 38 | tags: 39 | - ewc 40 | - enterprise 41 | 42 | - name: Read ewc_read_token from file 43 | become: yes 44 | no_log: yes 45 | changed_when: no 46 | command: cat "/etc/packagecloud/StackStorm_{{ ewc_repo }}_read_token.txt" 47 | register: _ewc_read_token 48 | tags: 49 | - ewc 50 | - enterprise 51 | 52 | - name: Set ewc_read_token variable 53 | no_log: yes 54 | set_fact: 55 | ewc_read_token: "{{ _ewc_read_token.stdout }}" 56 | tags: 57 | - ewc 58 | - enterprise 59 | 60 | - name: Add EWC enterprise repos on {{ ansible_os_family | lower }} 61 | include_tasks: ewc_repos_{{ ansible_os_family | lower }}.yml 62 | tags: 63 | - ewc 64 | - enterprise 65 | register: ewc_repo_added 66 | when: ewc_read_token | length > 0 67 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | VIRTUAL_MACHINES = { 5 | :ubuntu16 => { 6 | :hostname => 'ansible-st2-ubuntu16', 7 | :box => 'ubuntu/xenial64', 8 | }, 9 | :ubuntu18 => { 10 | :hostname => 'ansible-st2-ubuntu18', 11 | :box => 'ubuntu/bionic64', 12 | }, 13 | :centos7 => { 14 | :hostname => 'ansible-st2-centos7', 15 | :box => 'centos/7', 16 | }, 17 | :centos8 => { 18 | :hostname => 'ansible-st2-centos8', 19 | :box => 'centos/8', 20 | }, 21 | } 22 | 23 | Vagrant.require_version ">= 1.9.1" 24 | Vagrant.configure(2) do |config| 25 | config.vm.network "forwarded_port", guest: 22, host: 2200, auto_correct: true 26 | config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'" 27 | config.ssh.forward_agent = true 28 | 29 | VIRTUAL_MACHINES.each do |name, cfg| 30 | config.vm.define name, autostart: (name == :ubuntu18) do |vm_config| 31 | vm_config.vm.hostname = cfg[:hostname] 32 | vm_config.vm.box = cfg[:box] 33 | 34 | vm_config.vm.provider :virtualbox do |vb| 35 | vb.name = "#{cfg[:hostname]}" 36 | vb.customize ['modifyvm', :id, '--memory', '4096'] 37 | end 38 | 39 | if Vagrant.has_plugin?('vagrant-cachier') 40 | vm_config.cache.scope = :box 41 | end 42 | 43 | if Vagrant.has_plugin?('vagrant-hostmanager') 44 | vm_config.hostmanager.enabled = false 45 | vm_config.hostmanager.manage_host = true 46 | vm_config.hostmanager.ignore_private_ip = false 47 | vm_config.hostmanager.include_offline = true 48 | vm_config.hostmanager.aliases = ["www.#{cfg[:hostname]}"] 49 | vm_config.vm.provision :hostmanager 50 | end 51 | 52 | vm_config.vm.provision :ansible_local do |ansible| 53 | ansible.install = true 54 | ansible.verbose = true 55 | ansible.playbook = "stackstorm.yml" 56 | end 57 | end 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /roles/StackStorm.st2/tasks/request_ppa.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Verify python3.6 is available in enabled repo 3 | become: yes 4 | shell: 5 | cmd: apt-cache show python3.6 6 | changed_when: false 7 | register: _pkg_check 8 | args: 9 | warn: False 10 | ignore_errors: yes 11 | # Disable warning as package_facts only reports on installed packages 12 | tags: st2, skip_ansible_lint 13 | 14 | - name: Ask for PPA permission if not available and not already granted 15 | pause: 16 | prompt: "The python3.6 package is a required dependency for the StackStorm st2 package but that is not installable from any of the default Ubuntu 16.04 repositories. \nWe recommend switching to Ubuntu 18.04 LTS (Bionic) as a base OS. Support for Ubuntu 16.04 will be removed with future StackStorm versions.\n\nAlternatively we'll try to add python3.6 from the 3rd party 'deadsnakes' repository: https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa.\nBy continuing you are aware of the support and security risks associated with using unofficial 3rd party PPA repository, and you understand that StackStorm does NOT provide ANY support for python3.6 packages on Ubuntu 16.04.\n\nTo bypass this check in future, you can set the following variable to true: st2_u16_add_insecure_py3_ppa\n\nEnter [yes] to continue, and adding the PPA" 17 | when: '"Version" not in _pkg_check.stdout and not st2_u16_add_insecure_py3_ppa' 18 | register: _ppa_request 19 | tags: st2 20 | 21 | - name: Stop if ppa_permission not granted 22 | fail: 23 | msg: "Python3.6 PPA installation aborted" 24 | when: '"Version" not in _pkg_check.stdout and not st2_u16_add_insecure_py3_ppa and not _ppa_request.user_input | bool' 25 | tags: st2 26 | 27 | - name: Add PPA key 28 | become: yes 29 | apt_key: 30 | keyserver: keyserver.ubuntu.com 31 | id: F23C5A6CF475977595C89F51BA6932366A755776 32 | tags: st2 33 | 34 | - name: Register python 3.6 PPA 35 | become: yes 36 | apt_repository: 37 | repo: ppa:deadsnakes/ppa 38 | tags: st2 39 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Assert that 'ewc_license' is specified correctly 3 | fail: 4 | msg: "License key must be supplied for EWC enterprise installation." 5 | when: ewc_license is not defined or ewc_license is none or ewc_license|length != 48 6 | 7 | - name: Add EWC enterprise repos 8 | include_tasks: ewc_repos_setup.yml 9 | tags: 10 | - ewc 11 | - enterprise 12 | 13 | - name: Install latest bwc-enterprise package, auto-update 14 | become: yes 15 | package: 16 | name: bwc-enterprise 17 | state: latest 18 | register: ewc_installed 19 | retries: 5 20 | delay: 3 21 | until: ewc_installed is succeeded 22 | when: ewc_version == "latest" 23 | tags: 24 | - ewc 25 | - st2 enterprise 26 | - skip_ansible_lint 27 | notify: 28 | - restart st2api 29 | - restart st2auth 30 | 31 | - name: Install present bwc-enterprise package, no auto-update 32 | become: yes 33 | package: 34 | name: bwc-enterprise 35 | state: present 36 | register: ewc_installed 37 | retries: 5 38 | delay: 3 39 | until: ewc_installed is succeeded 40 | when: ewc_version == "present" 41 | tags: 42 | - ewc 43 | - st2 enterprise 44 | notify: 45 | - restart st2api 46 | - restart st2auth 47 | 48 | - name: Install pinned bwc-enterprise package 49 | become: yes 50 | package: 51 | name: bwc-enterprise{{ '-' if ansible_os_family == 'RedHat' else '=' }}{{ ewc_version }}-{{ ewc_revision }} 52 | state: present 53 | register: ewc_installed 54 | retries: 5 55 | delay: 3 56 | until: ewc_installed is succeeded 57 | when: 58 | - ewc_version != "latest" 59 | - ewc_version != "present" 60 | tags: 61 | - ewc 62 | - st2 enterprise 63 | notify: 64 | - restart st2api 65 | - restart st2auth 66 | 67 | - name: Setup RBAC and setup roles and assignments if ewc_rbac is defined 68 | import_tasks: rbac.yml 69 | when: ewc_rbac is defined 70 | 71 | - name: Setup LDAP and set up LDAP configuration 72 | import_tasks: ldap.yml 73 | when: ewc_ldap is defined 74 | -------------------------------------------------------------------------------- /roles/StackStorm.st2/tasks/auth.yml: -------------------------------------------------------------------------------- 1 | - name: auth | Install auth pre-reqs (Debian) 2 | become: yes 3 | apt: 4 | name: 5 | - python-passlib 6 | - apache2-utils 7 | state: present 8 | register: _task 9 | retries: 5 10 | delay: 3 11 | until: _task is succeeded 12 | when: ansible_facts.os_family == 'Debian' 13 | 14 | - name: Include RedHat OS-specific variables 15 | include_vars: "{{ item }}" 16 | with_first_found: 17 | - "{{ ansible_os_family | lower }}_{{ ansible_distribution_major_version }}.yml" 18 | - "{{ ansible_os_family | lower }}.yml" 19 | ignore_errors: true 20 | when: ansible_facts.os_family == 'RedHat' 21 | 22 | - name: auth | Install auth pre-reqs (RedHat) 23 | become: yes 24 | yum: 25 | name: 26 | - httpd-tools 27 | - "{{ passlib }}" 28 | state: present 29 | register: _task 30 | retries: 5 31 | delay: 3 32 | until: _task is succeeded 33 | when: ansible_facts.os_family == 'RedHat' 34 | 35 | - name: auth | Create htpasswd file 36 | become: true 37 | htpasswd: 38 | path: /etc/st2/htpasswd 39 | name: "{{ st2_auth_username }}" 40 | password: "{{ st2_auth_password }}" 41 | notify: 42 | - restart st2api 43 | - restart st2stream 44 | 45 | - name: auth | Enable authentication 46 | become: yes 47 | ini_file: 48 | dest: /etc/st2/st2.conf 49 | section: auth 50 | option: enable 51 | value: True 52 | backup: yes 53 | notify: 54 | - restart st2api 55 | - restart st2stream 56 | 57 | - name: auth | Create root's CLI configuration directory 58 | become: yes 59 | file: 60 | path: /root/.st2 61 | state: directory 62 | when: st2_save_credentials | bool 63 | 64 | - name: auth | Save credentials in CLI configuration file 65 | become: yes 66 | blockinfile: 67 | dest: /root/.st2/config 68 | create: yes 69 | mode: 0600 70 | owner: root 71 | group: root 72 | block: | 73 | [credentials] 74 | username = {{ st2_auth_username }} 75 | password = {{ st2_auth_password }} 76 | when: st2_save_credentials | bool 77 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc/tasks/rbac.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Copy default RBAC roles to /opt/stackstorm/rbac/roles directory 3 | become: yes 4 | template: 5 | src: rbac_roles/roles.yml.j2 6 | dest: /opt/stackstorm/rbac/roles/{{ item.name }}.yaml 7 | owner: st2 8 | group: st2 9 | loop: "{{ ewc_rbac_default_roles }}" 10 | notify: 11 | - reload ewc_rbac 12 | 13 | - name: Copy user defined RBAC roles to /opt/stackstorm/rbac/roles directory 14 | become: yes 15 | template: 16 | src: rbac_roles/roles.yml.j2 17 | dest: /opt/stackstorm/rbac/roles/{{ item.name }}.yaml 18 | owner: st2 19 | group: st2 20 | loop: "{{ ewc_rbac.roles }}" 21 | when: ewc_rbac.roles is defined 22 | notify: 23 | - reload ewc_rbac 24 | 25 | - name: Copy default RBAC assignments to /opt/stackstorm/rbac/assignments directory 26 | become: yes 27 | template: 28 | src: rbac_assignments/assignments.yml.j2 29 | dest: /opt/stackstorm/rbac/assignments/{{ item.name }}.yaml 30 | owner: st2 31 | group: st2 32 | loop: "{{ ewc_rbac_default_assignments }}" 33 | notify: 34 | - reload ewc_rbac 35 | 36 | - name: Copy user defined RBAC assignments to /opt/stackstorm/rbac/assignments directory 37 | become: yes 38 | template: 39 | src: rbac_assignments/assignments.yml.j2 40 | dest: /opt/stackstorm/rbac/assignments/{{ item.name }}.yaml 41 | owner: st2 42 | group: st2 43 | loop: "{{ ewc_rbac.assignments }}" 44 | when: ewc_rbac.assignments is defined 45 | notify: 46 | - reload ewc_rbac 47 | 48 | - name: Enable RBAC in st2 configuration 49 | become: yes 50 | ini_file: 51 | dest: /etc/st2/st2.conf 52 | section: rbac 53 | option: enable 54 | value: True 55 | backup: yes 56 | notify: 57 | - restart st2api 58 | - reload ewc_rbac 59 | 60 | - name: Configure RBAC backend in st2 configuration 61 | become: yes 62 | ini_file: 63 | dest: /etc/st2/st2.conf 64 | section: rbac 65 | option: backend 66 | value: enterprise 67 | backup: yes 68 | notify: 69 | - restart st2api 70 | - reload ewc_rbac 71 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | sudo: required 3 | dist: trusty 4 | services: docker 5 | 6 | branches: 7 | only: 8 | - master 9 | 10 | env: 11 | # default is stable repo 12 | - DISTRO=ubuntu-16 LICENSE='BWC_LICENSE_ENTERPRISE' 13 | - DISTRO=ubuntu-18 LICENSE='BWC_LICENSE_ENTERPRISE' 14 | - DISTRO=centos-7 LICENSE='BWC_LICENSE_ENTERPRISE' 15 | - DISTRO=centos-8 LICENSE='BWC_LICENSE_ENTERPRISE' 16 | 17 | # StackStorm 'unstable' repo check 18 | - DISTRO=ubuntu-16 ST2_REPO=unstable EWC_REPO=enterprise-unstable LICENSE='BWC_LICENSE_ENTERPRISE_UNSTABLE' 19 | - DISTRO=ubuntu-18 ST2_REPO=unstable EWC_REPO=enterprise-unstable LICENSE='BWC_LICENSE_ENTERPRISE_UNSTABLE' 20 | - DISTRO=centos-7 ST2_REPO=unstable EWC_REPO=enterprise-unstable LICENSE='BWC_LICENSE_ENTERPRISE_UNSTABLE' 21 | - DISTRO=centos-8 ST2_REPO=unstable EWC_REPO=enterprise-unstable LICENSE='BWC_LICENSE_ENTERPRISE_UNSTABLE' 22 | 23 | before_script: 24 | # Personal token for forked PRs 25 | - true && `base64 --decode <<< ZXhwb3J0IEhVQk9UX1NMQUNLX1RPS0VOPXhveGItMTc2OTM1OTkzNDE0LWltdFNJRktPYXkxVlFFTWtUdVJWYmh0bAo=` 26 | 27 | script: 28 | # run kitchen tests (destroy, create, converge, setup, verify and destroy) 29 | - kitchen test ${DISTRO} 30 | 31 | notifications: 32 | webhooks: https://galaxy.ansible.com/api/v1/notifications/ 33 | # Post build failures to '#ansible' channel in 'stackstorm-community' Slack 34 | slack: 35 | rooms: 36 | - secure: MXJk2ZQKUpRf3xi8aPd9/3yGVaeWLw5xN0mDeTDKJu/IYW/M5obCnO3TYwQGczY1Dd4zkEuUmbOMMix1W5SsSB5Eea4VDtq4rHXxuk625JtzKfLp0pBXcLdJ6gB9aQLqDpIXKusNN2VBhtvh7vzSUzefYja4vSk9JH1Ztm3R1YU0ltXPmH+EPfWo4XhoabBhdU3Fb0MFYOXMQ0YQZtDTLVvAYBqaSrsye5TT9ZYUCDfCvmJH0t1Y0yWPIVLjLp/0f9zRMagQarP2e3CCasjsbVHtC9+vygWaWXGgxfNiqXPHGBCmMT9Wl1E1Gjq3092cPJYlxevu7WupOvinksI6t7KgLubLi9k89/iE3siy6PTwbgvpub/WmJJN8hRY0OAR4F9uHDyrE9pNpL4oOY6P0YblOb1sIjmQKZYjJSgogZ7bi9gZ59/3ZTOZ1z+1H+x5YXG2mTDyFl/fonAG2Fwi8anTh5jswllp4HB0IazPpcfFofUle5tFCM4zpULY2TvTHWvn/LbnzLImnY9qiR6Ysaql55UyBC79y8Fol3pqQhB0HnkTE3viA2dN4u95yzeyC6Mu9gKN9jvMGF5C4WsnmPhB28G5jHH6792CBbID1wFgbYDN8AbcBYeflTbIjZYivD5quRJYMu7swR7FArBfHkEIt+qV0SY23geQYo49lAQ= 37 | on_pull_requests: false 38 | on_success: change # default: always 39 | on_failure: always # default: always 40 | -------------------------------------------------------------------------------- /roles/StackStorm.mongodb/tasks/mongodb_redhat.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: yum | Install mongodb dependencies 3 | become: yes 4 | yum: 5 | name: "{{ mongo_dependencies }}" 6 | # Failed to validate the SSL certificate for www.mongodb.org:443. Make sure your managed systems have a valid CA certificate installed. If the website serving the url uses SNI you need python >= 2.7.9 on your managed machine or you can install the `urllib3`, `pyopenssl`, `ndg-httpsclient`, and `pyasn1` python modules to perform SNI verification in python >= 2.6. You can use validate_certs=False if you do not need to confirm the servers identity but this is unsafe and not recommended. Paths checked for this platform: /etc/ssl/certs, /etc/pki/ca-trust/extracted/pem, /etc/pki/tls/certs, /usr/share/ca-certificates/cacert.org, /etc/ansible 7 | state: present 8 | register: _task 9 | retries: 5 10 | delay: 3 11 | until: _task is succeeded 12 | tags: [databases, mongodb] 13 | 14 | - name: yum | Add mongodb key {{ mongodb_major_minor_version }} 15 | become: yes 16 | rpm_key: 17 | key: https://www.mongodb.org/static/pgp/server-{{ mongodb_major_minor_version }}.asc 18 | state: present 19 | register: _task 20 | retries: 5 21 | delay: 3 22 | until: _task is succeeded 23 | tags: [databases, mongodb] 24 | 25 | - name: yum | Add mongodb repository 26 | become: yes 27 | yum_repository: 28 | name: mongodb-org-{{ mongodb_major_minor_version }} 29 | description: MongoDB Repository 30 | gpgcheck: yes 31 | enabled: yes 32 | baseurl: https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/{{ mongodb_major_minor_version }}/x86_64/ 33 | gpgkey: https://www.mongodb.org/static/pgp/server-{{ mongodb_major_minor_version }}.asc 34 | state: present 35 | tags: [databases, mongodb] 36 | 37 | - name: yum | Install mongodb 38 | become: yes 39 | yum: 40 | name: mongodb-org-{{ mongodb_version }}* 41 | state: present 42 | # TODO: Allow yum downgrade since Ansible 2.4 43 | # https://github.com/ansible/ansible/pull/21516 44 | # allow_downgrade: yes 45 | register: _task 46 | retries: 5 47 | delay: 3 48 | until: _task is succeeded 49 | notify: 50 | - restart mongodb 51 | tags: [databases, mongodb] 52 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc/tasks/license.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Check if EWC license hash file is present 3 | stat: 4 | path: /etc/packagecloud/ewc_license_hash.txt 5 | register: ewc_license_hash_file 6 | tags: 7 | - ewc 8 | - enterprise 9 | 10 | - name: Read ewc_license_hash_file if it exits 11 | command: cat /etc/packagecloud/ewc_license_hash.txt 12 | register: _ewc_license_hash 13 | no_log: yes 14 | changed_when: no 15 | when: ewc_license_hash_file.stat.exists 16 | tags: 17 | - ewc 18 | - enterprise 19 | 20 | - name: Set ewc_license_hash from file context 21 | set_fact: 22 | ewc_license_hash: "{{ _ewc_license_hash.stdout }}" 23 | no_log: yes 24 | when: ewc_license_hash_file.stat.exists 25 | tags: 26 | - ewc 27 | - enterprise 28 | 29 | - name: Set ewc_license_hash to incoming hash if not defined 30 | no_log: yes 31 | set_fact: 32 | ewc_license_hash: '{{ ewc_license | hash("sha512") }}' 33 | when: not ewc_license_hash_file.stat.exists 34 | tags: 35 | - ewc 36 | - enterprise 37 | 38 | - name: Write ewc_license_hash to file if file not found on disk 39 | copy: 40 | content: "{{ ewc_license | hash('sha512') }}" 41 | dest: "/etc/packagecloud/ewc_license_hash.txt" 42 | force: yes 43 | become: yes 44 | when: not ewc_license_hash_file.stat.exists 45 | tags: 46 | - ewc 47 | - enterprise 48 | 49 | - name: "Cleanup read token cached file from disk" 50 | become: yes 51 | file: 52 | path: "/etc/packagecloud/StackStorm_{{ ewc_repo }}_read_token.txt" 53 | state: absent 54 | when: ewc_license | hash("sha512") != ewc_license_hash 55 | tags: 56 | - ewc 57 | - enterprise 58 | 59 | - name: "Cleanup repo list file from disk" 60 | include_tasks: "ewc_repos_cleanup_{{ ansible_os_family | lower }}.yml" 61 | when: ewc_license | hash("sha512") != ewc_license_hash 62 | tags: 63 | - ewc 64 | - enterprise 65 | 66 | - name: Write new ewc_license_hash to file 67 | copy: 68 | content: "{{ ewc_license | hash('sha512') }}" 69 | dest: "/etc/packagecloud/ewc_license_hash.txt" 70 | force: yes 71 | become: yes 72 | no_log: yes 73 | when: ewc_license | hash("sha512") != ewc_license_hash 74 | tags: 75 | - ewc 76 | - enterprise 77 | -------------------------------------------------------------------------------- /roles/StackStorm.st2web/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Check if enterprise is installed 3 | become: yes 4 | stat: 5 | path: /opt/stackstorm/static/webui/flow/ 6 | register: ewc_installed 7 | 8 | # For enterprise 'bwc-ui' replaces 'st2web' package 9 | - name: "Decide which package to use: 'st2web' vs 'bwc-ui'" 10 | set_fact: 11 | st2web_package_name: bwc-ui 12 | when: ewc_installed.stat.exists 13 | 14 | - name: Install latest {{ st2web_package_name }} package, auto-update 15 | become: yes 16 | package: 17 | name: "{{ st2web_package_name }}" 18 | state: latest 19 | register: _task 20 | retries: 5 21 | delay: 3 22 | until: _task is succeeded 23 | when: st2_version == "latest" 24 | tags: st2web, skip_ansible_lint 25 | 26 | - name: Install present {{ st2web_package_name }} package, no auto-update 27 | become: yes 28 | package: 29 | name: "{{ st2web_package_name }}" 30 | state: present 31 | register: _task 32 | retries: 5 33 | delay: 3 34 | until: _task is succeeded 35 | when: st2_version == "present" 36 | tags: st2web 37 | 38 | - name: Install pinned {{ st2web_package_name }} package 39 | become: yes 40 | package: 41 | name: "{{ st2web_package_name }}{{ '-' if ansible_facts.pkg_mgr == 'yum' else '=' }}{{ st2_version }}-{{ st2web_revision }}" 42 | state: present 43 | register: _task 44 | retries: 5 45 | delay: 3 46 | until: _task is succeeded 47 | when: 48 | - st2_version != "latest" 49 | - st2_version != "present" 50 | tags: st2web 51 | 52 | - name: Configure SSL certificate for st2web UI 53 | import_tasks: certificate.yml 54 | tags: st2web, certificate 55 | 56 | - name: Copy default Nginx config 57 | become: yes 58 | command: cp /usr/share/doc/st2/conf/nginx/st2.conf /etc/nginx/sites-available/ 59 | args: 60 | creates: /etc/nginx/sites-available/st2.conf 61 | notify: 62 | - restart nginx 63 | tags: st2web 64 | when: not st2web_nginx_config 65 | 66 | - name: Copy custom Nginx config 67 | become: yes 68 | copy: 69 | content: "{{ st2web_nginx_config }}" 70 | dest: /etc/nginx/sites-available/st2.conf 71 | notify: 72 | - restart nginx 73 | tags: st2web 74 | when: st2web_nginx_config 75 | 76 | - name: Enable site 77 | become: yes 78 | file: 79 | state: link 80 | src: /etc/nginx/sites-available/st2.conf 81 | dest: /etc/nginx/sites-enabled/st2.conf 82 | notify: 83 | - restart nginx 84 | tags: st2web 85 | -------------------------------------------------------------------------------- /roles/StackStorm.st2/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # StackStorm version to install. `present` to install available package, `latest` to get automatic updates or pin it to numeric version like `2.2.0`. 3 | st2_version: latest 4 | # StackStorm revision to install. Used only with pinned `st2_version`. 5 | st2_revision: 1 6 | 7 | # Hash with StackStorm configuration settings to set in 'st2.conf' ini file 8 | # See https://github.com/StackStorm/st2/blob/master/conf/st2.conf.sample for a full list 9 | st2_config: {} 10 | # Example: 11 | #st2_config: 12 | # auth: 13 | # debug: True 14 | # enable: True 15 | # database: 16 | # username: st2 17 | # db_name: st2 18 | # password: random-password123 19 | # messaging: 20 | # url: amqp://st2:st2@127.0.0.1:5672// 21 | 22 | # System user from which st2 will execute local/remote shell actions 23 | st2_system_user: stanley 24 | # Add `st2_system_user` to the sudoers (recommended for most `st2` features to work) 25 | st2_system_user_in_sudoers: yes 26 | # Path to `st2_system_user` ssh private key. It will be autogenerated if key absent 27 | st2_ssh_key_file: /home/{{ st2_system_user }}/.ssh/{{ st2_system_user }}_rsa 28 | 29 | # Enable StackStorm standalone authentication 30 | st2_auth_enable: yes 31 | # Username used by StackStorm standalone authentication 32 | st2_auth_username: testu 33 | # Password used by StackStorm standalone authentication 34 | st2_auth_password: testp 35 | # Save credentials in ~/.st2/config file 36 | st2_save_credentials: yes 37 | # ST2 packs to be installed (list) 38 | st2_packs: 39 | - st2 40 | 41 | # Additional python packages to install 42 | st2_python_packages: [] 43 | 44 | # Whether permission is granted to install the deadsnakes Python3.6 PPA for Ubuntu 16. 45 | #The python3.6 package is a required dependency for the StackStorm st2 package but that is not installable from any of the default Ubuntu 16.04 repositories. 46 | #We recommend switching to Ubuntu 18.04 LTS (Bionic) as a base OS. Support for Ubuntu 16.04 will be removed with future StackStorm versions. 47 | #Alternatively the playbooks will try to add python3.6 from the 3rd party 'deadsnakes' repository: https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa. 48 | #Only set to true, if you are aware of the support and security risks associated with using unofficial 3rd party PPA repository, and you understand that StackStorm does NOT provide ANY support for python3.6 packages on Ubuntu 16.04. 49 | st2_u16_add_insecure_py3_ppa: false 50 | -------------------------------------------------------------------------------- /roles/StackStorm.nginx/tasks/nginx_redhat.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install vars 3 | include_vars: "{{ item }}" 4 | with_first_found: 5 | - "{{ ansible_os_family | lower }}_{{ ansible_distribution_major_version }}.yml" 6 | - "{{ ansible_os_family | lower }}.yml" 7 | 8 | - name: Add nginx key 9 | become: yes 10 | rpm_key: 11 | key: http://nginx.org/keys/nginx_signing.key 12 | state: present 13 | register: _task 14 | retries: 5 15 | delay: 3 16 | until: _task is succeeded 17 | tags: nginx 18 | 19 | - name: Add nginx repos 20 | become: yes 21 | yum_repository: 22 | name: nginx 23 | description: nginx repo 24 | baseurl: http://nginx.org/packages/rhel/{{ ansible_facts.distribution_major_version }}/x86_64/ 25 | gpgcheck: yes 26 | enabled: yes 27 | state: present 28 | tags: nginx 29 | 30 | - name: Install nginx 31 | become: yes 32 | yum: 33 | name: nginx 34 | state: present 35 | disablerepo: epel 36 | register: _task 37 | retries: 5 38 | delay: 3 39 | until: _task is succeeded 40 | tags: nginx 41 | 42 | - name: Remove default site 43 | become: yes 44 | file: 45 | path: /etc/nginx/conf.d/default.conf 46 | state: absent 47 | tags: nginx 48 | 49 | - name: Comment out server line 50 | become: yes 51 | replace: 52 | path: /etc/nginx/nginx.conf 53 | backup: yes 54 | regexp: '^(?![#])(.*server\s*{)' 55 | replace: '#\1' 56 | tags: nginx 57 | when: (ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_major_version == '8') 58 | 59 | - name: Comment out after server block 60 | become: yes 61 | replace: 62 | path: /etc/nginx/nginx.conf 63 | backup: yes 64 | after: '\s*server\s*{' 65 | regexp: '^(?![#}])(.+)$' 66 | replace: '#\1' 67 | tags: nginx 68 | when: (ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_major_version == '8') 69 | 70 | - name: Install dependencies for SELinux Ansible module 71 | become: yes 72 | yum: 73 | name: "{{ selinux_dependencies }}" 74 | state: present 75 | register: nginx_selinux_dependencies 76 | retries: 5 77 | delay: 3 78 | until: nginx_selinux_dependencies is succeeded 79 | tags: nginx 80 | 81 | - name: Update SELinux facts after installing dependencies 82 | become: yes 83 | setup: 84 | filter: ansible_selinux 85 | when: nginx_selinux_dependencies.changed 86 | tags: nginx, skip_ansible_lint 87 | 88 | - name: Adjust SELinux to allow network access for nginx 89 | become: yes 90 | seboolean: 91 | name: httpd_can_network_connect 92 | state: yes 93 | persistent: yes 94 | when: ansible_facts.selinux.status == "enabled" and ansible_facts.selinux.mode == "enforcing" 95 | tags: nginx 96 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc_smoketests/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Small suite of smoke tests to ensure that EWC role has deployed as expected 4 | 5 | - name: auth | Add a new ewc_smoke_tests_user in st2 htpasswd file 6 | become: true 7 | htpasswd: 8 | path: /etc/st2/htpasswd 9 | name: "{{ ewc_smoke_tests_user }}" 10 | password: "{{ ewc_smoke_tests_password }}" 11 | changed_when: no 12 | notify: 13 | - restart st2api 14 | - restart st2stream 15 | tags: 16 | - ewc-smoke-tests 17 | 18 | - name: Copy smoke tests RBAC roles to /opt/stackstorm/rbac/roles directory 19 | become: yes 20 | template: 21 | src: rbac_roles/roles.yml.j2 22 | dest: /opt/stackstorm/rbac/roles/{{ item.name }}.yaml 23 | owner: st2 24 | group: st2 25 | loop: "{{ ewc_smoke_tests_rbac.roles }}" 26 | changed_when: no 27 | when: ewc_smoke_tests_rbac.roles is defined 28 | notify: 29 | - reload ewc_rbac 30 | tags: 31 | - ewc-smoke-tests 32 | 33 | - name: Copy smoke tests RBAC assignments to /opt/stackstorm/rbac/assignments directory 34 | become: yes 35 | template: 36 | src: rbac_assignments/assignments.yml.j2 37 | dest: /opt/stackstorm/rbac/assignments/{{ item.name }}.yaml 38 | owner: st2 39 | group: st2 40 | loop: "{{ ewc_smoke_tests_rbac.assignments }}" 41 | changed_when: no 42 | when: ewc_smoke_tests_rbac.assignments is defined 43 | notify: 44 | - reload ewc_rbac 45 | tags: 46 | - ewc-smoke-tests 47 | 48 | - meta: flush_handlers 49 | tags: 50 | - ewc-smoke-tests 51 | 52 | - name: Get authentication token for ewc_smoke_tests # Note this will not use LDAP. 53 | command: st2 auth "{{ ewc_smoke_tests_user }}" -p "{{ ewc_smoke_tests_password }}" -t 54 | register: st2_token_smoke_tests_user 55 | changed_when: no 56 | tags: 57 | - ewc-smoke-tests 58 | 59 | - name: Test a simple core.local action as user ``ewc_smoke_tests_user`` 60 | command: st2 run core.local -- date -R 61 | environment: 62 | ST2_AUTH_TOKEN: "{{ st2_token_smoke_tests_user.stdout }}" 63 | changed_when: no 64 | tags: 65 | - ewc-smoke-tests 66 | 67 | - name: Test some other action that "{{ ewc_smoke_tests_user }}" cannot run 68 | command: st2 run core.http url="https://www.google.com" 69 | environment: 70 | ST2_AUTH_TOKEN: "{{ st2_token_smoke_tests_user.stdout }}" 71 | ignore_errors: yes 72 | changed_when: no 73 | register: ewc_smoke_tests_forbidden_action 74 | tags: 75 | - ewc-smoke-tests 76 | 77 | - name: Assert forbidden error was indeed thrown 78 | fail: 79 | msg: "St2 action was forbidden to run because of RBAC permissions but action still ran." 80 | changed_when: no 81 | when: "ewc_smoke_tests_forbidden_action.stdout.find('Forbidden') == -1" 82 | tags: 83 | - ewc-smoke-tests 84 | 85 | - name: Teardown test artifacts 86 | import_tasks: teardown.yml 87 | changed_when: no 88 | tags: 89 | - ewc-smoke-tests 90 | -------------------------------------------------------------------------------- /roles/StackStorm.nodejs/tasks/nodejs_redhat.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Add nodesource key 3 | become: yes 4 | rpm_key: 5 | key: http://rpm.nodesource.com/pub/el/NODESOURCE-GPG-SIGNING-KEY-EL 6 | state: present 7 | register: _task 8 | retries: 5 9 | delay: 3 10 | until: _task is succeeded 11 | tags: nodejs 12 | 13 | - name: Remove nodesource repo rpm 14 | # rpm conflicts with yum_repository added file below 15 | become: yes 16 | yum: 17 | name: "nodesource-release-el{{ ansible_facts.distribution_major_version }}-1.noarch" 18 | state: absent 19 | register: nodesource_repo_rm 20 | tags: nodejs 21 | 22 | - name: Determine if nodejs disabled on AppStream for EL8 23 | become: yes 24 | shell: 25 | cmd: yum module list nodejs --disabled 26 | changed_when: False 27 | ignore_errors: True 28 | args: 29 | warn: False 30 | register: nodejs_disabled 31 | when: ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_major_version == '8' 32 | tags: [nodejs, skip_ansible_lint] 33 | 34 | - name: Disable AppStream repository due to installation conflicts for EL8 35 | become: yes 36 | shell: 37 | cmd: yum module disable -y nodejs 38 | args: 39 | warn: False 40 | when: ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_major_version == '8' and "AppStream" not in nodejs_disabled.stdout 41 | # Disable warning as yum doesn't support disable module 42 | tags: [nodejs, skip_ansible_lint] 43 | 44 | - name: Add nodesource repo file 45 | become: yes 46 | # This is based on the nodesource repo rpm (both 4.x and 10.x for EL6/7/8), 47 | # but that rpm is not versioned even though it hard-codes the major node.js version. 48 | # So, installing the repo directly (vs via the rpm) simplifies major node.js upgrades. 49 | # see - http://rpm.nodesource.com/pub_10.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm 50 | yum_repository: 51 | file: "nodesource-el{{ ansible_facts.distribution_major_version }}" 52 | name: nodesource 53 | description: "Node.js Packages for Enterprise Linux {{ ansible_facts.distribution_major_version }} - $basearch" 54 | baseurl: https://rpm.nodesource.com/pub_{{ nodejs_major_version }}.x/el/{{ ansible_facts.distribution_major_version }}/$basearch 55 | failovermethod: priority 56 | gpgcheck: yes 57 | gpgkey: file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL 58 | state: present 59 | register: nodesource_repo_add 60 | tags: nodejs 61 | 62 | - name: Install nodejs 63 | become: yes 64 | yum: 65 | name: nodejs-{{ nodejs_major_version }}.* 66 | state: present 67 | # TODO: Allow yum downgrade since Ansible 2.4 68 | # https://github.com/ansible/ansible/pull/21516 69 | # allow_downgrade: yes 70 | update_cache: "{{ nodesource_repo_rm is changed or nodesource_repo_add is changed }}" 71 | register: _task 72 | retries: 5 73 | delay: 3 74 | until: _task is succeeded 75 | tags: nodejs 76 | -------------------------------------------------------------------------------- /roles/StackStorm.ewc/tasks/ewc_repos_debian.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install prereqs (Debian) 3 | become: yes 4 | apt: 5 | name: 6 | - debian-archive-keyring 7 | - apt-transport-https 8 | state: present 9 | register: _task 10 | retries: 5 11 | delay: 3 12 | until: _task is succeeded 13 | tags: 14 | - ewc 15 | - enterprise 16 | 17 | - name: "Including ID variable for {{ ewc_repo }}" 18 | include_vars: 19 | file: "{{ ewc_repo }}.yml" 20 | 21 | - name: Get keyring URL 22 | become: yes 23 | no_log: yes 24 | changed_when: no 25 | uri: 26 | url: https://{{ ewc_license }}:@packagecloud.io/install/repositories/StackStorm/{{ ewc_repo }}/gpg_key_url.list?os={{ ansible_facts.distribution | lower }}&dist={{ ansible_facts.distribution_release | lower }}&name={{ ansible_facts.nodename }} 27 | dest: "/etc/packagecloud/StackStorm_{{ ewc_repo }}_gpgkey_url.txt" 28 | force_basic_auth: yes 29 | method: GET 30 | status_code: 201,200 31 | headers: 32 | Content-Type: "application/x-www-form-urlencoded" 33 | register: _task 34 | retries: 5 35 | delay: 3 36 | until: _task is succeeded 37 | 38 | - name: Read ewc_gpgkey_url from file 39 | become: yes 40 | no_log: yes 41 | changed_when: no 42 | command: cat "/etc/packagecloud/StackStorm_{{ ewc_repo }}_gpgkey_url.txt" 43 | register: _ewc_gpgkey_url 44 | 45 | - name: Set ewc_gpgkey_url variable 46 | no_log: yes 47 | set_fact: 48 | ewc_gpgkey_url: "{{ _ewc_gpgkey_url.stdout }}" 49 | 50 | # This is a nasty hack necessary because of how AWS Redirects are interfering 51 | # with both get_url and uri modules in Ansible. The redirect is somehow 52 | # appending another authorization method to the request which AWS rejects. 53 | # This will ultimately need to be fixed upstream. 54 | - name: Download gpgkey 55 | become: yes 56 | command: "curl -L -o /etc/packagecloud/StackStorm_{{ ewc_repo }}_gpgkey.asc {{ ewc_gpgkey_url }}" 57 | args: 58 | creates: "/etc/packagecloud/StackStorm_{{ ewc_repo }}_gpgkey.asc" 59 | warn: False 60 | register: _task 61 | retries: 5 62 | delay: 3 63 | until: _task is succeeded 64 | 65 | - name: Add keys to keyring 66 | become: yes 67 | apt_key: 68 | id: "{{ enterprise_key_id }}" 69 | file: "/etc/packagecloud/StackStorm_{{ ewc_repo }}_gpgkey.asc" 70 | state: present 71 | register: _task 72 | retries: 5 73 | delay: 3 74 | until: _task is succeeded 75 | tags: 76 | - ewc 77 | - enterprise 78 | 79 | - name: "Add packagecloud.io repository: StackStorm/{{ ewc_repo }}" 80 | become: yes 81 | no_log: yes 82 | apt_repository: 83 | filename: "StackStorm_{{ ewc_repo }}" 84 | repo: 'deb https://{{ ewc_read_token }}:@packagecloud.io/StackStorm/{{ ewc_repo }}/{{ ansible_facts.distribution|lower }}/ {{ ansible_facts.distribution_release|lower }} main' 85 | state: present 86 | update_cache: yes 87 | register: added_ewc_deb_repository 88 | retries: 5 89 | delay: 3 90 | until: added_ewc_deb_repository is succeeded 91 | tags: 92 | - ewc 93 | - enterprise 94 | -------------------------------------------------------------------------------- /roles/StackStorm.rabbitmq/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: RabbitMQ on RHEL8 requires module(perl:5.26) 3 | become: yes 4 | shell: 5 | cmd: yum -y module enable perl:5.26 6 | args: 7 | warn: False 8 | when: rabbitmq_on_el8 9 | register: perl_result 10 | changed_when: 11 | - '"Nothing to do" not in perl_result.stdout' 12 | # Disable warning as yum doesn't support enable module 13 | tags: [rabbitmq, skip_ansible_lint] 14 | 15 | - name: Install rabbitmy/erlang from packagecloud for RH 8 16 | become: yes 17 | no_log: yes 18 | yum_repository: 19 | name: rabbitmq_erlang 20 | description: rabbitmq_erlang 21 | baseurl: https://packagecloud.io/rabbitmq/erlang/el/{{ ansible_facts.distribution_major_version }}/$basearch 22 | repo_gpgcheck: yes 23 | gpgkey: "https://packagecloud.io/rabbitmq/erlang/gpgkey" 24 | sslcacert: /etc/pki/tls/certs/ca-bundle.crt 25 | metadata_expire: 300 26 | gpgcheck: no 27 | enabled: yes 28 | sslverify: yes 29 | when: rabbitmq_on_el8 30 | tags: rabbitmq 31 | 32 | - name: Install latest rabbitmq erlang package on {{ ansible_facts.distribution }} 33 | become: yes 34 | package: 35 | name: erlang 36 | state: present 37 | register: _eltask 38 | retries: 5 39 | delay: 3 40 | until: _eltask is succeeded 41 | when: rabbitmq_on_el8 42 | tags: rabbitmq 43 | 44 | - name: Install rabbit from packagecloud for RH 8 45 | become: yes 46 | no_log: yes 47 | yum_repository: 48 | name: rabbitmq-server 49 | description: rabbitmq-server 50 | baseurl: https://packagecloud.io/rabbitmq/rabbitmq-server/el/{{ ansible_facts.distribution_major_version }}/$basearch 51 | repo_gpgcheck: yes 52 | gpgkey: "https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey" 53 | sslcacert: /etc/pki/tls/certs/ca-bundle.crt 54 | metadata_expire: 300 55 | gpgcheck: no 56 | enabled: yes 57 | sslverify: yes 58 | when: rabbitmq_on_el8 59 | tags: rabbitmq 60 | 61 | - name: Install latest rabbitmq package on {{ ansible_facts.distribution }} 62 | become: yes 63 | package: 64 | name: rabbitmq-server 65 | state: present 66 | register: _task 67 | retries: 5 68 | delay: 3 69 | until: _task is succeeded 70 | notify: 71 | - restart rabbitmq 72 | tags: rabbitmq 73 | when: rabbitmq_version == "present" 74 | 75 | - name: Install pinned rabbitmq package on {{ ansible_facts.distribution }} 76 | become: yes 77 | package: 78 | name: "rabbitmq-server{{ '=' if ansible_facts.pkg_mgr == 'apt' else '-' }}{{ rabbitmq_version }}" 79 | state: present 80 | register: _task 81 | retries: 5 82 | delay: 3 83 | until: _task is succeeded 84 | notify: 85 | - restart rabbitmq 86 | tags: rabbitmq 87 | when: rabbitmq_version != "present" 88 | 89 | - name: Ensure rabbitmq is enabled and running 90 | become: yes 91 | service: 92 | name: rabbitmq-server 93 | enabled: yes 94 | state: started 95 | tags: rabbitmq 96 | 97 | - name: Add RabbitMQ plugins 98 | become: yes 99 | rabbitmq_plugin: 100 | names: "{{ rabbitmq_plugins|join(',') }}" 101 | state: enabled 102 | # new_only: no = Remove all plguins that aren't listed in rabbitmq_plugins 103 | new_only: no 104 | when: rabbitmq_plugins | bool 105 | tags: rabbitmq 106 | -------------------------------------------------------------------------------- /roles/StackStorm.st2/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Ensure python3.6 is available 3 | include_tasks: request_ppa.yml 4 | when: ansible_facts.os_family == 'Debian' and ansible_facts.distribution_major_version == '16' 5 | tags: st2 6 | 7 | - name: Verify python3-devel is available in enabled repo 8 | become: yes 9 | shell: 10 | cmd: yum info python3-devel 11 | changed_when: false 12 | register: _rpm_check 13 | args: 14 | warn: False 15 | ignore_errors: yes 16 | when: ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_major_version == '7' 17 | # Disable warning as yum doesn't support info 18 | tags: st2, skip_ansible_lint 19 | 20 | - name: Discover name of optional server rpm 21 | become: yes 22 | shell: 23 | cmd: yum repolist disabled 2> /dev/null | awk -F'/' '/rhel-7-server-rhui-optional-rpms|rhui-REGION-rhel-server-optional|rhel-7-server-optional-rpms/{print $1}' 24 | changed_when: false 25 | register: _reponame 26 | args: 27 | warn: False 28 | when: ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_major_version == '7' and _rpm_check.rc != 0 29 | # Disable warning as yum doesn't support repolist 30 | tags: st2, skip_ansible_lint 31 | 32 | - name: Install python3-devel 33 | become: yes 34 | yum: 35 | name: python3-devel 36 | state: present 37 | enablerepo: "{{ _reponame.stdout }}" 38 | register: _task 39 | retries: 5 40 | delay: 3 41 | until: _task is succeeded 42 | when: ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_major_version == '7' and _rpm_check.rc != 0 43 | tags: st2 44 | 45 | - name: Install latest st2 package, auto-update 46 | become: yes 47 | package: 48 | name: st2 49 | state: latest 50 | register: _task 51 | retries: 5 52 | delay: 3 53 | until: _task is succeeded 54 | when: st2_version == "latest" 55 | notify: 56 | - restart st2 57 | - reload st2 58 | tags: st2, skip_ansible_lint 59 | 60 | - name: Install present st2 package, no auto-update 61 | become: yes 62 | package: 63 | name: st2 64 | state: present 65 | register: _task 66 | retries: 5 67 | delay: 3 68 | until: _task is succeeded 69 | when: st2_version == "present" 70 | notify: 71 | - restart st2 72 | - reload st2 73 | tags: st2 74 | 75 | - name: Install pinned st2 package 76 | become: yes 77 | package: 78 | name: st2{{ '-' if ansible_facts.pkg_mgr == 'yum' else '=' }}{{ st2_version }}-{{ st2_revision }} 79 | state: present 80 | register: _task 81 | retries: 5 82 | delay: 3 83 | until: _task is succeeded 84 | when: 85 | - st2_version != "latest" 86 | - st2_version != "present" 87 | notify: 88 | - restart st2 89 | - reload st2 90 | tags: st2 91 | 92 | - name: Install additional Python packages into the st2 virtualenv 93 | become: yes 94 | pip: 95 | name: "{{ item }}" 96 | virtualenv: /opt/stackstorm/st2 97 | state: present 98 | register: _task 99 | retries: 5 100 | delay: 3 101 | until: _task is succeeded 102 | with_items: "{{ st2_python_packages }}" 103 | notify: 104 | - restart st2 105 | tags: st2 106 | 107 | - name: Perform st2 version related operations 108 | import_tasks: version.yml 109 | tags: st2, version 110 | 111 | - name: Create and configure StackStorm system user 112 | import_tasks: user.yml 113 | tags: st2, user 114 | 115 | - name: Configure StackStorm authentication 116 | import_tasks: auth.yml 117 | # Use st2_config.auth.enable setting if available, otherwise use st2_auth_enable 118 | when: (st2_config.auth|default({})).enable|default(st2_auth_enable) 119 | tags: st2, auth 120 | 121 | - name: Configure StackStorm st2.conf settings 122 | # Ansible nested loop to iterate through a hash of hashes 123 | include_tasks: config.yml 124 | vars: 125 | _conf_section_name: "{{ _conf_section.0 }}" 126 | _conf_options: "{{ _conf_section.1 }}" 127 | # dict2items not available until 2.6, so use Jinja's dictsort instead 128 | loop: "{{ st2_config | dictsort }}" 129 | loop_control: 130 | loop_var: _conf_section 131 | tags: st2, config 132 | 133 | - name: Configure the StackStorm datastore 134 | import_tasks: datastore.yml 135 | tags: st2, datastore 136 | 137 | - name: Configure StackStorm to work via proxy 138 | import_tasks: proxy.yml 139 | tags: st2, proxy 140 | 141 | - name: Ensure StackStorm services are enabled and running 142 | become: yes 143 | service: 144 | name: "{{ item }}" 145 | enabled: yes 146 | state: started 147 | loop: "{{ st2_services }}" 148 | tags: st2 149 | 150 | # Since flush handlers does not support conditionals, we need to have a dedicated playbook 151 | # https://github.com/ansible/ansible/issues/41313#issuecomment-520891625 152 | - name: Flush handlers to prepare StackStorm if there are packs to install 153 | include_tasks: flush_handlers.yml 154 | when: st2_packs|length > 0 155 | ignore_errors: yes 156 | tags: st2, st2_packs 157 | 158 | - name: Install StackStorm integration Packs 159 | import_tasks: packs.yml 160 | when: st2_packs|length > 0 161 | ignore_errors: yes 162 | tags: st2, st2_packs 163 | -------------------------------------------------------------------------------- /roles/StackStorm.st2chatops/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Assert st2chatops_hubot_adapter is specified 3 | fail: 4 | msg: > 5 | '"st2chatops_hubot_adapter" must be one of the supported adapters in 6 | https://github.com/StackStorm/st2chatops/blob/master/st2chatops.env' 7 | when: st2chatops_hubot_adapter not in supported_hubot_adapters 8 | tags: st2chatops 9 | 10 | - name: Assert st2chatops_hubot_adapter "{{ st2chatops_hubot_adapter|upper }}" settings are specified 11 | fail: 12 | msg: '"st2chatops_config" hash cannot be empty for "{{ st2chatops_hubot_adapter|upper }}" hubot adapter.' 13 | when: > 14 | (st2chatops_config == None) or 15 | (st2chatops_config == {} and st2chatops_hubot_adapter != "shell") 16 | tags: st2chatops 17 | 18 | - name: Install latest st2chatops package, auto-update 19 | become: yes 20 | package: 21 | name: st2chatops 22 | state: latest 23 | register: _task 24 | retries: 5 25 | delay: 3 26 | until: _task is succeeded 27 | when: st2chatops_version == "latest" 28 | notify: 29 | - restart st2chatops 30 | tags: [st2chatops, skip_ansible_lint] 31 | 32 | - name: Install present st2chatops package, no auto-update 33 | become: yes 34 | package: 35 | name: st2chatops 36 | state: present 37 | register: _task 38 | retries: 5 39 | delay: 3 40 | until: _task is succeeded 41 | when: st2chatops_version == "present" 42 | notify: 43 | - restart st2chatops 44 | tags: st2chatops 45 | 46 | - name: Install pinned st2chatops package 47 | become: yes 48 | package: 49 | name: st2chatops{{ '-' if ansible_facts.pkg_mgr == 'yum' else '=' }}{{ st2chatops_version }} 50 | state: present 51 | register: _task 52 | retries: 5 53 | delay: 3 54 | until: _task is succeeded 55 | when: st2chatops_version != "latest" 56 | notify: 57 | - restart st2chatops 58 | tags: st2chatops 59 | 60 | - name: Check if API key already exist in st2chatops.env 61 | become: yes 62 | command: "grep -e '^export ST2_API_KEY=\"\\${ST2_API_KEY}\"$' /opt/stackstorm/chatops/st2chatops.env" 63 | changed_when: no 64 | ignore_errors: true 65 | register: task_apikey_not_exists 66 | tags: st2chatops 67 | 68 | - name: Add user defined "st2chatops_st2_api_key" in st2chatops.env, from "role" or "defaults/main.yml" 69 | become: yes 70 | replace: 71 | dest: /opt/stackstorm/chatops/st2chatops.env 72 | regexp: '(?<=ST2_API_KEY=)(\"\$\{ST2_API_KEY\}\")$' 73 | replace: '{{ st2chatops_st2_api_key }}' 74 | when: > 75 | (task_apikey_not_exists is succeeded) and 76 | (st2chatops_st2_api_key is defined) and 77 | (st2chatops_st2_api_key != "CHANGE-ME-PLEASE") 78 | register: task_user_st2_api_key 79 | no_log: true 80 | notify: restart st2chatops 81 | tags: st2chatops 82 | 83 | - name: Generate authentication token 84 | command: st2 auth "{{ st2_auth_username }}" -p "{{ st2_auth_password }}" -t 85 | when: task_apikey_not_exists is succeeded and task_user_st2_api_key is not changed 86 | register: task_st2_token 87 | tags: [st2chatops, skip_ansible_lint] 88 | 89 | - name: Generate "st2_api_key" if not provided with the "role" or in "defaults/main.yml" 90 | command: st2 apikey create -k 91 | environment: 92 | ST2_AUTH_TOKEN: "{{ task_st2_token.stdout }}" 93 | when: task_st2_token.changed 94 | register: task_generated_api_key 95 | no_log: true 96 | tags: [st2chatops, skip_ansible_lint] 97 | 98 | - name: Add generated "st2_api_key" in st2chatops.env 99 | become: yes 100 | replace: 101 | dest: /opt/stackstorm/chatops/st2chatops.env 102 | regexp: '(?<=ST2_API_KEY=)(\"\$\{ST2_API_KEY\}\")$' 103 | replace: '{{ task_generated_api_key.stdout }}' 104 | when: task_generated_api_key.changed 105 | register: task_st2_api_key 106 | no_log: true 107 | notify: restart st2chatops 108 | tags: [st2chatops, skip_ansible_lint] 109 | 110 | - name: Comment Username, Password and Auth URL, if API_KEY provided 111 | become: yes 112 | replace: 113 | dest: /opt/stackstorm/chatops/st2chatops.env 114 | regexp: '{{ item }}' 115 | replace: '# \1' 116 | loop: 117 | - '^(export ST2_AUTH_URL.*)' 118 | - '^(export ST2_AUTH_USERNAME.*)' 119 | - '^(export ST2_AUTH_PASSWORD.*)' 120 | when: (task_st2_api_key.changed) or (task_user_st2_api_key.changed) 121 | tags: [st2chatops, skip_ansible_lint] 122 | 123 | - name: Check if any adapter is enabled 124 | command: "grep -e '^export HUBOT_ADAPTER=' /opt/stackstorm/chatops/st2chatops.env" 125 | ignore_errors: true 126 | register: task_adapter_enabled 127 | changed_when: no 128 | tags: st2chatops 129 | 130 | - name: Set variable enabled_adapter 131 | set_fact: 132 | enabled_adapter: '{% set list_var = (task_adapter_enabled.stdout).split("=") %}{{ list_var[1] }}' 133 | ignore_errors: true 134 | changed_when: no 135 | tags: st2chatops 136 | 137 | - name: Comment existing hubot adapters in "/opt/stackstorm/chatops/st2chatops.env" 138 | become: yes 139 | replace: 140 | dest: /opt/stackstorm/chatops/st2chatops.env 141 | regexp: '^(export HUBOT_ADAPTER=.*)' 142 | replace: '# \1' 143 | when: > 144 | (enabled_adapter != st2chatops_hubot_adapter) or 145 | (enabled_adapter is not defined) 146 | notify: restart st2chatops 147 | tags: st2chatops 148 | 149 | - name: Uncomment Hubot "{{ st2chatops_hubot_adapter|upper }}" adapter in "/opt/stackstorm/chatops/st2chatops.env" 150 | become: yes 151 | replace: 152 | dest: /opt/stackstorm/chatops/st2chatops.env 153 | regexp: '^# (export HUBOT_ADAPTER={{ st2chatops_hubot_adapter }})$' 154 | replace: '\1' 155 | changed_when: no 156 | notify: restart st2chatops 157 | tags: st2chatops 158 | 159 | - name: Add entry for "SHELL" adapter 160 | become: yes 161 | lineinfile: 162 | dest: /opt/stackstorm/chatops/st2chatops.env 163 | line: export HUBOT_ADAPTER=shell 164 | when: st2chatops_hubot_adapter == "shell" 165 | notify: restart st2chatops 166 | tags: st2chatops 167 | 168 | - name: Configure "{{ st2chatops_hubot_adapter|upper }}" adapter setttings in "/opt/stackstorm/chatops/st2chatops.env" 169 | become: yes 170 | ini_file: 171 | dest: /opt/stackstorm/chatops/st2chatops.env 172 | section: null 173 | option: 'export {{ _conf_option.0 }}' 174 | value: '{{ _conf_option.1 }}' 175 | no_extra_spaces: yes 176 | # dict2items not available until 2.6, so use Jinja's dictsort instead 177 | loop: '{{ st2chatops_config | dictsort }}' 178 | loop_control: 179 | loop_var: _conf_option 180 | no_log: true 181 | notify: restart st2chatops 182 | tags: st2chatops 183 | 184 | # Update proxy env vars in st2chatops service config file 185 | - name: Configure st2chatops to work via proxy 186 | become: yes 187 | lineinfile: 188 | dest: /etc/{{ 'default' if ansible_facts.pkg_mgr == 'apt' else 'sysconfig' }}/{{ item.0 }} 189 | create: yes 190 | regexp: '^{{ item.1 }}=' 191 | line: "{{ item.1 }}={{ ansible_facts.env.get(item.1) }}" 192 | # NB: Empty ENV var cast to 'None' string in Ansible 193 | state: "{{ 'present' if ansible_facts.env.get(item.1, 'None') != 'None' else 'absent' }}" 194 | vars: 195 | _services: [st2chatops] 196 | _proxy_vars: [http_proxy, https_proxy, no_proxy] 197 | loop: '{{ _services|product(_proxy_vars)|list }}' 198 | notify: 199 | - restart st2chatops 200 | 201 | - name: Ensure st2chatops service is enabled and running 202 | become: yes 203 | service: 204 | name: st2chatops 205 | enabled: yes 206 | tags: st2chatops 207 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ansible-st2 2 | Ansible playbooks to deploy [StackStorm](https://github.com/stackstorm/st2). 3 | > [StackStorm](http://stackstorm.com/) is event-driven automation platform written in Python. 4 | With over [50+ integrations](https://github.com/StackStorm/st2contrib/tree/master/packs) like GitHub, Docker, Nagios, NewRelic, AWS, Ansible it allows you to wire together your existing infrastructure into complex Workflows with auto-remediation and many more. 5 | Aka IFTTT orchestration for Ops. 6 | 7 | [![Build Status](https://travis-ci.org/StackStorm/ansible-st2.svg?branch=master)](https://travis-ci.org/StackStorm/ansible-st2) 8 | [![Repository deb/rpm](https://img.shields.io/badge/Repository-deb/rpm-blue.svg)](https://packagecloud.io/StackStorm/stable/) 9 | [![Join our community Slack](https://stackstorm-community.herokuapp.com/badge.svg)](https://stackstorm.com/community-signup) 10 | 11 | ## Supported platforms 12 | * Ubuntu Xenial (16.04) 13 | * Ubuntu Bionic (18.04) 14 | * RHEL7 / CentOS7 15 | * RHEL8 / CentOS8 16 | 17 | > If you're using the provided Vagrantfile, note that it uses Bionic by default. 18 | 19 | > In order to access StackStorm Web UI, please don't forget to ensure that http/https ports are opened in your firewall system. 20 | 21 | ## Requirements 22 | At least 2GB of memory and 3.5GB of disk space is required, since StackStorm is shipped with RabbitMQ, Mongo and nginx. 23 | 24 | ## Installation 25 | ```sh 26 | # stackstorm 27 | ansible-playbook stackstorm.yml 28 | ``` 29 | 30 | ## Variables 31 | Below is the list of variables you can redefine in your playbook to customize st2 deployment: 32 | 33 | | Variable | Default | Description | 34 | | ------------------------ | ------------- | ------------ | 35 | | **st2repo** 36 | | `st2repo_name` | `stable` | StackStorm PackageCloud repository to install. [`stable`](https://packagecloud.io/StackStorm/stable/), [`unstable`](https://packagecloud.io/StackStorm/unstable/), [`staging-stable`](https://packagecloud.io/StackStorm/staging-stable/), [`staging-unstable`](https://packagecloud.io/StackStorm/staging-unstable/) 37 | | **st2** 38 | | `st2_version` | `latest` | StackStorm version to install. `present` to install available package, `latest` to get automatic updates, or pin it to numeric version like `2.2.0`. 39 | | `st2_revision` | `1` | StackStorm revision to install. Used only with pinned `st2_version`. 40 | | `st2_config` | `{}` | Hash with StackStorm configuration settings to set in [`st2.conf`](https://github.com/StackStorm/st2/blob/master/conf/st2.conf.sample) ini file. 41 | | `st2_system_user` | `stanley` | System user from which st2 will execute local/remote shell actions. 42 | | `st2_system_user_in_sudoers` | `yes`| Add `st2_system_user` to the sudoers (recommended for most `st2` features to work). 43 | | `st2_ssh_key_file` | `/home/{{st2_system_user}}/.ssh/{{st2_system_user}}_rsa` | Path to `st2_system_user` SSH private key. It will be autogenerated by default. 44 | | `st2_auth_enable` | `yes` | Enable StackStorm standalone authentication. 45 | | `st2_auth_username` | `testu` | Username used by StackStorm standalone authentication. 46 | | `st2_auth_password` | `testp` | Password used by StackStorm standalone authentication. 47 | | `st2_save_credentials` | `yes` | Save credentials for local CLI in `/root/.st2/config` file. 48 | | `st2_packs` | `[ st2 ]` | List of packs to install. This flag does not work with a `--python3` only pack. 49 | | `st2_python_packages` | `[ ]` | List of python packages to install into the `/opt/stackstorm/st2` virtualenv. This is needed when deploying alternative auth or coordination backends which depend on Python modules to make them work. 50 | | `st2_u16_add_insecure_py3_ppa` | `false` | Whether permission is granted to install the deadsnakes Python3.6 PPA for Ubuntu 16. 51 | | **st2web** 52 | | `st2web_ssl_certificate` | `null` | String with custom SSL certificate (`.crt`). If not provided, self-signed certificate will be generated. 53 | | `st2web_ssl_certificate_key` | `null` | String with custom SSL certificate secret key (`.key`). If not provided, self-signed certificate will be generated. 54 | | `st2web_nginx_config` | `null` | String with a custom nginx configuration file (`st2.conf`). If not provided, the default st2.conf will be used. 55 | | **ewc** 56 | | `ewc_license` | `null` | EWC license key is required for installing EWC enteprise bits via this ansible role. 57 | | `ewc_repo` | `enterprise` | EWC PackageCloud repository to install. [`enterprise`](https://packagecloud.io/StackStorm/enterprise/), [`enterprise-unstable`](https://packagecloud.io/StackStorm/enterprise-unstable/), [`staging-enterprise`](https://packagecloud.io/StackStorm/staging-enteprise/), [`staging-enterprise-unstable`](https://packagecloud.io/StackStorm/staging-enterprise-unstable/) 58 | | `ewc_version` | `latest` | EWC enterprise version to install. `present` to install available package, `latest` to get automatic updates, or pin it to numeric version like `2.2.0`. The version used here should match `st2_version`. 59 | | `ewc_revision` | `1` | EWC enterprise revision to install. Used only with pinned `ewc_version`. 60 | | `ewc_rbac` | [See `ewc_rbac` variable in role defaults](roles/StackStorm.ewc/defaults/main.yml) | EWC RBAC roles and assignments. This is a dictionary with two keys `roles` and `assignments`. `roles` and `assignments` are in turn both arrays. Each element in the array follows the exact YAML schema for [roles](https://ewc-docs.extremenetworks.com/rbac.html#user-permissions) and [assignments](https://ewc-docs.extremenetworks.com/rbac.html#defining-user-role-assignments) defined in EWC documentation. 61 | | `ewc_ldap` | [See `ewc_ldap` variable in role defaults](roles/StackStorm.ewc/defaults/main.yml) | Settings for EWC LDAP authentication backend. `ewc_ldap` is a dictionary and has one item `backend_kwargs`. `backend_kwargs` should be provided as exactly listed in EWC documentation for [LDAP configuration](https://ewc-docs.extremenetworks.com/authentication.html#auth-backends). 62 | | **st2chatops** 63 | | `st2chatops_version` | `latest` | st2chatops version to install. `present` to install available package, `latest` to get automatic updates, or pin it to numeric version like `2.2.0`. 64 | | `st2chatops_st2_api_key` | | st2 API key to be updated in st2chatops.env using "st2 apikey create -k" in a task 65 | | `st2chatops_hubot_adapter` | | Hubot Adapter to be used for st2chatops. Default is `shell`, but should be changed to one of the [`supported adapters`](`https://github.com/StackStorm/ansible-st2/blob/master/roles/st2chatops/vars/main.yml`).[**Required**] 66 | | `st2chatops_config` | `{ }` | Based on adapter in `st2chatops_hubot_adapter`, provide hash for the adapter settings, to update [`st2chatops.env`](https://github.com/StackStorm/st2chatops/blob/master/st2chatops.env). For example, for `Slack` hubot adapter: `st2chatops_config:` `HUBOT_SLACK_TOKEN: xoxb-CHANGE-ME-PLEASE` 67 | | `st2chatops_version` | `latest` | st2chatops version to install. Use `latest` to get automatic updates or pin it to numeric version like `2.2.0`. 68 | 69 | ## Examples 70 | Install latest `stable` StackStorm with all its components on local machine: 71 | ```sh 72 | ansible-playbook stackstorm.yml -i 'localhost,' --connection=local 73 | ``` 74 | 75 | > Note that keeping `latest` version is useful to update StackStorm by re-running playbook, since it will reinstall st2 if there is new version available. 76 | This is default behavior. If you don't want updates - consider pinning version-revision numbers. 77 | 78 | Install specific numeric version of st2 with pinned revision number as well: 79 | ```sh 80 | ansible-playbook stackstorm.yml --extra-vars='st2_version=2.2.0 st2_revision=8' 81 | ``` 82 | 83 | ## Installing behind a proxy. 84 | 85 | If you are installing from behind a proxy, you can use environment variables `http_proxy`, `https_proxy`, and `no_proxy` in the playbook. For the 86 | st2smoketests, you will need to disable proxy for localhost. 87 | 88 | ```yaml 89 | environment: 90 | http_proxy: http://proxy.example.net:3128 91 | https_proxy: http://proxy.example.net:3128 92 | no_proxy: 127.0.0.1,localhost 93 | ``` 94 | 95 | ## Developing 96 | There are a few requirements when developing on `ansible-st2`. 97 | 98 | These are the platforms we must support (must pass end-to-end testing): 99 | - Ubuntu Xenial 100 | - Ubuntu Bionic 101 | - CentOS7 102 | - CentOS8 103 | - RHEL7 (via AWS) 104 | - RHEL8 (via AWS) 105 | 106 | Must also support Ansible Idempotence (Eg. Ansible-playbook re-run should end with the following results: `changed=0.*failed=0`) 107 | 108 | For development purposes there is [Vagrantfile](Vagrantfile) available. The following command will setup ubuntu18 box (`ubuntu/bionic64`) by default: 109 | ```sh 110 | vagrant up 111 | ``` 112 | 113 | Other distros: 114 | ```sh 115 | vagrant up ubuntu16 116 | vagrant up centos7 117 | vagrant up centos8 118 | ``` 119 | 120 | ## Other Installers 121 | You might be interested in other methods to deploy StackStorm engine: 122 | * Configuration Management 123 | * [Puppet Module](https://github.com/stackstorm/puppet-st2) 124 | 125 | * Manual Instructions 126 | * [Ubuntu 16.04](https://docs.stackstorm.com/install/u16.html) 127 | * [Ubuntu 18.04](https://docs.stackstorm.com/install/u18.html) 128 | * [RHEL8/CentOS8](https://docs.stackstorm.com/install/rhel8.html) 129 | * [RHEL7/CentOS7](https://docs.stackstorm.com/install/rhel7.html) 130 | 131 | ## Help 132 | If you're in stuck, our community always ready to help, feel free to: 133 | * Ask questions in our [public Slack channel](https://stackstorm.com/community-signup) 134 | * [Report bug](https://github.com/StackStorm/ansible-st2/issues), provide [feature request](https://github.com/StackStorm/ansible-st2/pulls) or just give us a ✮ star 135 | 136 | Your contribution is more than welcome! 137 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | --------------------------------------------------------------------------------