From 4668506ec5b89d0bc845f1af1afb76915a5651ef Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Fri, 16 Jun 2023 00:32:38 +0200 Subject: [PATCH] Aggiunta di qualche snippets per Ansible. --- vim/UltiSnips/yaml.snippets | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 vim/UltiSnips/yaml.snippets diff --git a/vim/UltiSnips/yaml.snippets b/vim/UltiSnips/yaml.snippets new file mode 100644 index 0000000..8864607 --- /dev/null +++ b/vim/UltiSnips/yaml.snippets @@ -0,0 +1,41 @@ +snippet mainrole "Snippet for the main file of a playbook." b +--- +# ${1:Description of the role} + +- name: Installation + ansible.builtin.import_tasks: install/main.yml + tags: + - ${2:basetag} + - $2-install + +- name: Configuration + ansible.builtin.import_tasks: config/main.yml + tags: + - $2 + - $2-config + +- name: Firewall configuration + ansible.builtin.import_tasks: firewall/main.yml + tags: + - $2 + - $2-firewall +$0 +endsnippet + +snippet playbook "Creates an empty playbook." b +--- +- hosts: all + roles: + - ${1:${VISUAL:rolename}}$0 + become: yes + become_user: root +endsnippet + +snippet shellpipe "Creates a task with module shell and which supports pipes." b +- name: ${1:${VISUAL:Title}} + ansible.builtin.shell: > + set -o pipefail; + $0 + args: + executable: /bin/bash +endsnippet