Use yaml formatter to format ansible files (#7992)

The Ansible[1] extension define a new language for yaml files that describe
ansible playbooks and because of that is not possible use the prettier
extension with ansible files.

1 - https://marketplace.visualstudio.com/items?itemName=vscoss.vscode-ansible
This commit is contained in:
Robson Roberto Souza Peixoto authored and GitHub committed 2020-04-11 18:12:21 +03:00
1 parent b77e73a3c5
commit 5569e3306e
6 files changed
+95 -2

No files matched your search

+1
View File
@@ -6,6 +6,7 @@
"Amjad",
"Andrey",
"animationend",
"ansible",
"apos",
"aquibm",
"arduner",
+1 -1
View File
@@ -8,7 +8,7 @@ const languages = [
createLanguage(require("linguist-languages/data/YAML"), (data) => ({
since: "1.14.0",
parsers: ["yaml"],
vscodeLanguageIds: ["yaml"],
vscodeLanguageIds: ["yaml", "ansible"],
// yarn.lock is not YAML: https://github.com/yarnpkg/yarn/issues/5629
filenames: data.filenames.filter((filename) => filename !== "yarn.lock"),
})),
@@ -0,0 +1,65 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`playbook.yml format 1`] = `
====================================options=====================================
parsers: ["yaml"]
printWidth: 80
| printWidth
=====================================input======================================
---
- hosts: webservers
vars:
http_port: 80
max_clients: 200
remote_user: root
tasks:
- name: ensure apache is at the latest version
yum:
name: httpd
state: latest
- name: write the apache config file
template:
src: /srv/httpd.j2
dest: /etc/httpd.conf
notify:
- restart apache
- name: ensure apache is running
service:
name: httpd
state: started
handlers:
- name: restart apache
service:
name: httpd
state: restarted
=====================================output=====================================
---
- hosts: webservers
vars:
http_port: 80
max_clients: 200
remote_user: root
tasks:
- name: ensure apache is at the latest version
yum:
name: httpd
state: latest
- name: write the apache config file
template:
src: /srv/httpd.j2
dest: /etc/httpd.conf
notify:
- restart apache
- name: ensure apache is running
service:
name: httpd
state: started
handlers:
- name: restart apache
service:
name: httpd
state: restarted
================================================================================
`;
+1
View File
@@ -0,0 +1 @@
run_spec(__dirname, ["yaml"]);
+26
View File
@@ -0,0 +1,26 @@
---
- hosts: webservers
vars:
http_port: 80
max_clients: 200
remote_user: root
tasks:
- name: ensure apache is at the latest version
yum:
name: httpd
state: latest
- name: write the apache config file
template:
src: /srv/httpd.j2
dest: /etc/httpd.conf
notify:
- restart apache
- name: ensure apache is running
service:
name: httpd
state: started
handlers:
- name: restart apache
service:
name: httpd
state: restarted
@@ -684,7 +684,7 @@ exports[`CLI --support-info (stdout) 1`] = `
\\"since\\": \\"1.14.0\\",
\\"tmScope\\": \\"source.yaml\\",
\\"type\\": \\"data\\",
\\"vscodeLanguageIds\\": [\\"yaml\\"]
\\"vscodeLanguageIds\\": [\\"yaml\\", \\"ansible\\"]
}
],
\\"options\\": [