From 2630e9dbc7fda5ec8c7882ac1915b233b28e58ed Mon Sep 17 00:00:00 2001 From: btatu Date: Thu, 6 Jul 2017 22:56:53 +0200 Subject: [PATCH] =?UTF-8?q?HOSTNAME=20ou=20$HOSTNAME=20=3F=20suppression?= =?UTF-8?q?=20ambigu=C3=AFt=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HowtoAnsible.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/HowtoAnsible.md b/HowtoAnsible.md index 2b566306..0b5e052d 100644 --- a/HowtoAnsible.md +++ b/HowtoAnsible.md @@ -47,7 +47,7 @@ ssh_args = -o ControlMaster=auto -o ControlPersist=300s pipelining = True ~~~ -Exemples d'utilisation basique : +Exemples d'utilisation basique sur sa machine en local : ~~~ $ ansible localhost -m ping @@ -55,14 +55,18 @@ localhost | SUCCESS => { "changed": false, "ping": "pong" } +~~~ -$ echo HOSTNAME >> ~/.ansible/hosts -$ ssh-copy-id HOSTNAME -$ ansible HOSTNAME -i $HOME/.ansible/hosts -m ping --one-line --forks 1 -HOSTNAME | SUCCESS => {"changed": false, "ping": "pong"} +Ou sur une machine distante : -$ ansible "HOST*" -m command --args "date" -HOSTNAME | SUCCESS | rc=0 >> +~~~ +$ echo mon-serveur >> ~/.ansible/hosts +$ ssh-copy-id mon-serveur +$ ansible mon-serveur -i $HOME/.ansible/hosts -m ping --one-line --forks 1 +mon-serveur | SUCCESS => {"changed": false, "ping": "pong"} + +$ ansible "mon-*" -m command --args "date" +mon-serveur | SUCCESS | rc=0 >> jeudi 26 mai 2016, 23:16:01 (UTC+0200) ~~~