ansible shell commands examples , pull docker images

ansible localhost -m shell -a "df -h"

localhost | SUCCESS | rc=0 >>
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   46G  5.0G   41G  11% /
devtmpfs                 895M     0  895M   0% /dev
tmpfs                    911M  132K  911M   1% /dev/shm
tmpfs                    911M   11M  901M   2% /run
tmpfs                    911M     0  911M   0% /sys/fs/cgroup
/dev/sda1               1014M  170M  845M  17% /boot
tmpfs                    183M  8.0K  183M   1% /run/user/42
tmpfs                    183M   48K  183M   1% /run/user/0

[root@localhost ~]# ansible localhost -m shell -a "docker ps"
localhost | SUCCESS | rc=0 >>
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

[root@localhost ~]# ansible localhost -m shell -a "docker pull busybox"
localhost | SUCCESS | rc=0 >>
Using default tag: latest
Trying to pull repository docker.io/library/busybox ... 
latest: Pulling from docker.io/library/busybox
ee153a04d683: Pulling fs layer
ee153a04d683: Verifying Checksum
ee153a04d683: Download complete
ee153a04d683: Pull complete
Digest: sha256:9f1003c480699be56815db0f8146ad2e22efea85129b5b5983d0e0fb52d9ab70
Status: Downloaded newer image for docker.io/busybox:latest

[root@localhost ~]# ansible localhost -m shell -a "docker ps"
localhost | SUCCESS | rc=0 >>
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

[root@localhost ~]# ansible localhost -m shell -a "docker images"
localhost | SUCCESS | rc=0 >>
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
docker.io/busybox   latest              db8ee88ad75f        4 weeks ago         1.22 MB

[root@localhost ~]# ansible localhost -m shell -a "docker pull centos"
localhost | SUCCESS | rc=0 >>
Using default tag: latest
Trying to pull repository docker.io/library/centos ...
latest: Pulling from docker.io/library/centos
d8d02d457314: Pulling fs layer
d8d02d457314: Verifying Checksum
d8d02d457314: Download complete
d8d02d457314: Pull complete
Digest: sha256:307835c385f656ec2e2fec602cf093224173c51119bbebd602c53c3653a3d6eb
Status: Downloaded newer image for docker.io/centos:latest

[root@localhost ~]# ansible localhost -m shell -a "docker images"
localhost | SUCCESS | rc=0 >>
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
docker.io/centos    latest              67fa590cfc1c        47 hours ago        202 MB
docker.io/busybox   latest              db8ee88ad75f        4 weeks ago         1.22 MB

Comments

Popular posts from this blog

ansible redhat cluster qorum qdevice

PE 3.9.0 on centos 6

gfs2 cluster