- uptime 확인하기
- 디스크 용량 확인하기
- 메모리 상태 확인하기
- 새로운 유저 만들기
- 파일 전송하기
- 서비스 설치
UPTIME 확인하기
[root@vm-ansible-server ~]# ansible all -m shell -a "uptime" -k SSH password: 10.0.0.6 | CHANGED | rc=0 >> 07:51:57 up 3:47, 1 user, load average: 0.11, 0.05, 0.06 10.0.0.5 | CHANGED | rc=0 >> 07:51:57 up 3:48, 1 user, load average: 0.00, 0.01, 0.05 10.0.0.7 | CHANGED | rc=0 >> 07:51:57 up 3:41, 1 user, load average: 0.00, 0.01, 0.05 [root@vm-ansible-server ~]#
디스크 용량 확인하기
[root@vm-ansible-server ~]# ansible all -m shell -a "df -h" -k SSH password: 10.0.0.7 | 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 10.0.0.6 | 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 10.0.0.5 | 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 [root@vm-ansible-server ~]#
메모리 상태 확인하기
[root@vm-ansible-server ~]# ansible all -m shell -a "free -h" -k SSH password: 10.0.0.6 | CHANGED | rc=0 >> total used free shared buff/cache available Mem: 1.9G 156M 1.5G 8.9M 224M 1.5G Swap: 0B 0B 0B 10.0.0.5 | CHANGED | rc=0 >> total used free shared buff/cache available Mem: 1.9G 154M 1.5G 8.9M 224M 1.5G Swap: 0B 0B 0B 10.0.0.7 | CHANGED | rc=0 >> total used free shared buff/cache available Mem: 1.9G 158M 1.5G 8.9M 223M 1.5G Swap: 0B 0B 0B [root@vm-ansible-server ~]#
새로운 유저 만들기
[root@vm-ansible-server ~]# ansible all -m user -a "name=bloter password=1234" -k SSH password: [WARNING]: The input password appears not to have been hashed. The 'password' argument must be encrypted for this module to work properly. 10.0.0.6 | CHANGED => { "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 } 10.0.0.7 | CHANGED => { "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 } 10.0.0.5 | CHANGED => { "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 } [root@vm-ansible-server ~]#
Add Comment