Skip to content

Instantly share code, notes, and snippets.

@lmazardo
Last active October 10, 2016 08:53
Show Gist options
  • Save lmazardo/08cd7e93237b5300f2122403e5a6eb46 to your computer and use it in GitHub Desktop.
Save lmazardo/08cd7e93237b5300f2122403e5a6eb46 to your computer and use it in GitHub Desktop.
ansible

ansible-doc

la documentation des modules en ligne de commande notamment :

ansible-doc --list # ou -l

ansible-lint

Linter des playbooks ansible

pip install ansible-lint

Démo ?

ansible-playbook

Utilisation d'inventaire en ligne de commande (comma separated host)

ansible-playbook -i 'localhost,' --connection=local [...]

Tags

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"
@lmazardo
Copy link
Author

ansible-doc

ansible-doc package

less 481 (PCRE regular expressions)
Copyright (C) 1984-2015  Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Homepage: http://www.greenwoodsoftware.com/less
> PACKAGE

  Installs, upgrade and removes packages using the underlying OS package manager.

Options (= is mandatory):

= name
        Package name, or package specifier with version, like `name-1.0'. Be aware that packages are not always named
        the same and this module will not 'translate' them per distro.

= state
        Whether to install (`present', `latest'), or remove (`absent') a package.

- use
        The required package manager module to use (yum, apt, etc). The default 'auto' will use existing facts or try
        to autodetect it. You should only use this field if the automatic selection is not working for some reason.
        [Default: auto]

Notes:  This module actually calls the pertinent package modules for each system (apt, yum, etc).

Requirements:  Whatever is required for the package plugins specific for each system.

EXAMPLES:
- name: install the latest version of ntpdate
  package: name=ntpdate state=latest

# This uses a variable as this changes per distribution.
- name: remove the apache package
  package : name={{apache}} state=absent


MAINTAINERS: Ansible Inc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment