la documentation des modules en ligne de commande notamment :
ansible-doc --list # ou -l
Linter des playbooks ansible
pip install ansible-lint
Démo ?
Utilisation d'inventaire en ligne de commande (comma separated host)
ansible-playbook -i 'localhost,' --connection=local [...]
Documentation sur les tags dans les playbooks
tasks:
- yum: name={{ item }} state=installed
with_items:
- httpd
- memcached
tags:
- packages
- template: src=templates/src.j2 dest=/etc/foo.conf
tags:
- configuration
ansible-playbook example.yml --tags "configuration,packages"
ansible-lint
Sur nos rôles, 60 warnings,
ANSIBLE0002 Trailing whitespace (56)
ANSIBLE0009 Octal file permissions must contain leading zero (2)
ANSIBLE0011 All tasks should be named (1)
ANSIBLE0013 Use shell only when shell functionality is required (1)
Sur les playbooks mco, 592 warnings,
ANSIBLE0002 Trailing whitespace
ANSIBLE0006 apt-get used in place of apt-get module
ANSIBLE0009 Octal file permissions must contain leading zero
ANSIBLE0010 Package installs should not use latest
ANSIBLE0011 All tasks should be named
ANSIBLE0012 Commands should not change things if nothing needs doing
ANSIBLE0013 Use shell only when shell functionality is required
ANSIBLE0015 Found a bare variable