github.com/jmrodri/operator-sdk@v0.5.0/pkg/scaffold/ansible/roles_readme.go (about) 1 // Copyright 2018 The Operator-SDK Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package ansible 16 17 import ( 18 "path/filepath" 19 20 "github.com/operator-framework/operator-sdk/pkg/scaffold" 21 "github.com/operator-framework/operator-sdk/pkg/scaffold/input" 22 ) 23 24 const RolesReadmeFile = "README.md" 25 26 type RolesReadme struct { 27 input.Input 28 Resource scaffold.Resource 29 } 30 31 // GetInput - gets the input 32 func (r *RolesReadme) GetInput() (input.Input, error) { 33 if r.Path == "" { 34 r.Path = filepath.Join(RolesDir, r.Resource.LowerKind, RolesReadmeFile) 35 } 36 r.TemplateBody = rolesReadmeAnsibleTmpl 37 38 return r.Input, nil 39 } 40 41 const rolesReadmeAnsibleTmpl = `Role Name 42 ========= 43 44 A brief description of the role goes here. 45 46 Requirements 47 ------------ 48 49 Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. 50 51 Role Variables 52 -------------- 53 54 A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. 55 56 Dependencies 57 ------------ 58 59 A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. 60 61 Example Playbook 62 ---------------- 63 64 Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: 65 66 - hosts: servers 67 roles: 68 - { role: username.rolename, x: 42 } 69 70 License 71 ------- 72 73 BSD 74 75 Author Information 76 ------------------ 77 78 An optional section for the role authors to include contact information, or a website (HTML is not allowed). 79 `