├── .dockerignore.image ├── .gitignore ├── .travis.yml ├── CHANGELOG ├── CONTRIBUTING.md ├── Dockerfile ├── Dockerfile.debug ├── Dockerfile.testing ├── LICENSE ├── README.md ├── extra_vars.yml.ci ├── extra_vars.yml.sample ├── inventory.local ├── inventory.sample ├── iot.yml ├── requirements.txt ├── requirements.yml ├── roles ├── awscli │ ├── defaults │ │ └── main.yml │ ├── tasks │ │ ├── awscli.yml │ │ └── main.yml │ └── templates │ │ ├── aws_config.j2 │ │ └── aws_credentials.j2 ├── greengrass-core │ ├── defaults │ │ └── main.yml │ ├── files │ │ └── greengrassd.service │ └── tasks │ │ ├── greengrass-core.yml │ │ └── main.yml ├── greengrass-deploy │ ├── tasks │ │ ├── deploy.yml │ │ └── main.yml │ └── vars │ │ └── main.yml └── greengrass-lambda │ ├── defaults │ └── main.yml │ ├── meta │ └── main.yml │ ├── tasks │ ├── define_function.yml │ ├── lambda_deploy.yml │ └── main.yml │ ├── templates │ └── function_definition.json.j2 │ └── vars │ └── main.yml └── site.yml /.dockerignore.image: -------------------------------------------------------------------------------- 1 | vault_password 2 | extra_vars.yml* 3 | inventory 4 | # ansible retry files 5 | *.retry 6 | .git 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | vault_password 2 | extra_vars.yml* 3 | inventory 4 | # ansible retry files 5 | *.retry 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - lint 3 | - name: test_roles 4 | if: type IN (push, cron) 5 | - name: test_docker 6 | if: type IN (push, cron) 7 | 8 | language: python 9 | 10 | sudo: required 11 | 12 | services: 13 | - docker 14 | 15 | addons: 16 | apt: 17 | update: true 18 | 19 | before_install: 20 | - cp inventory.local inventory 21 | - mkdir -p group_vars/all 22 | - cp extra_vars.yml.ci vars.yml 23 | - sed -ri "s:AWS_ACCESS_KEY:$AWS_ACCESS_KEY:" vars.yml 24 | - sed -ri "s:AWS_SECRET_KEY:$AWS_SECRET_KEY:" vars.yml 25 | - mv vars.yml group_vars/all 26 | jobs: 27 | include: 28 | - stage: lint 29 | script: 30 | - ansible-galaxy install -r requirements.yml -p roles 31 | - > 32 | ansible-playbook site.yml -i inventory 33 | --check --skip-tag greengrass-core 34 | - stage: test_roles 35 | env: 36 | - AWS_ARGS=--no-verify-ssl 37 | script: 38 | - ansible-galaxy install -r requirements.yml -p roles 39 | - > 40 | ansible-playbook roles/greengrass-init/tests/test.yml 41 | -i roles/greengrass-init/tests/inventory -vv || echo 'Not OK!' 42 | - stage: test_docker 43 | script: 44 | - > 45 | docker build -t vmware/ansible-aws-greengrass:test 46 | -f Dockerfile.testing . 47 | - > 48 | docker run -it --rm vmware/ansible-aws-greengrass:test site.yml 49 | -i inventory -v 50 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | Initial OSS release. 2 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Contributing to ansible-aws-greengrass 4 | 5 | The ansible-aws-greengrass project team welcomes contributions from the community. If you wish to contribute code and you have not 6 | signed our contributor license agreement (CLA), our bot will update the issue when you open a Pull Request. For any 7 | questions about the CLA process, please refer to our [FAQ](https://cla.vmware.com/faq). 8 | 9 | ## Community 10 | 11 | For now, the best point of contact is through the Github project. If you have 12 | questions, comments, or feedback, feel free to open a Github issue to get the 13 | conversation started. 14 | 15 | ## Getting Started 16 | 17 | See the README for detailed getting started instructions. 18 | 19 | ## Contribution Flow 20 | 21 | This is a rough outline of what a contributor's workflow looks like: 22 | 23 | - Create a topic branch from where you want to base your work 24 | - Make commits of logical units 25 | - Make sure your commit messages are in the proper format (see below) 26 | - Push your changes to a topic branch in your fork of the repository 27 | - Submit a pull request 28 | 29 | Example: 30 | 31 | ``` shell 32 | git remote add upstream https://github.com/vmware/ansible-aws-greengrass.git 33 | git checkout -b my-new-feature master 34 | git commit -a 35 | git push origin my-new-feature 36 | ``` 37 | 38 | ### Staying In Sync With Upstream 39 | 40 | When your branch gets out of sync with the vmware/master branch, use the following to update: 41 | 42 | ``` shell 43 | git checkout my-new-feature 44 | git fetch -a 45 | git pull --rebase upstream master 46 | git push --force-with-lease origin my-new-feature 47 | ``` 48 | 49 | ### Updating pull requests 50 | 51 | If your PR fails to pass CI or needs changes based on code review, you'll most likely want to squash these changes into 52 | existing commits. 53 | 54 | If your pull request contains a single commit or your changes are related to the most recent commit, you can simply 55 | amend the commit. 56 | 57 | ``` shell 58 | git add . 59 | git commit --amend 60 | git push --force-with-lease origin my-new-feature 61 | ``` 62 | 63 | If you need to squash changes into an earlier commit, you can use: 64 | 65 | ``` shell 66 | git add . 67 | git commit --fixup 68 | git rebase -i --autosquash master 69 | git push --force-with-lease origin my-new-feature 70 | ``` 71 | 72 | Be sure to add a comment to the PR indicating your new changes are ready to review, as GitHub does not generate a 73 | notification when you git push. 74 | 75 | ### Code Style 76 | 77 | We follow Ansible standard coding style. We prefer 80-column width source 78 | files. 79 | 80 | ### Formatting Commit Messages 81 | 82 | We follow the conventions on [How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/). 83 | 84 | Be sure to include any related GitHub issue references in the commit message. See 85 | [GFM syntax](https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown) for referencing issues 86 | and commits. 87 | 88 | ## Reporting Bugs and Creating Issues 89 | 90 | When opening a new issue, try to roughly follow the commit message format conventions above. 91 | 92 | ## Repository Structure 93 | 94 | This repo is structured along the lines of the Ansible recommended 95 | [directory layout](http://docs.ansible.com/ansible/latest/user_guide/playbooks_best_practices.html#directory-layout). 96 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | FROM williamyeh/ansible:ubuntu16.04 4 | 5 | VOLUME /code 6 | ADD . /code 7 | WORKDIR /code 8 | 9 | RUN pip install -r requirements.txt 10 | RUN ansible-galaxy install -r requirements.yml -p roles 11 | 12 | CMD ["site.yml"] 13 | ENTRYPOINT ["ansible-playbook"] 14 | -------------------------------------------------------------------------------- /Dockerfile.debug: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | FROM williamyeh/ansible:ubuntu16.04 4 | RUN apt-get update -qq && apt-get install -y x11vnc xvfb fluxbox python-apt 5 | RUN mkdir ~/.vnc 6 | # Setup a VNC password 7 | RUN x11vnc -storepasswd 1234 /etc/x11vnc.pass 8 | 9 | RUN echo "Install noVNC - HTML5 based VNC viewer" 10 | RUN mkdir -p /novnc/utils/websockify 11 | RUN apt-get install wget net-tools 12 | RUN wget -qO- https://github.com/novnc/noVNC/archive/v1.0.0.tar.gz | tar xz --strip 1 -C /novnc 13 | # use older version of websockify to prevent hanging connections on offline containers, see https://github.com/ConSol/docker-headless-vnc-container/issues/50 14 | RUN wget -qO- https://github.com/novnc/websockify/archive/v0.6.1.tar.gz | tar xz --strip 1 -C /novnc/utils/websockify 15 | RUN chmod +x -v /novnc/utils/*.sh 16 | ## create index.html to forward automatically to `vnc_lite.html` 17 | RUN ln -s /novnc/vnc_lite.html /novnc/index.html 18 | RUN echo "export DISPLAY=:2" >> /novnc/novnc.sh 19 | RUN echo "Xvfb :2 -screen 0 1280x800x16 &" >> /novnc/novnc.sh 20 | RUN echo "x11vnc -forever -usepw -display :2 -rfbauth /etc/x11vnc.pass &" >> /novnc/novnc.sh 21 | RUN echo "xterm -e 'cd /code && /bin/bash' &" >> /novnc/novnc.sh 22 | RUN echo "fluxbox &" >> /novnc/novnc.sh 23 | RUN echo "/novnc/utils/launch.sh" >> /novnc/novnc.sh 24 | RUN chmod +x -v /novnc/*.sh 25 | EXPOSE 6080 26 | 27 | RUN mkdir /vnc 28 | RUN echo "export DISPLAY=:20" >> /vnc/vnc.sh 29 | RUN echo "Xvfb :20 -screen 0 1280x800x16 &" >> /vnc/vnc.sh 30 | RUN echo "x11vnc -forever -usepw -display :20 -rfbport 5920 -rfbauth /etc/x11vnc.pass &" >> /vnc/vnc.sh 31 | RUN echo "xterm &" >> /vnc/vnc.sh 32 | RUN echo fluxbox >> /vnc/vnc.sh 33 | RUN chmod +x -v /vnc/*.sh 34 | EXPOSE 5920 35 | 36 | RUN apt-get install python-jmespath 37 | VOLUME /code 38 | ADD . /code 39 | WORKDIR /code 40 | 41 | # These arguments assume the local inventory and extra_vars is already created. 42 | CMD ["site.yml", "-i", "inventory", "--extra-vars", "@extra_vars.yml"] 43 | ENTRYPOINT ["ansible-playbook"] 44 | -------------------------------------------------------------------------------- /Dockerfile.testing: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | FROM williamyeh/ansible:ubuntu16.04 4 | 5 | ADD . /code 6 | WORKDIR /code 7 | 8 | RUN pip install -r requirements.txt 9 | RUN ansible-galaxy install -r requirements.yml -p roles 10 | RUN mkdir -p group_vars/all 11 | RUN echo "developer_user: root" >> group_vars/all/vars.yml 12 | 13 | VOLUME /code 14 | 15 | # These arguments assume the local inventory and extra_vars is already created. 16 | CMD ["site.yml", "-i", "inventory.local"] 17 | ENTRYPOINT ["ansible-playbook"] 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | ansible-aws-greengrass 2 | 3 | Copyright 2018 VMware, Inc. All rights reserved. 4 | SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-only 5 | 6 | This code is Dual Licensed Apache-2.0 or GPLv3 7 | 8 | =============================================================================== 9 | 10 | Apache License 11 | Version 2.0, January 2004 12 | http://www.apache.org/licenses/ 13 | 14 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 15 | 16 | 1. Definitions. 17 | 18 | "License" shall mean the terms and conditions for use, reproduction, 19 | and distribution as defined by Sections 1 through 9 of this document. 20 | 21 | "Licensor" shall mean the copyright owner or entity authorized by 22 | the copyright owner that is granting the License. 23 | 24 | "Legal Entity" shall mean the union of the acting entity and all 25 | other entities that control, are controlled by, or are under common 26 | control with that entity. For the purposes of this definition, 27 | "control" means (i) the power, direct or indirect, to cause the 28 | direction or management of such entity, whether by contract or 29 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 30 | outstanding shares, or (iii) beneficial ownership of such entity. 31 | 32 | "You" (or "Your") shall mean an individual or Legal Entity 33 | exercising permissions granted by this License. 34 | 35 | "Source" form shall mean the preferred form for making modifications, 36 | including but not limited to software source code, documentation 37 | source, and configuration files. 38 | 39 | "Object" form shall mean any form resulting from mechanical 40 | transformation or translation of a Source form, including but 41 | not limited to compiled object code, generated documentation, 42 | and conversions to other media types. 43 | 44 | "Work" shall mean the work of authorship, whether in Source or 45 | Object form, made available under the License, as indicated by a 46 | copyright notice that is included in or attached to the work 47 | (an example is provided in the Appendix below). 48 | 49 | "Derivative Works" shall mean any work, whether in Source or Object 50 | form, that is based on (or derived from) the Work and for which the 51 | editorial revisions, annotations, elaborations, or other modifications 52 | represent, as a whole, an original work of authorship. For the purposes 53 | of this License, Derivative Works shall not include works that remain 54 | separable from, or merely link (or bind by name) to the interfaces of, 55 | the Work and Derivative Works thereof. 56 | 57 | "Contribution" shall mean any work of authorship, including 58 | the original version of the Work and any modifications or additions 59 | to that Work or Derivative Works thereof, that is intentionally 60 | submitted to Licensor for inclusion in the Work by the copyright owner 61 | or by an individual or Legal Entity authorized to submit on behalf of 62 | the copyright owner. For the purposes of this definition, "submitted" 63 | means any form of electronic, verbal, or written communication sent 64 | to the Licensor or its representatives, including but not limited to 65 | communication on electronic mailing lists, source code control systems, 66 | and issue tracking systems that are managed by, or on behalf of, the 67 | Licensor for the purpose of discussing and improving the Work, but 68 | excluding communication that is conspicuously marked or otherwise 69 | designated in writing by the copyright owner as "Not a Contribution." 70 | 71 | "Contributor" shall mean Licensor and any individual or Legal Entity 72 | on behalf of whom a Contribution has been received by Licensor and 73 | subsequently incorporated within the Work. 74 | 75 | 2. Grant of Copyright License. Subject to the terms and conditions of 76 | this License, each Contributor hereby grants to You a perpetual, 77 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 78 | copyright license to reproduce, prepare Derivative Works of, 79 | publicly display, publicly perform, sublicense, and distribute the 80 | Work and such Derivative Works in Source or Object form. 81 | 82 | 3. Grant of Patent License. Subject to the terms and conditions of 83 | this License, each Contributor hereby grants to You a perpetual, 84 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 85 | (except as stated in this section) patent license to make, have made, 86 | use, offer to sell, sell, import, and otherwise transfer the Work, 87 | where such license applies only to those patent claims licensable 88 | by such Contributor that are necessarily infringed by their 89 | Contribution(s) alone or by combination of their Contribution(s) 90 | with the Work to which such Contribution(s) was submitted. If You 91 | institute patent litigation against any entity (including a 92 | cross-claim or counterclaim in a lawsuit) alleging that the Work 93 | or a Contribution incorporated within the Work constitutes direct 94 | or contributory patent infringement, then any patent licenses 95 | granted to You under this License for that Work shall terminate 96 | as of the date such litigation is filed. 97 | 98 | 4. Redistribution. You may reproduce and distribute copies of the 99 | Work or Derivative Works thereof in any medium, with or without 100 | modifications, and in Source or Object form, provided that You 101 | meet the following conditions: 102 | 103 | (a) You must give any other recipients of the Work or 104 | Derivative Works a copy of this License; and 105 | 106 | (b) You must cause any modified files to carry prominent notices 107 | stating that You changed the files; and 108 | 109 | (c) You must retain, in the Source form of any Derivative Works 110 | that You distribute, all copyright, patent, trademark, and 111 | attribution notices from the Source form of the Work, 112 | excluding those notices that do not pertain to any part of 113 | the Derivative Works; and 114 | 115 | (d) If the Work includes a "NOTICE" text file as part of its 116 | distribution, then any Derivative Works that You distribute must 117 | include a readable copy of the attribution notices contained 118 | within such NOTICE file, excluding those notices that do not 119 | pertain to any part of the Derivative Works, in at least one 120 | of the following places: within a NOTICE text file distributed 121 | as part of the Derivative Works; within the Source form or 122 | documentation, if provided along with the Derivative Works; or, 123 | within a display generated by the Derivative Works, if and 124 | wherever such third-party notices normally appear. The contents 125 | of the NOTICE file are for informational purposes only and 126 | do not modify the License. You may add Your own attribution 127 | notices within Derivative Works that You distribute, alongside 128 | or as an addendum to the NOTICE text from the Work, provided 129 | that such additional attribution notices cannot be construed 130 | as modifying the License. 131 | 132 | You may add Your own copyright statement to Your modifications and 133 | may provide additional or different license terms and conditions 134 | for use, reproduction, or distribution of Your modifications, or 135 | for any such Derivative Works as a whole, provided Your use, 136 | reproduction, and distribution of the Work otherwise complies with 137 | the conditions stated in this License. 138 | 139 | 5. Submission of Contributions. Unless You explicitly state otherwise, 140 | any Contribution intentionally submitted for inclusion in the Work 141 | by You to the Licensor shall be under the terms and conditions of 142 | this License, without any additional terms or conditions. 143 | Notwithstanding the above, nothing herein shall supersede or modify 144 | the terms of any separate license agreement you may have executed 145 | with Licensor regarding such Contributions. 146 | 147 | 6. Trademarks. This License does not grant permission to use the trade 148 | names, trademarks, service marks, or product names of the Licensor, 149 | except as required for reasonable and customary use in describing the 150 | origin of the Work and reproducing the content of the NOTICE file. 151 | 152 | 7. Disclaimer of Warranty. Unless required by applicable law or 153 | agreed to in writing, Licensor provides the Work (and each 154 | Contributor provides its Contributions) on an "AS IS" BASIS, 155 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 156 | implied, including, without limitation, any warranties or conditions 157 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 158 | PARTICULAR PURPOSE. You are solely responsible for determining the 159 | appropriateness of using or redistributing the Work and assume any 160 | risks associated with Your exercise of permissions under this License. 161 | 162 | 8. Limitation of Liability. In no event and under no legal theory, 163 | whether in tort (including negligence), contract, or otherwise, 164 | unless required by applicable law (such as deliberate and grossly 165 | negligent acts) or agreed to in writing, shall any Contributor be 166 | liable to You for damages, including any direct, indirect, special, 167 | incidental, or consequential damages of any character arising as a 168 | result of this License or out of the use or inability to use the 169 | Work (including but not limited to damages for loss of goodwill, 170 | work stoppage, computer failure or malfunction, or any and all 171 | other commercial damages or losses), even if such Contributor 172 | has been advised of the possibility of such damages. 173 | 174 | 9. Accepting Warranty or Additional Liability. While redistributing 175 | the Work or Derivative Works thereof, You may choose to offer, 176 | and charge a fee for, acceptance of support, warranty, indemnity, 177 | or other liability obligations and/or rights consistent with this 178 | License. However, in accepting such obligations, You may act only 179 | on Your own behalf and on Your sole responsibility, not on behalf 180 | of any other Contributor, and only if You agree to indemnify, 181 | defend, and hold each Contributor harmless for any liability 182 | incurred by, or claims asserted against, such Contributor by reason 183 | of your accepting any such warranty or additional liability. 184 | 185 | END OF TERMS AND CONDITIONS 186 | 187 | =============================================================================== 188 | 189 | GNU GENERAL PUBLIC LICENSE 190 | Version 3, 29 June 2007 191 | 192 | Copyright (C) 2007 Free Software Foundation, Inc. 193 | Everyone is permitted to copy and distribute verbatim copies 194 | of this license document, but changing it is not allowed. 195 | 196 | Preamble 197 | 198 | The GNU General Public License is a free, copyleft license for 199 | software and other kinds of works. 200 | 201 | The licenses for most software and other practical works are designed 202 | to take away your freedom to share and change the works. By contrast, 203 | the GNU General Public License is intended to guarantee your freedom to 204 | share and change all versions of a program--to make sure it remains free 205 | software for all its users. We, the Free Software Foundation, use the 206 | GNU General Public License for most of our software; it applies also to 207 | any other work released this way by its authors. You can apply it to 208 | your programs, too. 209 | 210 | When we speak of free software, we are referring to freedom, not 211 | price. Our General Public Licenses are designed to make sure that you 212 | have the freedom to distribute copies of free software (and charge for 213 | them if you wish), that you receive source code or can get it if you 214 | want it, that you can change the software or use pieces of it in new 215 | free programs, and that you know you can do these things. 216 | 217 | To protect your rights, we need to prevent others from denying you 218 | these rights or asking you to surrender the rights. Therefore, you have 219 | certain responsibilities if you distribute copies of the software, or if 220 | you modify it: responsibilities to respect the freedom of others. 221 | 222 | For example, if you distribute copies of such a program, whether 223 | gratis or for a fee, you must pass on to the recipients the same 224 | freedoms that you received. You must make sure that they, too, receive 225 | or can get the source code. And you must show them these terms so they 226 | know their rights. 227 | 228 | Developers that use the GNU GPL protect your rights with two steps: 229 | (1) assert copyright on the software, and (2) offer you this License 230 | giving you legal permission to copy, distribute and/or modify it. 231 | 232 | For the developers' and authors' protection, the GPL clearly explains 233 | that there is no warranty for this free software. For both users' and 234 | authors' sake, the GPL requires that modified versions be marked as 235 | changed, so that their problems will not be attributed erroneously to 236 | authors of previous versions. 237 | 238 | Some devices are designed to deny users access to install or run 239 | modified versions of the software inside them, although the manufacturer 240 | can do so. This is fundamentally incompatible with the aim of 241 | protecting users' freedom to change the software. The systematic 242 | pattern of such abuse occurs in the area of products for individuals to 243 | use, which is precisely where it is most unacceptable. Therefore, we 244 | have designed this version of the GPL to prohibit the practice for those 245 | products. If such problems arise substantially in other domains, we 246 | stand ready to extend this provision to those domains in future versions 247 | of the GPL, as needed to protect the freedom of users. 248 | 249 | Finally, every program is threatened constantly by software patents. 250 | States should not allow patents to restrict development and use of 251 | software on general-purpose computers, but in those that do, we wish to 252 | avoid the special danger that patents applied to a free program could 253 | make it effectively proprietary. To prevent this, the GPL assures that 254 | patents cannot be used to render the program non-free. 255 | 256 | The precise terms and conditions for copying, distribution and 257 | modification follow. 258 | 259 | TERMS AND CONDITIONS 260 | 261 | 0. Definitions. 262 | 263 | "This License" refers to version 3 of the GNU General Public License. 264 | 265 | "Copyright" also means copyright-like laws that apply to other kinds of 266 | works, such as semiconductor masks. 267 | 268 | "The Program" refers to any copyrightable work licensed under this 269 | License. Each licensee is addressed as "you". "Licensees" and 270 | "recipients" may be individuals or organizations. 271 | 272 | To "modify" a work means to copy from or adapt all or part of the work 273 | in a fashion requiring copyright permission, other than the making of an 274 | exact copy. The resulting work is called a "modified version" of the 275 | earlier work or a work "based on" the earlier work. 276 | 277 | A "covered work" means either the unmodified Program or a work based 278 | on the Program. 279 | 280 | To "propagate" a work means to do anything with it that, without 281 | permission, would make you directly or secondarily liable for 282 | infringement under applicable copyright law, except executing it on a 283 | computer or modifying a private copy. Propagation includes copying, 284 | distribution (with or without modification), making available to the 285 | public, and in some countries other activities as well. 286 | 287 | To "convey" a work means any kind of propagation that enables other 288 | parties to make or receive copies. Mere interaction with a user through 289 | a computer network, with no transfer of a copy, is not conveying. 290 | 291 | An interactive user interface displays "Appropriate Legal Notices" 292 | to the extent that it includes a convenient and prominently visible 293 | feature that (1) displays an appropriate copyright notice, and (2) 294 | tells the user that there is no warranty for the work (except to the 295 | extent that warranties are provided), that licensees may convey the 296 | work under this License, and how to view a copy of this License. If 297 | the interface presents a list of user commands or options, such as a 298 | menu, a prominent item in the list meets this criterion. 299 | 300 | 1. Source Code. 301 | 302 | The "source code" for a work means the preferred form of the work 303 | for making modifications to it. "Object code" means any non-source 304 | form of a work. 305 | 306 | A "Standard Interface" means an interface that either is an official 307 | standard defined by a recognized standards body, or, in the case of 308 | interfaces specified for a particular programming language, one that 309 | is widely used among developers working in that language. 310 | 311 | The "System Libraries" of an executable work include anything, other 312 | than the work as a whole, that (a) is included in the normal form of 313 | packaging a Major Component, but which is not part of that Major 314 | Component, and (b) serves only to enable use of the work with that 315 | Major Component, or to implement a Standard Interface for which an 316 | implementation is available to the public in source code form. A 317 | "Major Component", in this context, means a major essential component 318 | (kernel, window system, and so on) of the specific operating system 319 | (if any) on which the executable work runs, or a compiler used to 320 | produce the work, or an object code interpreter used to run it. 321 | 322 | The "Corresponding Source" for a work in object code form means all 323 | the source code needed to generate, install, and (for an executable 324 | work) run the object code and to modify the work, including scripts to 325 | control those activities. However, it does not include the work's 326 | System Libraries, or general-purpose tools or generally available free 327 | programs which are used unmodified in performing those activities but 328 | which are not part of the work. For example, Corresponding Source 329 | includes interface definition files associated with source files for 330 | the work, and the source code for shared libraries and dynamically 331 | linked subprograms that the work is specifically designed to require, 332 | such as by intimate data communication or control flow between those 333 | subprograms and other parts of the work. 334 | 335 | The Corresponding Source need not include anything that users 336 | can regenerate automatically from other parts of the Corresponding 337 | Source. 338 | 339 | The Corresponding Source for a work in source code form is that 340 | same work. 341 | 342 | 2. Basic Permissions. 343 | 344 | All rights granted under this License are granted for the term of 345 | copyright on the Program, and are irrevocable provided the stated 346 | conditions are met. This License explicitly affirms your unlimited 347 | permission to run the unmodified Program. The output from running a 348 | covered work is covered by this License only if the output, given its 349 | content, constitutes a covered work. This License acknowledges your 350 | rights of fair use or other equivalent, as provided by copyright law. 351 | 352 | You may make, run and propagate covered works that you do not 353 | convey, without conditions so long as your license otherwise remains 354 | in force. You may convey covered works to others for the sole purpose 355 | of having them make modifications exclusively for you, or provide you 356 | with facilities for running those works, provided that you comply with 357 | the terms of this License in conveying all material for which you do 358 | not control copyright. Those thus making or running the covered works 359 | for you must do so exclusively on your behalf, under your direction 360 | and control, on terms that prohibit them from making any copies of 361 | your copyrighted material outside their relationship with you. 362 | 363 | Conveying under any other circumstances is permitted solely under 364 | the conditions stated below. Sublicensing is not allowed; section 10 365 | makes it unnecessary. 366 | 367 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 368 | 369 | No covered work shall be deemed part of an effective technological 370 | measure under any applicable law fulfilling obligations under article 371 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 372 | similar laws prohibiting or restricting circumvention of such 373 | measures. 374 | 375 | When you convey a covered work, you waive any legal power to forbid 376 | circumvention of technological measures to the extent such circumvention 377 | is effected by exercising rights under this License with respect to 378 | the covered work, and you disclaim any intention to limit operation or 379 | modification of the work as a means of enforcing, against the work's 380 | users, your or third parties' legal rights to forbid circumvention of 381 | technological measures. 382 | 383 | 4. Conveying Verbatim Copies. 384 | 385 | You may convey verbatim copies of the Program's source code as you 386 | receive it, in any medium, provided that you conspicuously and 387 | appropriately publish on each copy an appropriate copyright notice; 388 | keep intact all notices stating that this License and any 389 | non-permissive terms added in accord with section 7 apply to the code; 390 | keep intact all notices of the absence of any warranty; and give all 391 | recipients a copy of this License along with the Program. 392 | 393 | You may charge any price or no price for each copy that you convey, 394 | and you may offer support or warranty protection for a fee. 395 | 396 | 5. Conveying Modified Source Versions. 397 | 398 | You may convey a work based on the Program, or the modifications to 399 | produce it from the Program, in the form of source code under the 400 | terms of section 4, provided that you also meet all of these conditions: 401 | 402 | a) The work must carry prominent notices stating that you modified 403 | it, and giving a relevant date. 404 | 405 | b) The work must carry prominent notices stating that it is 406 | released under this License and any conditions added under section 407 | 7. This requirement modifies the requirement in section 4 to 408 | "keep intact all notices". 409 | 410 | c) You must license the entire work, as a whole, under this 411 | License to anyone who comes into possession of a copy. This 412 | License will therefore apply, along with any applicable section 7 413 | additional terms, to the whole of the work, and all its parts, 414 | regardless of how they are packaged. This License gives no 415 | permission to license the work in any other way, but it does not 416 | invalidate such permission if you have separately received it. 417 | 418 | d) If the work has interactive user interfaces, each must display 419 | Appropriate Legal Notices; however, if the Program has interactive 420 | interfaces that do not display Appropriate Legal Notices, your 421 | work need not make them do so. 422 | 423 | A compilation of a covered work with other separate and independent 424 | works, which are not by their nature extensions of the covered work, 425 | and which are not combined with it such as to form a larger program, 426 | in or on a volume of a storage or distribution medium, is called an 427 | "aggregate" if the compilation and its resulting copyright are not 428 | used to limit the access or legal rights of the compilation's users 429 | beyond what the individual works permit. Inclusion of a covered work 430 | in an aggregate does not cause this License to apply to the other 431 | parts of the aggregate. 432 | 433 | 6. Conveying Non-Source Forms. 434 | 435 | You may convey a covered work in object code form under the terms 436 | of sections 4 and 5, provided that you also convey the 437 | machine-readable Corresponding Source under the terms of this License, 438 | in one of these ways: 439 | 440 | a) Convey the object code in, or embodied in, a physical product 441 | (including a physical distribution medium), accompanied by the 442 | Corresponding Source fixed on a durable physical medium 443 | customarily used for software interchange. 444 | 445 | b) Convey the object code in, or embodied in, a physical product 446 | (including a physical distribution medium), accompanied by a 447 | written offer, valid for at least three years and valid for as 448 | long as you offer spare parts or customer support for that product 449 | model, to give anyone who possesses the object code either (1) a 450 | copy of the Corresponding Source for all the software in the 451 | product that is covered by this License, on a durable physical 452 | medium customarily used for software interchange, for a price no 453 | more than your reasonable cost of physically performing this 454 | conveying of source, or (2) access to copy the 455 | Corresponding Source from a network server at no charge. 456 | 457 | c) Convey individual copies of the object code with a copy of the 458 | written offer to provide the Corresponding Source. This 459 | alternative is allowed only occasionally and noncommercially, and 460 | only if you received the object code with such an offer, in accord 461 | with subsection 6b. 462 | 463 | d) Convey the object code by offering access from a designated 464 | place (gratis or for a charge), and offer equivalent access to the 465 | Corresponding Source in the same way through the same place at no 466 | further charge. You need not require recipients to copy the 467 | Corresponding Source along with the object code. If the place to 468 | copy the object code is a network server, the Corresponding Source 469 | may be on a different server (operated by you or a third party) 470 | that supports equivalent copying facilities, provided you maintain 471 | clear directions next to the object code saying where to find the 472 | Corresponding Source. Regardless of what server hosts the 473 | Corresponding Source, you remain obligated to ensure that it is 474 | available for as long as needed to satisfy these requirements. 475 | 476 | e) Convey the object code using peer-to-peer transmission, provided 477 | you inform other peers where the object code and Corresponding 478 | Source of the work are being offered to the general public at no 479 | charge under subsection 6d. 480 | 481 | A separable portion of the object code, whose source code is excluded 482 | from the Corresponding Source as a System Library, need not be 483 | included in conveying the object code work. 484 | 485 | A "User Product" is either (1) a "consumer product", which means any 486 | tangible personal property which is normally used for personal, family, 487 | or household purposes, or (2) anything designed or sold for incorporation 488 | into a dwelling. In determining whether a product is a consumer product, 489 | doubtful cases shall be resolved in favor of coverage. For a particular 490 | product received by a particular user, "normally used" refers to a 491 | typical or common use of that class of product, regardless of the status 492 | of the particular user or of the way in which the particular user 493 | actually uses, or expects or is expected to use, the product. A product 494 | is a consumer product regardless of whether the product has substantial 495 | commercial, industrial or non-consumer uses, unless such uses represent 496 | the only significant mode of use of the product. 497 | 498 | "Installation Information" for a User Product means any methods, 499 | procedures, authorization keys, or other information required to install 500 | and execute modified versions of a covered work in that User Product from 501 | a modified version of its Corresponding Source. The information must 502 | suffice to ensure that the continued functioning of the modified object 503 | code is in no case prevented or interfered with solely because 504 | modification has been made. 505 | 506 | If you convey an object code work under this section in, or with, or 507 | specifically for use in, a User Product, and the conveying occurs as 508 | part of a transaction in which the right of possession and use of the 509 | User Product is transferred to the recipient in perpetuity or for a 510 | fixed term (regardless of how the transaction is characterized), the 511 | Corresponding Source conveyed under this section must be accompanied 512 | by the Installation Information. But this requirement does not apply 513 | if neither you nor any third party retains the ability to install 514 | modified object code on the User Product (for example, the work has 515 | been installed in ROM). 516 | 517 | The requirement to provide Installation Information does not include a 518 | requirement to continue to provide support service, warranty, or updates 519 | for a work that has been modified or installed by the recipient, or for 520 | the User Product in which it has been modified or installed. Access to a 521 | network may be denied when the modification itself materially and 522 | adversely affects the operation of the network or violates the rules and 523 | protocols for communication across the network. 524 | 525 | Corresponding Source conveyed, and Installation Information provided, 526 | in accord with this section must be in a format that is publicly 527 | documented (and with an implementation available to the public in 528 | source code form), and must require no special password or key for 529 | unpacking, reading or copying. 530 | 531 | 7. Additional Terms. 532 | 533 | "Additional permissions" are terms that supplement the terms of this 534 | License by making exceptions from one or more of its conditions. 535 | Additional permissions that are applicable to the entire Program shall 536 | be treated as though they were included in this License, to the extent 537 | that they are valid under applicable law. If additional permissions 538 | apply only to part of the Program, that part may be used separately 539 | under those permissions, but the entire Program remains governed by 540 | this License without regard to the additional permissions. 541 | 542 | When you convey a copy of a covered work, you may at your option 543 | remove any additional permissions from that copy, or from any part of 544 | it. (Additional permissions may be written to require their own 545 | removal in certain cases when you modify the work.) You may place 546 | additional permissions on material, added by you to a covered work, 547 | for which you have or can give appropriate copyright permission. 548 | 549 | Notwithstanding any other provision of this License, for material you 550 | add to a covered work, you may (if authorized by the copyright holders of 551 | that material) supplement the terms of this License with terms: 552 | 553 | a) Disclaiming warranty or limiting liability differently from the 554 | terms of sections 15 and 16 of this License; or 555 | 556 | b) Requiring preservation of specified reasonable legal notices or 557 | author attributions in that material or in the Appropriate Legal 558 | Notices displayed by works containing it; or 559 | 560 | c) Prohibiting misrepresentation of the origin of that material, or 561 | requiring that modified versions of such material be marked in 562 | reasonable ways as different from the original version; or 563 | 564 | d) Limiting the use for publicity purposes of names of licensors or 565 | authors of the material; or 566 | 567 | e) Declining to grant rights under trademark law for use of some 568 | trade names, trademarks, or service marks; or 569 | 570 | f) Requiring indemnification of licensors and authors of that 571 | material by anyone who conveys the material (or modified versions of 572 | it) with contractual assumptions of liability to the recipient, for 573 | any liability that these contractual assumptions directly impose on 574 | those licensors and authors. 575 | 576 | All other non-permissive additional terms are considered "further 577 | restrictions" within the meaning of section 10. If the Program as you 578 | received it, or any part of it, contains a notice stating that it is 579 | governed by this License along with a term that is a further 580 | restriction, you may remove that term. If a license document contains 581 | a further restriction but permits relicensing or conveying under this 582 | License, you may add to a covered work material governed by the terms 583 | of that license document, provided that the further restriction does 584 | not survive such relicensing or conveying. 585 | 586 | If you add terms to a covered work in accord with this section, you 587 | must place, in the relevant source files, a statement of the 588 | additional terms that apply to those files, or a notice indicating 589 | where to find the applicable terms. 590 | 591 | Additional terms, permissive or non-permissive, may be stated in the 592 | form of a separately written license, or stated as exceptions; 593 | the above requirements apply either way. 594 | 595 | 8. Termination. 596 | 597 | You may not propagate or modify a covered work except as expressly 598 | provided under this License. Any attempt otherwise to propagate or 599 | modify it is void, and will automatically terminate your rights under 600 | this License (including any patent licenses granted under the third 601 | paragraph of section 11). 602 | 603 | However, if you cease all violation of this License, then your 604 | license from a particular copyright holder is reinstated (a) 605 | provisionally, unless and until the copyright holder explicitly and 606 | finally terminates your license, and (b) permanently, if the copyright 607 | holder fails to notify you of the violation by some reasonable means 608 | prior to 60 days after the cessation. 609 | 610 | Moreover, your license from a particular copyright holder is 611 | reinstated permanently if the copyright holder notifies you of the 612 | violation by some reasonable means, this is the first time you have 613 | received notice of violation of this License (for any work) from that 614 | copyright holder, and you cure the violation prior to 30 days after 615 | your receipt of the notice. 616 | 617 | Termination of your rights under this section does not terminate the 618 | licenses of parties who have received copies or rights from you under 619 | this License. If your rights have been terminated and not permanently 620 | reinstated, you do not qualify to receive new licenses for the same 621 | material under section 10. 622 | 623 | 9. Acceptance Not Required for Having Copies. 624 | 625 | You are not required to accept this License in order to receive or 626 | run a copy of the Program. Ancillary propagation of a covered work 627 | occurring solely as a consequence of using peer-to-peer transmission 628 | to receive a copy likewise does not require acceptance. However, 629 | nothing other than this License grants you permission to propagate or 630 | modify any covered work. These actions infringe copyright if you do 631 | not accept this License. Therefore, by modifying or propagating a 632 | covered work, you indicate your acceptance of this License to do so. 633 | 634 | 10. Automatic Licensing of Downstream Recipients. 635 | 636 | Each time you convey a covered work, the recipient automatically 637 | receives a license from the original licensors, to run, modify and 638 | propagate that work, subject to this License. You are not responsible 639 | for enforcing compliance by third parties with this License. 640 | 641 | An "entity transaction" is a transaction transferring control of an 642 | organization, or substantially all assets of one, or subdividing an 643 | organization, or merging organizations. If propagation of a covered 644 | work results from an entity transaction, each party to that 645 | transaction who receives a copy of the work also receives whatever 646 | licenses to the work the party's predecessor in interest had or could 647 | give under the previous paragraph, plus a right to possession of the 648 | Corresponding Source of the work from the predecessor in interest, if 649 | the predecessor has it or can get it with reasonable efforts. 650 | 651 | You may not impose any further restrictions on the exercise of the 652 | rights granted or affirmed under this License. For example, you may 653 | not impose a license fee, royalty, or other charge for exercise of 654 | rights granted under this License, and you may not initiate litigation 655 | (including a cross-claim or counterclaim in a lawsuit) alleging that 656 | any patent claim is infringed by making, using, selling, offering for 657 | sale, or importing the Program or any portion of it. 658 | 659 | 11. Patents. 660 | 661 | A "contributor" is a copyright holder who authorizes use under this 662 | License of the Program or a work on which the Program is based. The 663 | work thus licensed is called the contributor's "contributor version". 664 | 665 | A contributor's "essential patent claims" are all patent claims 666 | owned or controlled by the contributor, whether already acquired or 667 | hereafter acquired, that would be infringed by some manner, permitted 668 | by this License, of making, using, or selling its contributor version, 669 | but do not include claims that would be infringed only as a 670 | consequence of further modification of the contributor version. For 671 | purposes of this definition, "control" includes the right to grant 672 | patent sublicenses in a manner consistent with the requirements of 673 | this License. 674 | 675 | Each contributor grants you a non-exclusive, worldwide, royalty-free 676 | patent license under the contributor's essential patent claims, to 677 | make, use, sell, offer for sale, import and otherwise run, modify and 678 | propagate the contents of its contributor version. 679 | 680 | In the following three paragraphs, a "patent license" is any express 681 | agreement or commitment, however denominated, not to enforce a patent 682 | (such as an express permission to practice a patent or covenant not to 683 | sue for patent infringement). To "grant" such a patent license to a 684 | party means to make such an agreement or commitment not to enforce a 685 | patent against the party. 686 | 687 | If you convey a covered work, knowingly relying on a patent license, 688 | and the Corresponding Source of the work is not available for anyone 689 | to copy, free of charge and under the terms of this License, through a 690 | publicly available network server or other readily accessible means, 691 | then you must either (1) cause the Corresponding Source to be so 692 | available, or (2) arrange to deprive yourself of the benefit of the 693 | patent license for this particular work, or (3) arrange, in a manner 694 | consistent with the requirements of this License, to extend the patent 695 | license to downstream recipients. "Knowingly relying" means you have 696 | actual knowledge that, but for the patent license, your conveying the 697 | covered work in a country, or your recipient's use of the covered work 698 | in a country, would infringe one or more identifiable patents in that 699 | country that you have reason to believe are valid. 700 | 701 | If, pursuant to or in connection with a single transaction or 702 | arrangement, you convey, or propagate by procuring conveyance of, a 703 | covered work, and grant a patent license to some of the parties 704 | receiving the covered work authorizing them to use, propagate, modify 705 | or convey a specific copy of the covered work, then the patent license 706 | you grant is automatically extended to all recipients of the covered 707 | work and works based on it. 708 | 709 | A patent license is "discriminatory" if it does not include within 710 | the scope of its coverage, prohibits the exercise of, or is 711 | conditioned on the non-exercise of one or more of the rights that are 712 | specifically granted under this License. You may not convey a covered 713 | work if you are a party to an arrangement with a third party that is 714 | in the business of distributing software, under which you make payment 715 | to the third party based on the extent of your activity of conveying 716 | the work, and under which the third party grants, to any of the 717 | parties who would receive the covered work from you, a discriminatory 718 | patent license (a) in connection with copies of the covered work 719 | conveyed by you (or copies made from those copies), or (b) primarily 720 | for and in connection with specific products or compilations that 721 | contain the covered work, unless you entered into that arrangement, 722 | or that patent license was granted, prior to 28 March 2007. 723 | 724 | Nothing in this License shall be construed as excluding or limiting 725 | any implied license or other defenses to infringement that may 726 | otherwise be available to you under applicable patent law. 727 | 728 | 12. No Surrender of Others' Freedom. 729 | 730 | If conditions are imposed on you (whether by court order, agreement or 731 | otherwise) that contradict the conditions of this License, they do not 732 | excuse you from the conditions of this License. If you cannot convey a 733 | covered work so as to satisfy simultaneously your obligations under this 734 | License and any other pertinent obligations, then as a consequence you may 735 | not convey it at all. For example, if you agree to terms that obligate you 736 | to collect a royalty for further conveying from those to whom you convey 737 | the Program, the only way you could satisfy both those terms and this 738 | License would be to refrain entirely from conveying the Program. 739 | 740 | 13. Use with the GNU Affero General Public License. 741 | 742 | Notwithstanding any other provision of this License, you have 743 | permission to link or combine any covered work with a work licensed 744 | under version 3 of the GNU Affero General Public License into a single 745 | combined work, and to convey the resulting work. The terms of this 746 | License will continue to apply to the part which is the covered work, 747 | but the special requirements of the GNU Affero General Public License, 748 | section 13, concerning interaction through a network will apply to the 749 | combination as such. 750 | 751 | 14. Revised Versions of this License. 752 | 753 | The Free Software Foundation may publish revised and/or new versions of 754 | the GNU General Public License from time to time. Such new versions will 755 | be similar in spirit to the present version, but may differ in detail to 756 | address new problems or concerns. 757 | 758 | Each version is given a distinguishing version number. If the 759 | Program specifies that a certain numbered version of the GNU General 760 | Public License "or any later version" applies to it, you have the 761 | option of following the terms and conditions either of that numbered 762 | version or of any later version published by the Free Software 763 | Foundation. If the Program does not specify a version number of the 764 | GNU General Public License, you may choose any version ever published 765 | by the Free Software Foundation. 766 | 767 | If the Program specifies that a proxy can decide which future 768 | versions of the GNU General Public License can be used, that proxy's 769 | public statement of acceptance of a version permanently authorizes you 770 | to choose that version for the Program. 771 | 772 | Later license versions may give you additional or different 773 | permissions. However, no additional obligations are imposed on any 774 | author or copyright holder as a result of your choosing to follow a 775 | later version. 776 | 777 | 15. Disclaimer of Warranty. 778 | 779 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 780 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 781 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 782 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 783 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 784 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 785 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 786 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 787 | 788 | 16. Limitation of Liability. 789 | 790 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 791 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 792 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 793 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 794 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 795 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 796 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 797 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 798 | SUCH DAMAGES. 799 | 800 | 17. Interpretation of Sections 15 and 16. 801 | 802 | If the disclaimer of warranty and limitation of liability provided 803 | above cannot be given local legal effect according to their terms, 804 | reviewing courts shall apply local law that most closely approximates 805 | an absolute waiver of all civil liability in connection with the 806 | Program, unless a warranty or assumption of liability accompanies a 807 | copy of the Program in return for a fee. 808 | 809 | END OF TERMS AND CONDITIONS 810 | 811 | How to Apply These Terms to Your New Programs 812 | 813 | If you develop a new program, and you want it to be of the greatest 814 | possible use to the public, the best way to achieve this is to make it 815 | free software which everyone can redistribute and change under these terms. 816 | 817 | To do so, attach the following notices to the program. It is safest 818 | to attach them to the start of each source file to most effectively 819 | state the exclusion of warranty; and each file should have at least 820 | the "copyright" line and a pointer to where the full notice is found. 821 | 822 | 823 | Copyright (C) 824 | 825 | This program is free software: you can redistribute it and/or modify 826 | it under the terms of the GNU General Public License as published by 827 | the Free Software Foundation, either version 3 of the License, or 828 | (at your option) any later version. 829 | 830 | This program is distributed in the hope that it will be useful, 831 | but WITHOUT ANY WARRANTY; without even the implied warranty of 832 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 833 | GNU General Public License for more details. 834 | 835 | You should have received a copy of the GNU General Public License 836 | along with this program. If not, see . 837 | 838 | Also add information on how to contact you by electronic and paper mail. 839 | 840 | If the program does terminal interaction, make it output a short 841 | notice like this when it starts in an interactive mode: 842 | 843 | Copyright (C) 844 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 845 | This is free software, and you are welcome to redistribute it 846 | under certain conditions; type `show c' for details. 847 | 848 | The hypothetical commands `show w' and `show c' should show the appropriate 849 | parts of the General Public License. Of course, your program's commands 850 | might be different; for a GUI interface, you would use an "about box". 851 | 852 | You should also get your employer (if you work as a programmer) or school, 853 | if any, to sign a "copyright disclaimer" for the program, if necessary. 854 | For more information on this, and how to apply and follow the GNU GPL, see 855 | . 856 | 857 | The GNU General Public License does not permit incorporating your program 858 | into proprietary programs. If your program is a subroutine library, you 859 | may consider it more useful to permit linking proprietary applications with 860 | the library. If this is what you want to do, use the GNU Lesser General 861 | Public License instead of this License. But first, please read 862 | . 863 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ansible AWS Greengrass 2 | 3 | [![Build Status](https://travis-ci.org/vmware/ansible-aws-greengrass.svg?branch=master)](https://travis-ci.org/vmware/ansible-aws-greengrass) 4 | 5 | This is an Ansible repo to set up the server side features for an AWS 6 | Greengrass project and deploy the IoT portions that would run in a data 7 | center. 8 | 9 | ## Overview 10 | 11 | This project includes the following abilities: 12 | 13 | * Create roles and policies necessary to run Greengrass and interact with 14 | devices 15 | * Generate Greengrass Groups and Cores identities at AWS 16 | * Generate automatic devices and associated certificates necessary for 17 | communication 18 | * Deploy lambda functions and associate them with Greengrass Groups 19 | * Install and configure Greengrass Cores at the target runtime location 20 | * Deploy configuration versions to Greengrass Cores to start and upgrade their 21 | operation 22 | 23 | ## Try it out 24 | 25 | 1. Deploy a host for the controller (this might be your development box.) 26 | 2. Connect to the controller and perform remaining steps there 27 | 3. Install Ansible (http://docs.ansible.com/ansible/) 28 | * Quick steps for ubuntu 14.04, as an example: 29 | 1. `sudo apt-get install -y python-pip python-dev libssl-dev sshpass` 30 | 1. `sudo pip install --upgrade setuptools` 31 | 1. `sudo pip install ansible markupsafe jmespath` 32 | 4. Clone this repository and cd into it 33 | 5. Configure hosts (check values in the inventory file, e.g. ```cp inventory.sample inventory``` and edit) 34 | 6. Copy `extra_vars.yml.sample` to `extra_vars.yml`, and customize as necessary. 35 | 7. Set password and other security (optional) 36 | ``` 37 | echo "$VAULT_PASSWORD" > vault_password 38 | # For example, AWS keys... 39 | ansible-vault encrypt_string --vault-id vmware@vault_password 'access-key' --name aws_access_key 40 | ansible-vault encrypt_string --vault-id vmware@vault_password 'secret-key' --name aws_secret_key 41 | # and paste the output into extra_vars 42 | ``` 43 | Also ensure you have credentials or keys for ssh to all target servers. 44 | NOTE: You can also manually enter the vault password during execution with ```--vault-id vmware@prompt``` 45 | 8. You may wish to first run the `awscli` role targeting your development box 46 | (e.g. localhost) and perform later steps from there. 47 | ``` 48 | ansible-playbook site.yml -i inventory --vault-id vmware@vault_password --extra-vars "@extra_vars.yml" -kK --tags dev 49 | ``` 50 | 9. Run site playbook: 51 | ``` 52 | ansible-playbook site.yml -i inventory --vault-id vmware@vault_password --extra-vars "@extra_vars.yml" -kK 53 | ``` 54 | or 55 | ``` 56 | ansible-playbook site.yml -i inventory --vault-id vmware@prompt --extra-vars "@extra_vars.yml" -kK 57 | ``` 58 | 59 | Running on OSX for development 60 | ------------------------------ 61 | 62 | To test basic provisioning on OSX, you have options. You may wish to 63 | run ansible on the OSX machine, targeting VMs launched via VMware 64 | Fusion, VirtualBox, etc., or you can run a container (see below) on OSX for the 65 | controller. 66 | 67 | Local with Containers 68 | --------------------- 69 | 70 | Installing docker is an exercise for the reader; follow best practices for your 71 | platform. 72 | 73 | Build the container: 74 | ``` 75 | docker build -t vmware/ansible-aws-greengrass . 76 | ``` 77 | 78 | Run the container interactively for debugging: 79 | ``` 80 | # Build a version with debug tools 81 | docker build -t vmware/ansible-aws-greengrass:debug -f Dockerfile.debug . 82 | # For debugging, run the container with VNC so you can debug ansible. 83 | docker run -it -v $PWD:/code -p 5920:5920 --entrypoint /bin/bash vmware/ansible-aws-greengrass:debug /vnc/vnc.sh 84 | # You can then connect with VNC to your docker host, port 5920 (display 20). 85 | # Or alternatively, run no-vnc: 86 | docker run -it -v $PWD:/code -p 6080:6080 --entrypoint /bin/bash vmware/ansible-aws-greengrass:debug /novnc/novnc.sh 87 | # ...and then connect in a browser to your docker host, port 6080. 88 | ``` 89 | 90 | Run the container to perform ansible steps: 91 | ``` 92 | docker run -it -v $PWD:/code vmware/ansible-aws-greengrass 93 | ``` 94 | 95 | ### Prerequisites 96 | 97 | * You'll need Ansible (2.5+) 98 | * Before first run, you'll need AWS credentials with at least IAM, IoT, and 99 | Greengrass permissions, and most likely with S3 read/write 100 | * You must ensure the current Greengrass Core distribution is available on S3 101 | (at the time of this writing, greengrass-linux-x86-64-1.3.0.tar.gz), or host it 102 | at some URL and supply that by setting the appropriate variable. 103 | * AWS Greengrass Core role currently only supports Ubuntu; you'll need an 104 | Ubuntu VM or machine, or be prepared to port. 105 | * This role uses the json_query filter which requires jmespath on the local 106 | machine. 107 | 108 | ### Build & Run 109 | 110 | You can, of course, run the entire playbook to completion, which will deploy all 111 | configured parts of Greengrass. For a first run, it's simpler to break up into 112 | multiple steps to verify correct configuration. 113 | 114 | The typical end-to-end process is as follows. 115 | 116 | 1. Configure machine inventory and extra_vars for your environment. 117 | 2. Run Ansible with the dev tag to set up the host machine. 118 | ``` 119 | ansible-playbook site.yml -i inventory --extra-vars "@extra_vars.yml" -kK --tags dev 120 | ``` 121 | 3. Connect to that host machine and then run Ansible with the greengrass-init 122 | tag to make AWS console changes and setup the basic IoT items. 123 | ``` 124 | ansible-playbook site.yml -i inventory --extra-vars "@extra_vars.yml" -kK --tags greengrass-init 125 | ``` 126 | 4. Run Ansible with the lambda-deploy tag to deploy lambda functions to AWS. 127 | (Only if Lambdas are intended to run at Greengrass Cores) 128 | ``` 129 | ansible-playbook site.yml -i inventory --extra-vars "@extra_vars.yml" -kK --tags greengrass-init 130 | ``` 131 | 5. Run Ansible with the greengrass-core tag to deploy 132 | and configure the greengrass cores. 133 | ``` 134 | ansible-playbook site.yml -i inventory --extra-vars "@extra_vars.yml" -kK --tags greengrass-core 135 | ``` 136 | 6. Run Ansible with the greengrass-deploy tag to deploy a version of the runtime 137 | configuration and start IoT processing. 138 | ``` 139 | ansible-playbook site.yml -i inventory --extra-vars "@extra_vars.yml" -kK --tags greengrass-deploy 140 | ``` 141 | 142 | ## Documentation 143 | 144 | See code files for further documentation. The ```extra_vars.yml.sample``` file 145 | has sample settings for customization for your environment. 146 | 147 | ## Releases & Major Branches 148 | 149 | ## Contributing 150 | 151 | The ansible-aws-greengrass project team welcomes contributions from the community. If you wish to contribute code and you have not 152 | signed our contributor license agreement (CLA), our bot will update the issue when you open a Pull Request. For any 153 | questions about the CLA process, please refer to our [FAQ](https://cla.vmware.com/faq). For more detailed information, 154 | refer to [CONTRIBUTING.md](CONTRIBUTING.md). 155 | 156 | ## License 157 | -------------------------------------------------------------------------------- /extra_vars.yml.ci: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | 4 | # awscli setup 5 | # The awscli role is used to set up AWS CLI to prepare for greengrass setup. 6 | # This can be skipped if you install and configure AWS CLI manually. 7 | # The developer user account is used to configure AWS credentials in the home 8 | # directory. 9 | developer_user: root 10 | 11 | # AWS credentials are used by devtools to set up the AWS CLI, and these same 12 | # credentials are also used within the Greengrass role. These credentials will 13 | # need to be able to write to S3, IAM, IOT and Greengrass. You can pre-create 14 | # roles and policies as necessary if you wish to use less privileged keys here. 15 | aws_access_key: 'AWS_ACCESS_KEY' 16 | aws_secret_key: 'AWS_SECRET_KEY' 17 | 18 | # Greengrass setup 19 | 20 | # This S3 bucket is used to store credentials, lambda code, etc. 21 | # The AWS credentials available to ansible must be able to write to the bucket. 22 | greengrass_s3_bucket: greengrass-items 23 | 24 | # Greengrass groups to create. A matching core will be created for each group, 25 | # and deployed to a target host, if a host in the inventory has a matching Core 26 | # ID. For example, a host with a host variable 27 | # greengrass_core_id='mygroup-1_Core' 28 | # would receive a deployment of the first group in this list below. 29 | greengrass_group_names: 30 | - cigroup1 31 | 32 | # The role will create devices of the form {greengrass_device_stub}N, where N 33 | # is between 1 and greengrass_device_count. 34 | # These can be left undefined if no devices should be mass-created this way. 35 | greengrass_device_stub: ci-device 36 | greengrass_device_count: 2 37 | 38 | # You might wish to set this to true if you have another plan to distribute 39 | # certificates and binaries, or for speedier testing. 40 | skip_s3_uploads: false 41 | 42 | # Bucket for lambda source 43 | staging_s3_bucket: greengrass-items 44 | 45 | # Define the lambdas that should be deployed to a Greengrass Core. 46 | # Every time a version of a function is increased, that will create a new 47 | # Greengrass group version. 48 | # lambdas: 49 | # - name: some_function_name 50 | # description: Describe the function 51 | # zip: /path/to/source/of/function.zip 52 | # handler: module.function_handler 53 | # runtime: python2.7 54 | # version: 1 55 | # id: function_id1 56 | 57 | 58 | # This drives deployments of groups/cores, since it's not always clear when a 59 | # new deployment should occur. It only makes sense to set either deploy or 60 | # redeploy. A group may have neither set if it has not changed. 61 | greengrass_deploy: 62 | cigroup1: 63 | deploy: true 64 | redeploy: false 65 | 66 | # This is set here for CI, where we are only deploying one core. 67 | # Normally this is set as a host variable. 68 | greengrass_core_id: cigroup1_Core 69 | 70 | # Don't start greengrass core from CI; doesn't work in Docker builds. 71 | no_greengrass_start: true 72 | -------------------------------------------------------------------------------- /extra_vars.yml.sample: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | 4 | # awscli setup 5 | # The awscli role is used to set up AWS CLI to prepare for greengrass setup. 6 | # This can be skipped if you install and configure AWS CLI manually. 7 | # The developer user account is used to configure AWS credentials in the home 8 | # directory. 9 | developer_user: sundar_pichai 10 | 11 | # AWS credentials are used by devtools to set up the AWS CLI, and these same 12 | # credentials are also used within the Greengrass role. These credentials will 13 | # need to be able to write to S3, IAM, IOT and Greengrass. You can pre-create 14 | # roles and policies as necessary if you wish to use less privileged keys here. 15 | aws_access_key: 'your-AWS-access-key' 16 | aws_secret_key: 'your-AWS-secret-key' 17 | 18 | # Greengrass setup 19 | 20 | # This S3 bucket is used to store credentials, lambda code, etc. 21 | # The AWS credentials available to ansible must be able to write to the bucket. 22 | greengrass_s3_bucket: some-s3-bucket-to-contain-greengrass-archive-and-config 23 | 24 | # Bucket for lambda source 25 | staging_s3_bucket: some-s3-bucket-for-lambda-code 26 | 27 | # Greengrass groups to create. A matching core will be created for each group, 28 | # and deployed to a target host, if a host in the inventory has a matching Core 29 | # ID. For example, a host with a host variable 30 | # greengrass_core_id='mygroup-1_Core' 31 | # would receive a deployment of the first group in this list below. 32 | greengrass_group_names: 33 | - mygroup-1 34 | - mygroup-2 35 | - mygroup-3 36 | 37 | # The role will create devices of the form {greengrass_device_stub}N, where N 38 | # is between 1 and greengrass_device_count. 39 | # These can be left undefined if no devices should be mass-created this way. 40 | greengrass_device_stub: my-device 41 | greengrass_device_count: 3 42 | 43 | greengrass_group_devices: 44 | mygroup-1: 45 | - name: my-device1 46 | sync_shadow: true 47 | - name: my-device2 48 | sync_shadow: false 49 | 50 | # Coming soon: subscriptions 51 | greengrass_group_subscriptions: 52 | mygroup-1: 53 | - source: my-device1 54 | subject: $aws/things/# 55 | target: some_function_name 56 | - source: my-device2 57 | subject: $aws/things/# 58 | target: some_function_name 59 | 60 | # You might wish to set this to true if you have another plan to distribute 61 | # certificates and binaries, or for speedier testing. 62 | skip_s3_uploads: false 63 | 64 | # Define the lambdas that should be deployed to a Greengrass Core. 65 | # Every time a version of a function is increased, that will create a new 66 | # Greengrass group version. 67 | lambdas: 68 | - name: some_function_name 69 | description: Describe the function 70 | zip: /path/to/source/of/function.zip 71 | handler: module.function_handler 72 | runtime: python2.7 73 | version: 1 74 | id: function_id1 75 | - name: some_function_name2 76 | description: Describe the function 77 | zip: /path/to/source/of/function2.zip 78 | handler: module.function_handler 79 | runtime: python2.7 80 | version: 1 81 | id: function_id2 82 | 83 | # This drives deployments of groups/cores, since it's not always clear when a 84 | # new deployment should occur. It only makes sense to set either deploy or 85 | # redeploy. A group may have neither set if it has not changed. 86 | greengrass_deploy: 87 | mygroup-1: 88 | deploy: true 89 | redeploy: false 90 | mygroup-2: 91 | redeploy: false 92 | deploy: true 93 | -------------------------------------------------------------------------------- /inventory.local: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | [greengrass-core] 4 | localhost ansible_connection=local 5 | 6 | [greengrass-init] 7 | localhost ansible_connection=local 8 | 9 | [dev] 10 | localhost ansible_connection=local 11 | 12 | [dev:vars] 13 | name="VMware User" 14 | email=developer@vmware.com 15 | -------------------------------------------------------------------------------- /inventory.sample: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | [greengrass-core] 4 | 172.16.1.51 ansible_connection=ssh ansible_user=root greengrass_core_id='mygroup1_Core' 5 | 172.16.1.52 ansible_connection=ssh ansible_user=root greengrass_core_id='mygroup2_Core' 6 | 7 | [dev] 8 | localhost ansible_connection=ssh ansible_user=root 9 | 10 | # This is the host to execute AWS commands, just needs AWS CLI. 11 | [greengrass-init] 12 | localhost ansible_connection=ssh ansible_user=root 13 | 14 | [dev:vars] 15 | name="Developer One" 16 | email=developer1@vmware.com 17 | -------------------------------------------------------------------------------- /iot.yml: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | --- 4 | # file: iot.yml - tasks to set up IoT components 5 | - hosts: greengrass-init 6 | tags: greengrass 7 | roles: 8 | - { role: greengrass-lambda, tags: ['greengrass-lambda'] } 9 | - { role: greengrass-init, tags: ['greengrass-init', 'greengrass-deploy'] } 10 | - { role: greengrass-deploy, tags: ['greengrass-deploy'] } 11 | 12 | - hosts: greengrass-core 13 | become: yes 14 | tags: greengrass,greengrass-core 15 | roles: 16 | - { role: greengrass-core, when: ansible_os_family == 'Debian' } 17 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | ansible>=2.6.0 2 | jmespath==0.9.3 3 | -------------------------------------------------------------------------------- /requirements.yml: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | --- 4 | - src: vmware.ansible_role_greengrass_awscli 5 | name: vmware.awscli 6 | - src: vmware.greengrass_init 7 | name: greengrass-init 8 | -------------------------------------------------------------------------------- /roles/awscli/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | --- 4 | aws_region: us-east-1 5 | -------------------------------------------------------------------------------- /roles/awscli/tasks/awscli.yml: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | --- 4 | # This role configures a set of developer tools for our environment. 5 | - name: Ensure underlying requirements are installed. 6 | package: name={{ item }} state=present 7 | become_user: root 8 | with_items: 9 | - groff 10 | - sudo 11 | - unzip 12 | - python-jmespath 13 | when: 14 | - ansible_os_family == "Debian" 15 | - not ansible_check_mode 16 | 17 | - name: install-pip 18 | package: 19 | name: python-pip 20 | state: present 21 | become: yes 22 | become_user: root 23 | when: 24 | - ansible_os_family == "Debian" 25 | - not ansible_check_mode 26 | 27 | - name: install-aws-cli (system) 28 | pip: 29 | name: awscli 30 | state: latest 31 | become: yes 32 | become_user: root 33 | when: 34 | - ansible_os_family == "Debian" 35 | - not ansible_check_mode 36 | 37 | # Installing with --user for OSX. OSX system Python is a real mess. 38 | - name: install-aws-cli 39 | pip: 40 | name: awscli 41 | state: latest 42 | become: yes 43 | when: 44 | - ansible_os_family == "Darwin" 45 | - not ansible_check_mode 46 | 47 | - name: Install pybin 48 | pip: 49 | name: pybin 50 | when: 51 | - ansible_os_family == "Darwin" 52 | - not ansible_check_mode 53 | 54 | - name: Add aws cmd line to path 55 | command: pybin put 56 | when: 57 | - ansible_os_family == "Darwin" 58 | - not ansible_check_mode 59 | 60 | - file: 61 | path: ~/.aws 62 | state: directory 63 | mode: 0755 64 | when: not ansible_check_mode 65 | 66 | - name: Setup AWS CLI credentials 67 | template: 68 | src: aws_credentials.j2 69 | dest: ~/.aws/credentials 70 | backup: yes 71 | when: not ansible_check_mode 72 | 73 | - name: Setup AWS CLI config 74 | template: 75 | src: aws_config.j2 76 | dest: ~/.aws/config 77 | backup: yes 78 | when: not ansible_check_mode 79 | 80 | - name: Check if aws cli is now available 81 | shell: command -v aws >/dev/null 2>&1 82 | register: is_aws_on_path 83 | ignore_errors: yes 84 | 85 | - name: warn on path 86 | debug: msg="You may need to add the python installation path to your $PATH" 87 | when: 88 | - is_aws_on_path.changed is defined 89 | - is_aws_on_path.changed 90 | - is_aws_on_path.rc != 0 91 | -------------------------------------------------------------------------------- /roles/awscli/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | --- 4 | # This role configures a set of developer tools for our environment. 5 | # Import the real tasks, in a unique file name for better navigation. 6 | - import_tasks: awscli.yml 7 | -------------------------------------------------------------------------------- /roles/awscli/templates/aws_config.j2: -------------------------------------------------------------------------------- 1 | [default] 2 | region={{ aws_region }} 3 | output=json 4 | -------------------------------------------------------------------------------- /roles/awscli/templates/aws_credentials.j2: -------------------------------------------------------------------------------- 1 | [default] 2 | aws_access_key_id = {{ aws_access_key }} 3 | aws_secret_access_key = {{ aws_secret_key }} 4 | -------------------------------------------------------------------------------- /roles/greengrass-core/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | --- 4 | greengrass_version: 1.10.2 5 | 6 | # Define this to download from the web rather than S3 7 | #greengrass_package_url: "http://somewhere/greengrass-linux-x86-64-{{ greengrass_version }}.tar.gz" 8 | 9 | greengrass_checksum: sha256:57ddc2727568a02e64f33b439d3bca563a7628b71790641d0e7354964103ea13 10 | 11 | root_ca_checksum: sha256:eec26a7b9d62e3f674bd7befede9c878d484707a85c0702a16f54cd0704544ed 12 | 13 | # You might define an S3 bucket to contain greengrass files. 14 | greengrass_s3_bucket: s3-bucket-to-draw-files-from 15 | 16 | # You'll need an ID for the core to be installed. This should probably be set 17 | # as a host var if you want to deploy multiple cores. 18 | greengrass_core_id: name-of-core 19 | 20 | # Define this to download from the web rather than S3 21 | #greengrass_core_setup_url: http://localhost/{{ greengrass_core_setup }} 22 | 23 | # If true, watch for an expected string in the log file to validate 24 | # successful startup. 25 | greengrass_wait_for_success: true 26 | 27 | # The magic string; this may change in future core versions. 28 | greengrass_core_success_message: Deployment agent connected to cloud 29 | -------------------------------------------------------------------------------- /roles/greengrass-core/files/greengrassd.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Greengrass Daemon 3 | 4 | [Service] 5 | Type=forking 6 | PIDFile=/var/run/greengrassd.pid 7 | Restart=on-failure 8 | ExecStart=/greengrass/ggc/core/greengrassd start 9 | ExecReload=/greengrass/ggc/core/greengrassd restart 10 | ExecStop=/greengrass/ggc/core/greengrassd stop 11 | 12 | [Install] 13 | WantedBy=multi-user.target 14 | -------------------------------------------------------------------------------- /roles/greengrass-core/tasks/greengrass-core.yml: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | --- 4 | # This role installs greengrass core and configures for communication. 5 | - name: show core to install 6 | debug: 7 | msg: "Deploying the Greengrass Core '{{ greengrass_core_id }}'." 8 | 9 | - name: add greengrass group 10 | group: 11 | name: ggc_group 12 | system: yes 13 | state: present 14 | 15 | - name: add greengrass user 16 | user: 17 | name: ggc_user 18 | system: yes 19 | state: present 20 | 21 | - name: download-cgroupfs-mount 22 | get_url: 23 | url: "https://raw.githubusercontent.com/tianon/cgroupfs-mount/951c38ee8d802330454bdede20d85ec1c0f8d312/cgroupfs-mount" 24 | dest: /tmp/cgroupfs-mount.sh 25 | register: download_cgroupfs_mount 26 | retries: 5 27 | delay: 5 28 | until: not download_cgroupfs_mount.failed 29 | 30 | - name: perms-cgroupfs-mount 31 | file: 32 | path: /tmp/cgroupfs-mount.sh 33 | mode: "+x" 34 | when: 35 | - download_cgroupfs_mount.changed 36 | - not download_cgroupfs_mount.failed 37 | 38 | - name: cgroupfs-mount 39 | command: bash /tmp/cgroupfs-mount.sh 40 | 41 | - name: install-pip 42 | package: 43 | name: python-pip 44 | state: present 45 | when: not ansible_check_mode 46 | 47 | - name: install-sqlite 48 | package: 49 | name: sqlite3 50 | state: present 51 | when: not ansible_check_mode 52 | 53 | - name: install-boto3 54 | pip: 55 | name: boto3 56 | when: not ansible_check_mode 57 | 58 | - name: download-greengrass 59 | get_url: 60 | url: "{{ greengrass_package_url }}" 61 | dest: /tmp/greengrass-linux-x86-64-{{ greengrass_version }}.tar.gz 62 | checksum: "{{ greengrass_checksum }}" 63 | register: download_greengrass 64 | retries: 5 65 | delay: 5 66 | until: not download_greengrass.failed 67 | when: greengrass_package_url is defined 68 | 69 | - name: download-greengrass-s3 70 | aws_s3: 71 | bucket: "{{ greengrass_s3_bucket }}" 72 | object: greengrass-linux-x86-64-{{ greengrass_version }}.tar.gz 73 | dest: /tmp/greengrass-linux-x86-64-{{ greengrass_version }}.tar.gz 74 | mode: get 75 | aws_access_key: "{{ aws_access_key }}" 76 | aws_secret_key: "{{ aws_secret_key }}" 77 | when: 78 | - aws_access_key is defined 79 | - aws_secret_key is defined 80 | - greengrass_package_url is undefined 81 | - not ansible_check_mode 82 | 83 | - file: 84 | path: /greengrass 85 | state: directory 86 | mode: 0755 87 | 88 | - file: 89 | path: /greengrass/certs 90 | state: directory 91 | mode: 0755 92 | 93 | - name: Check that the greengrass install archive now exists 94 | stat: 95 | path: /tmp/greengrass-linux-x86-64-{{ greengrass_version }}.tar.gz 96 | register: install_stat 97 | 98 | - name: unarchive-greengrass 99 | unarchive: 100 | src: /tmp/greengrass-linux-x86-64-{{ greengrass_version }}.tar.gz 101 | dest: / 102 | remote_src: yes 103 | when: install_stat.stat.exists 104 | 105 | - name: download-root-ca 106 | get_url: 107 | url: "https://www.websecurity.digicert.com/content/dam/websitesecurity/digitalassets/desktop/pdfs/roots/VeriSign-Class%203-Public-Primary-Certification-Authority-G5.pem" 108 | dest: /greengrass/certs/root.ca.pem 109 | checksum: "{{ root_ca_checksum }}" 110 | register: download_root_ca 111 | retries: 5 112 | delay: 5 113 | until: not download_root_ca.failed 114 | 115 | - name: set greengrass core setup tarball 116 | set_fact: 117 | greengrass_core_setup: "{{ greengrass_core_id }}-setup.tar.gz" 118 | when: greengrass_core_setup is undefined 119 | 120 | - name: download-greengrass-config 121 | get_url: 122 | url: "{{ greengrass_core_setup_url }}" 123 | dest: /tmp/{{ greengrass_core_setup }} 124 | when: greengrass_core_setup_url is defined 125 | 126 | - name: download-greengrass-config-s3 127 | aws_s3: 128 | bucket: "{{ greengrass_s3_bucket }}" 129 | object: "{{ greengrass_core_setup }}" 130 | dest: /tmp/{{ greengrass_core_setup }} 131 | mode: get 132 | aws_access_key: "{{ aws_access_key }}" 133 | aws_secret_key: "{{ aws_secret_key }}" 134 | when: 135 | - aws_access_key is defined 136 | - aws_secret_key is defined 137 | - greengrass_core_setup_url is undefined 138 | - not ansible_check_mode 139 | - not skip_s3_uploads 140 | 141 | - name: Check that the setup file now exists 142 | stat: 143 | path: /tmp/{{ greengrass_core_setup }} 144 | register: setup_stat 145 | 146 | - name: unarchive-greengrass-config 147 | unarchive: 148 | src: /tmp/{{ greengrass_core_setup }} 149 | dest: /greengrass 150 | remote_src: yes 151 | when: setup_stat.stat.exists 152 | 153 | - name: copy systemd service unit 154 | copy: 155 | src: greengrassd.service 156 | dest: /etc/systemd/system/greengrassd.service 157 | 158 | - name: Stop service greengrassd, if running 159 | service: 160 | name: greengrassd 161 | state: stopped 162 | when: no_greengrass_start is undefined 163 | 164 | - name: Check for greengrass runtime log from prior installs 165 | stat: 166 | path: /greengrass/ggc/var/log/system/runtime.log 167 | register: runtime_log_stat 168 | 169 | - name: Compress runtime log from prior runs, if any 170 | archive: 171 | path: /greengrass/ggc/var/log/system/runtime.log 172 | dest: /greengrass/ggc/var/log/system/runtime.log.tar.gz 173 | remove: yes 174 | when: runtime_log_stat.stat.exists 175 | 176 | - name: start-greengrass 177 | service: 178 | name: greengrassd 179 | enabled: yes 180 | state: started 181 | when: no_greengrass_start is undefined 182 | 183 | - name: wait for a success in the daemon log 184 | wait_for: 185 | path: /greengrass/ggc/var/log/system/runtime.log 186 | search_regex: "{{ greengrass_core_success_message }}" 187 | delay: 10 188 | timeout: 60 189 | register: wait_for_success 190 | when: 191 | - no_greengrass_start is undefined 192 | - greengrass_wait_for_success 193 | -------------------------------------------------------------------------------- /roles/greengrass-core/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | --- 4 | # Import the real tasks, in a unique file name for better navigation. 5 | - import_tasks: greengrass-core.yml 6 | -------------------------------------------------------------------------------- /roles/greengrass-deploy/tasks/deploy.yml: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | --- 4 | # Create a deployment of a set of greengrass components 5 | # Currently assumes AWS credentials are already set up and AWS CLI is present. 6 | 7 | - name: Display group to be deployed 8 | debug: msg="Creating deployment for {{ greengrass_group_name }}" 9 | when: greengrass_group_name is defined 10 | 11 | - name: set deployment type default 12 | set_fact: 13 | deployment_type: NewDeployment 14 | 15 | - name: debug deploy 16 | debug: var=greengrass_deploy 17 | when: greengrass_deploy is defined 18 | 19 | - name: set deployment type for redeployment if necessary 20 | set_fact: 21 | deployment_type: Redeployment 22 | when: 23 | - greengrass_group_name in greengrass_deploy 24 | - greengrass_deploy[greengrass_group_name].redeploy is defined 25 | - greengrass_deploy[greengrass_group_name].redeploy 26 | 27 | - name: set group ID 28 | set_fact: 29 | group_id: "{{ ggc_groups[greengrass_group_name].id }}" 30 | when: 31 | - greengrass_group_name in ggc_groups 32 | - ggc_groups[greengrass_group_name].id is defined 33 | 34 | - name: set group version ID 35 | set_fact: 36 | group_version_id: "{{ ggc_groups[greengrass_group_name].groupVersionId }}" 37 | when: 38 | - greengrass_group_name in ggc_groups 39 | - ggc_groups[greengrass_group_name].groupVersionId is defined 40 | 41 | - name: Create the deployment 42 | command: aws greengrass create-deployment 43 | --deployment-type {{ deployment_type }} 44 | --group-id {{ group_id }} 45 | --group-version-id {{ group_version_id }} 46 | register: create_deployment 47 | when: 48 | - group_id is defined 49 | - group_version_id is defined 50 | - deployment_id is undefined or deployment_id == "" 51 | - greengrass_group_name in greengrass_deploy 52 | - greengrass_deploy[greengrass_group_name].deploy is defined 53 | - greengrass_deploy[greengrass_group_name].deploy 54 | 55 | - name: set create_deployment json 56 | set_fact: 57 | deployment_json: "{{ create_deployment.stdout | from_json }}" 58 | when: create_deployment.changed 59 | 60 | - name: select out newly created deployment 61 | set_fact: 62 | deployment_id: "{{ deployment_json | json_query('DeploymentId') }}" 63 | when: 64 | - deployment_json is defined 65 | - deployment_id is undefined or deployment_id == "" 66 | 67 | - name: check status of create_deployment 68 | command: aws greengrass get-deployment-status 69 | --deployment-id {{ deployment_id }} 70 | --group-id {{ group_id }} 71 | register: deployment_status 72 | when: deployment_id is defined and group_id is defined 73 | 74 | - name: clear deployment ID for next iteration 75 | set_fact: 76 | deployment_id: "" 77 | -------------------------------------------------------------------------------- /roles/greengrass-deploy/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | --- 4 | # Create a deployment of a set of greengrass components 5 | # Currently assumes AWS credentials are already set up and AWS CLI is present. 6 | 7 | - include_tasks: deploy.yml 8 | with_items: "{{ greengrass_group_names }}" 9 | loop_control: 10 | loop_var: greengrass_group_name 11 | -------------------------------------------------------------------------------- /roles/greengrass-deploy/vars/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | --- 4 | # greengrass variables for deploying to greengrass cores. 5 | 6 | # At the moment, whether to deploy or not is driven by a dict like the 7 | # following, where the first keys are greengrass group names: 8 | #greengrass_deploy: 9 | # group1: 10 | # redeploy: true 11 | # group2: 12 | # deploy: true 13 | # The above will redeploy group1, and perform a new deployment to group2. 14 | -------------------------------------------------------------------------------- /roles/greengrass-lambda/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | --- 4 | # Variables for customizing the deploy of lambda functions 5 | 6 | lambda_role_name: "Lambda-Greengrass-S3" 7 | 8 | lambda_role: "{{ lookup('file', 'lambda_role.json') | to_json | replace('\\n', '') }}" 9 | 10 | aws_region: us-east-1 11 | 12 | # An S3 bucket is required; uploading a zip directly is too slow and exceeds 13 | # the signature threshold using the CLI. 14 | staging_s3_bucket: greengrass-lambdas 15 | 16 | # Set to true to bypass upload, if source is already on S3 17 | skip_s3_uploads: false 18 | 19 | lambdas: [] 20 | -------------------------------------------------------------------------------- /roles/greengrass-lambda/meta/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2018 VMware, Inc. All rights reserved. 2 | # SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-only 3 | --- 4 | galaxy_info: 5 | author: John Gardner 6 | description: AWS Greengrass Lambda automation (create, version functions) 7 | company: VMware 8 | license: license (Apache, GPLv3) 9 | min_ansible_version: 2.5 10 | platforms: 11 | - name: Debian 12 | versions: 13 | - all 14 | - name: Ubuntu 15 | versions: 16 | - all 17 | galaxy_tags: 18 | - aws 19 | - greengrass 20 | - lambda 21 | - function 22 | - iot 23 | - serverless 24 | dependencies: 25 | - src: vmware.ansible_role_greengrass_awscli 26 | name: vmware.awscli 27 | -------------------------------------------------------------------------------- /roles/greengrass-lambda/tasks/define_function.yml: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | --- 4 | # This role upload a particular lambda function to AWS. 5 | 6 | - name: Show lambda function 7 | debug: msg="Defining function '{{ lambda.name }}'" 8 | 9 | - name: Extract lambda function arn 10 | set_fact: 11 | lambda_arn: "{{ lambda_functions_json | json_query(lambda_arn_query)}}" 12 | vars: 13 | lambda_arn_query: "Functions[?FunctionName=='{{ lambda.name }}'].FunctionArn | [0]" 14 | when: lambda_functions.changed and lambda_functions.rc == 0 15 | 16 | - name: Upload lambda source to S3 bucket (first time) 17 | command: aws s3 cp {{ lambda.zip }} s3://{{ staging_s3_bucket }} --quiet 18 | when: 19 | - lambda_arn is defined and not lambda_arn 20 | - not skip_s3_uploads 21 | 22 | - name: Create the lambda 23 | command: aws lambda create-function --region {{ aws_region }} 24 | --function-name {{ lambda.name }} 25 | --description "{{ lambda.description }}" 26 | --code S3Bucket={{ staging_s3_bucket }},S3Key={{ lambda.name }}.zip 27 | --role {{ lambda_role_arn }} 28 | --handler {{ lambda.handler }} 29 | --runtime {{ lambda.runtime }} 30 | register: lambda_create 31 | when: lambda_arn is defined and not lambda_arn 32 | 33 | - name: Extract lambda function arn from created 34 | set_fact: 35 | lambda_arn: "{{ lambda_functions_json | json_query(lambda_arn_query)}}" 36 | vars: 37 | lambda_arn_query: "FunctionArn" 38 | when: lambda_create.changed and lambda_create.rc == 0 39 | 40 | - name: List lambda versions 41 | command: > 42 | aws lambda list-versions-by-function 43 | --function-name {{ lambda.name }} 44 | register: lambda_versions 45 | 46 | - name: Extract lambda version arn that matches expected version 47 | set_fact: 48 | lambda_version_arn: "{{ lambda_versions.stdout | from_json | json_query(version_query)}}" 49 | vars: 50 | version_query: "Versions[?Version=='{{ lambda.version }}'].FunctionArn | [0]" 51 | when: lambda_versions.changed and lambda_versions.rc == 0 52 | 53 | - name: Upload new lambda source to S3 bucket (updated version) 54 | command: aws s3 cp {{ lambda.zip }} s3://{{ staging_s3_bucket }} --quiet 55 | when: 56 | - lambda_version_arn is defined and not lambda_version_arn 57 | - not skip_s3_uploads 58 | 59 | - name: Update lambda code and publish a new version if not found 60 | command: aws lambda update-function-code 61 | --function-name {{ lambda.name }} 62 | --s3-bucket {{ staging_s3_bucket }} 63 | --s3-key {{ lambda.name }}.zip 64 | --publish 65 | register: update_code 66 | when: lambda_version_arn is defined and not lambda_version_arn 67 | 68 | - name: set update_code json 69 | set_fact: 70 | update_code_json: "{{ update_code.stdout | from_json }}" 71 | when: update_code.changed 72 | 73 | - name: Extract lambda function version arn 74 | set_fact: 75 | lambda_version_arn: "{{ update_code_json | json_query(version_arn_query)}}" 76 | vars: 77 | version_arn_query: "FunctionArn" 78 | when: update_code.changed 79 | 80 | - name: Record lambda version arn for group 81 | set_fact: 82 | lambda_version_arns: "{{ lambda_version_arns }} + [ '{{ lambda_version_arn }}' ]" 83 | when: lambda_version_arn is defined 84 | 85 | - name: Record that there is a new version arn, since code changed 86 | set_fact: 87 | lambdas_updated: true 88 | when: update_code.changed 89 | 90 | - name: Record lambda details 91 | block: 92 | - name: Add lamba arn to collected lambda data entry 93 | set_fact: 94 | _entry: "{ '{{ lambda.name }}_arn': '{{ lambda_version_arn }}' }" 95 | when: lambda_version_arn is defined 96 | - name: Add lambda arn to collected lambda data 97 | set_fact: 98 | lambda_details: >- 99 | {{ lambda_details | combine ( _entry ) }} 100 | when: lambda_arn is defined 101 | when: 102 | - lambda_arn is defined 103 | - lambda_details is defined 104 | -------------------------------------------------------------------------------- /roles/greengrass-lambda/tasks/lambda_deploy.yml: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | --- 4 | # This role deploys lambda functions for AWS execution. 5 | 6 | - name: List current roles 7 | command: aws iam list-roles 8 | register: iam_roles 9 | 10 | - name: set lambda role fact 11 | set_fact: 12 | lambda_role_arn: "{{ iam_roles.stdout | from_json | json_query(lambda_role_query)}}" 13 | vars: 14 | lambda_role_query: "Roles[?RoleName=='{{ lambda_role_name }}'].Arn | [0]" 15 | when: iam_roles.changed and iam_roles.rc == 0 16 | 17 | - name: Verify staging bucket 18 | command: aws s3 ls 19 | register: s3_buckets 20 | 21 | - name: Create staging bucket 22 | command: aws s3 mb s3://{{ staging_s3_bucket }} 23 | when: 24 | - s3_buckets.changed 25 | - staging_s3_bucket not in s3_buckets.stdout and not skip_s3_uploads 26 | 27 | - name: List lambdas 28 | command: aws lambda list-functions 29 | register: lambda_functions 30 | 31 | - name: set lambda_functions json 32 | set_fact: 33 | lambda_functions_json: "{{ lambda_functions.stdout | from_json }}" 34 | when: lambda_functions.changed 35 | 36 | - name: set lambda arn list to initial empty 37 | set_fact: 38 | lambda_details: {} 39 | lambda_version_arns: [] 40 | 41 | - include_tasks: define_function.yml 42 | with_items: "{{ lambdas }}" 43 | loop_control: 44 | loop_var: lambda 45 | 46 | - name: List function definitions 47 | command: aws greengrass list-function-definitions 48 | register: function_definitions 49 | when: function_definition_id is undefined 50 | 51 | # We use a lambda definition name to pick the most recent one. This relies on 52 | # this role being used to deploy lambdas; this will ignore function definitions 53 | # created by hand, since their name won't follow the datestamp convention. 54 | # Mixing console-created and automation created configurations is not 55 | # recommended. 56 | - name: Obtain current function definition by name 57 | set_fact: 58 | function_latest: >- 59 | {{ function_definitions.stdout | from_json | json_query(names_query) 60 | | sort(attribute='Name') | last }} 61 | vars: 62 | names_query: "Definitions[?Name > ``]" 63 | when: 64 | - function_definitions.changed 65 | - lambdas_updated is undefined or not lambdas_updated 66 | ignore_errors: true 67 | 68 | - name: Obtain current function definition attributes 69 | set_fact: 70 | function_definition_id: >- 71 | {{ function_latest | json_query("Id") }} 72 | function_definition_arn: >- 73 | {{ function_latest | json_query("Arn") }} 74 | function_definition_version_arn: >- 75 | {{ function_latest | json_query("LatestVersionArn") }} 76 | when: 77 | - function_latest is defined 78 | - lambdas_updated is undefined or not lambdas_updated 79 | 80 | # If there's not a fn definition, make one 81 | - name: Create function definition 82 | command: aws greengrass create-function-definition 83 | --name {{ function_definition_name | default(ansible_date_time.iso8601) }} 84 | register: create_function_definition 85 | when: 86 | - function_definition_id is undefined or not function_definition_id 87 | 88 | - name: Extract function definition 89 | set_fact: 90 | function_definition_id: >- 91 | {{ create_function_definition.stdout | from_json | 92 | json_query("Id")}} 93 | when: create_function_definition.changed 94 | 95 | - name: Create a function definition version 96 | block: 97 | - tempfile: 98 | state: directory 99 | suffix: fn_def 100 | register: tmp_function 101 | - name: Template out function config 102 | template: 103 | src: function_definition.json.j2 104 | dest: "{{ tmp_function.path }}/function_definition.json" 105 | - name: Create function definition version 106 | command: aws greengrass create-function-definition-version 107 | --function-definition-id {{ function_definition_id }} 108 | --functions file://{{ tmp_function.path }}/function_definition.json 109 | register: create_function_definition_version 110 | - name: Extract function definition version 111 | set_fact: 112 | function_definition_version: >- 113 | {{ create_function_definition_version.stdout | from_json | 114 | json_query("Version") }} 115 | function_definition_version_arn: >- 116 | {{ create_function_definition_version.stdout | from_json | 117 | json_query("Arn") }} 118 | when: create_function_definition_version.changed 119 | when: 120 | - lambdas_updated is defined and lambdas_updated == true 121 | -------------------------------------------------------------------------------- /roles/greengrass-lambda/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | --- 4 | # This role deploys lambda functions for AWS execution. 5 | 6 | # Import the real tasks, in a unique file name for better navigation. 7 | - include_tasks: lambda_deploy.yml 8 | -------------------------------------------------------------------------------- /roles/greengrass-lambda/templates/function_definition.json.j2: -------------------------------------------------------------------------------- 1 | [ 2 | {% for lambda in lambdas %} 3 | { 4 | "FunctionArn": "{{ lambda_version_arns[loop.index0] }}", 5 | "FunctionConfiguration": { 6 | "Environment": {}, 7 | "MemorySize": {{ lambda.memory | default(16384) }}, 8 | "Pinned": true, 9 | "Timeout": {{ lambda.timeout | default(3) }} 10 | }{{', 11 | "Id": "%s"' % lambda.id if "id" in lambda else "" }} 12 | }{{ "," if not loop.last else "" }} 13 | {% endfor %} 14 | ] 15 | -------------------------------------------------------------------------------- /roles/greengrass-lambda/vars/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | --- 4 | # Variables for customizing the deploy of lambda functions 5 | 6 | # This is the name for the role that allows lambda execution from greengrass. 7 | # You may wish to customize with more permissions and a different name. 8 | #lambda_role_name: "Lambda-Greengrass-S3" 9 | 10 | # Preferred region. 11 | #aws_region: us-east-1 12 | 13 | # An S3 bucket is required; uploading a zip directly is too slow and exceeds 14 | # the signature threshold using the CLI. 15 | #staging_s3_bucket: greengrass-lambdas 16 | 17 | # Set to true to bypass upload, if source is already on S3 18 | #skip_s3_uploads: false 19 | 20 | #lambdas: [] 21 | 22 | # Sample lambda setting 23 | # lambdas: 24 | # - name: some_function_name 25 | # description: Describe the function 26 | # zip: /path/to/source/of/function.zip 27 | # handler: module.function_handler 28 | # runtime: python2.7 29 | # version: 1 30 | # id: function_id1 31 | 32 | # Set this if desired, otherwise will be generated 33 | # function_definition_name: 34 | -------------------------------------------------------------------------------- /site.yml: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 VMware, Inc. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 or GPL-3.0-only 3 | --- 4 | # file: site.yml - tasks to set up IoT components 5 | - hosts: greengrass-init 6 | tags: greengrass 7 | roles: 8 | - { role: greengrass-lambda, tags: ['greengrass-lambda'] } 9 | - { role: greengrass-init, tags: ['greengrass-init', 'greengrass-deploy'] } 10 | - { role: greengrass-deploy, tags: ['greengrass-deploy'] } 11 | 12 | - hosts: greengrass-core 13 | become: yes 14 | tags: greengrass,greengrass-core 15 | roles: 16 | - { role: greengrass-core, when: ansible_os_family == 'Debian' } 17 | --------------------------------------------------------------------------------