Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
title목차

Table of Contents

연결상태 확인 PING

Info

[devops@work-vm devops-lab]$ ansible web -m ping

Code Block
title처리 결과
linenumberstrue
web01-vm | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "ping": "pong"
}
web03-vm | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "ping": "pong"
}
web02-vm | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "ping": "pong"
}


디스크 용량 확인

Info
title디스크 용량 확인

[devops@work-vm devops-lab]$ ansible web -m shell -a "df -h"

Code Block
web01-vm | CHANGED | rc=0 >>
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        30G  1.2G   29G   5% /
devtmpfs        948M     0  948M   0% /dev
tmpfs           960M     0  960M   0% /dev/shm
tmpfs           960M  9.0M  951M   1% /run
tmpfs           960M     0  960M   0% /sys/fs/cgroup
/dev/sda1       497M   81M  417M  17% /boot
/dev/sdb1       3.9G   16M  3.7G   1% /mnt/resource
tmpfs           192M     0  192M   0% /run/user/1000

web03-vm | CHANGED | rc=0 >>
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        30G  1.2G   29G   5% /
devtmpfs        948M     0  948M   0% /dev
tmpfs           960M     0  960M   0% /dev/shm
tmpfs           960M  9.0M  951M   1% /run
tmpfs           960M     0  960M   0% /sys/fs/cgroup
/dev/sda1       497M   81M  417M  17% /boot
/dev/sdb1       3.9G   16M  3.7G   1% /mnt/resource
tmpfs           192M     0  192M   0% /run/user/1000

web02-vm | CHANGED | rc=0 >>
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        30G  1.2G   29G   5% /
devtmpfs        948M     0  948M   0% /dev
tmpfs           960M     0  960M   0% /dev/shm
tmpfs           960M  9.0M  951M   1% /run
tmpfs           960M     0  960M   0% /sys/fs/cgroup
/dev/sda1       497M   81M  417M  17% /boot
/dev/sdb1       3.9G   16M  3.7G   1% /mnt/resource
tmpfs           192M     0  192M   0% /run/user/1000


메모리 상태 확인

Info
title메모리 상태 확인

[devops@work-vm devops-lab]$ ansible web -m shell -a "free -h"

Code Block
web01-vm | CHANGED | rc=0 >>
              total        used        free      shared  buff/cache   available
Mem:           1.9G        155M        1.5G        8.9M        227M        1.5G
Swap:            0B          0B          0B

web03-vm | CHANGED | rc=0 >>
              total        used        free      shared  buff/cache   available
Mem:           1.9G        158M        1.5G        8.9M        227M        1.5G
Swap:            0B          0B          0B

web02-vm | CHANGED | rc=0 >>
              total        used        free      shared  buff/cache   available
Mem:           1.9G        158M        1.5G        8.9M        230M        1.5G
Swap:            0B          0B          0B


신규 유저 추가

Info

[devops@work-vm devops-lab]$ ansible web -m user -a "name=bloter password=1qazxsw23edC"

Code Block
linenumberstrue
[WARNING]: The input password appears not to have been hashed. The 'password' argument must be encrypted for this module to work properly.

web01-vm | CHANGED => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": true,
    "comment": "",
    "create_home": true,
    "group": 1001,
    "home": "/home/bloter",
    "name": "bloter",
    "password": "NOT_LOGGING_PASSWORD",
    "shell": "/bin/bash",
    "state": "present",
    "system": false,
    "uid": 1001
}
web02-vm | CHANGED => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": true,
    "comment": "",
    "create_home": true,
    "group": 1001,
    "home": "/home/bloter",
    "name": "bloter",
    "password": "NOT_LOGGING_PASSWORD",
    "shell": "/bin/bash",
    "state": "present",
    "system": false,
    "uid": 1001
}
web03-vm | CHANGED => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": true,
    "comment": "",
    "create_home": true,
    "group": 1001,
    "home": "/home/bloter",
    "name": "bloter",
    "password": "NOT_LOGGING_PASSWORD",
    "shell": "/bin/bash",
    "state": "present",
    "system": false,
    "uid": 1001
}


Code Block
[devops@work-vm devops-lab]$ ansible web -m shell -a "cat /etc/passwd | grep bloter"
web01-vm | CHANGED | rc=0 >>
bloter:x:1001:1001::/home/bloter:/bin/bash

web02-vm | CHANGED | rc=0 >>
bloter:x:1001:1001::/home/bloter:/bin/bash

web03-vm | CHANGED | rc=0 >>
bloter:x:1001:1001::/home/bloter:/bin/bash


...