Login Logout

HowtoAnsible/Exemples

Exemples Ansible

Tester si une variable est vide

- debug:
    msg: "La variable n'a pas de description"
  when: var.description == none

Installer plusieurs paquets

- name: Install packages
  apt:
    name: '{{ item }}'
    state: present
  with_items:
  - vim
  - vim-doc

lien symbolique

- name: Create symlink foo -> bar
  file:
    src: "/usr/share/munin/plugins/bar"
    dest: "/etc/munin/plugins/foo"
    state: link

répertoire

- name: Create directory
  file:
    path: /foo/bar
    state: directory
    owner: root
    group: root
    mode: "0750"