Skip to content

Commit cffc4fb

Browse files
authored
Merge pull request #57 from xFuture603/vsc-code-snippets
added vsc code snippets
2 parents 20b3d97 + 03912db commit cffc4fb

4 files changed

Lines changed: 160 additions & 0 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ Local Testing
105105
> ansible-playbook tests/integration/targets/icinga/checkmode.yml
106106
```
107107

108+
Extras
109+
------
110+
111+
* Use our code snippets template supported in Visual Studio Code
112+
113+
Please see the [README](vsc-snippets/README.md) for more information.
114+
115+
108116
License
109117
-------
110118

galaxy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ repository: 'https://github.com/T-Systems-MMS/ansible-collection-icinga-director
1717
documentation: 'https://github.com/T-Systems-MMS/ansible-collection-icinga-director'
1818
homepage: 'https://github.com/T-Systems-MMS/ansible-collection-icinga-director'
1919
issues: 'https://github.com/T-Systems-MMS/ansible-collection-icinga-director/issues'
20+
build_ignore:
21+
- vsc-snippets

vsc-snippets/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
> Code snippets that you can import to your Visual Studio Code installation
2+
3+
## Instruction on how to add those snippets:
4+
5+
```
6+
- open VSC
7+
- File -> Preferences -> User Snippets
8+
- add a new one for YAML context
9+
- paste content from yaml.json in the new file
10+
- save the file
11+
```
12+
13+
## Instruction on how to use those snippets:
14+
15+
For example you can type in `servicetemp` in your .yaml file and get the following output:
16+
17+
```yaml
18+
- service_template_object:
19+
- ""
20+
check_command: foo
21+
check_interval: 60
22+
retry_interval: 30
23+
use_agent: true
24+
```
25+
26+
## Change snippet prefix to a specific value:
27+
28+
You can change the string that you need to type in to create the actual code from the snippet by changing the ```"prefix": "$Change_me"``` in your User Snippets file for your YAML code (yaml.json by default).

vsc-snippets/yaml.json

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
{
2+
3+
"notification default template": {
4+
"prefix": "notification",
5+
"body":["- notification_object:",
6+
"\t\t-",
7+
"\tapply_to:",
8+
"\tassign_filter:",
9+
"\timports:",
10+
"\t\t-",
11+
"\tnotification_interval: \"0\"",
12+
"\tusers:",
13+
"\t\t- \"\"",
14+
"\ttypes:",
15+
"\t\t- Problem",
16+
"\t\t- Recovery"
17+
]
18+
},
19+
20+
"user default template": {
21+
"prefix": "user",
22+
"body":["- user_object:",
23+
"\t\t-",
24+
"\tperiod: \"24x7\"",
25+
"\temail: \"foo.bar@foobar.de\"",
26+
"\tpager: \"SIP/foobar\"",
27+
"\timports:",
28+
"\t\t-"
29+
]
30+
},
31+
32+
"host_template default template": {
33+
"prefix": "hosttemp",
34+
"body":["- host_template_object:",
35+
"\t\t- \"\"",
36+
"\timports:",
37+
"\t\t-",
38+
"\tvars:"
39+
]
40+
},
41+
42+
"host_group default template": {
43+
"prefix": "hostgroup",
44+
"body":["- hostgroup_object:",
45+
"\t\t- \"\""
46+
]
47+
},
48+
49+
"host default template": {
50+
"prefix": "host",
51+
"body":["- host_object:",
52+
"\t\t- \"\"",
53+
"\timports:",
54+
"\t\t-",
55+
"\taddress:"
56+
]
57+
},
58+
59+
"timeperiod default template": {
60+
"prefix": "time",
61+
"body":["- timeperiod_object:",
62+
"\t\t-",
63+
"\tranges:",
64+
"\t\t-"
65+
]
66+
},
67+
68+
"service_group default template": {
69+
"prefix": "servicegroup",
70+
"body":["- servicegroup_object:",
71+
"\t\t- \"\"",
72+
"\tassign_filter:"
73+
]
74+
},
75+
76+
"service_apply default template": {
77+
"prefix": "service-apply",
78+
"body":["- service_apply_object:",
79+
"\t\t-",
80+
"\timports:",
81+
"\t\t-",
82+
"\tassign_filter: 'host.name=\"\"'",
83+
"\tvars:"
84+
]
85+
},
86+
87+
"service_template default template": {
88+
"prefix": "servicetemp",
89+
"body":["- service_template_object:",
90+
"\t\t- \"\"",
91+
"\tcheck_command: foo",
92+
"\tcheck_interval: 60",
93+
"\tretry_interval: 30",
94+
"\tuse_agent: true"
95+
]
96+
},
97+
98+
"command_template default template": {
99+
"prefix": "commandtemp",
100+
"body":["- command_template_object:",
101+
"\t\t- \"\"",
102+
"\targuments:",
103+
"\t\t\"-foo\":",
104+
"\t\t\trequired: false",
105+
"\t\t\tvalue: \"\\$foo$\"",
106+
"\tcommand: \"foo.sh\"",
107+
"\ttimeout: 60"
108+
]
109+
},
110+
111+
"command default template": {
112+
"prefix": "commandic",
113+
"body":["- command_object:",
114+
"\t\t- \"\"",
115+
"\tdisabled: false",
116+
"\tcommand_type: \"PluginCheck\"",
117+
"\timports:",
118+
"\t\t-"
119+
]
120+
}
121+
122+
}

0 commit comments

Comments
 (0)