Browse Source

HOSTNAME ou $HOSTNAME ? suppression ambiguïté

master
btatu 3 years ago
parent
commit
2630e9dbc7
1 changed files with 11 additions and 7 deletions
  1. +11
    -7
      HowtoAnsible.md

+ 11
- 7
HowtoAnsible.md View File

@ -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"
}
~~~
Ou sur une machine distante :
$ 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"}
~~~
$ 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 "HOST*" -m command --args "date"
HOSTNAME | SUCCESS | rc=0 >>
$ ansible "mon-*" -m command --args "date"
mon-serveur | SUCCESS | rc=0 >>
jeudi 26 mai 2016, 23:16:01 (UTC+0200)
~~~


Loading…
Cancel
Save