일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- Linux
- archlinux
- libvirt
- ceph
- repository
- KVM
- HTML
- k8s
- terraform
- nfs-provisioner
- Kubeflow
- kolla
- awx
- golang
- grafana-loki
- port open
- kolla-ansible
- ubuntu
- ceph-ansible
- cephadm
- yum
- Docker
- Ansible
- OpenStack
- Arch
- Octavia
- Kubernetes
- i3
- cloud-init
- pacman
Archives
- Today
- Total
YJWANG
[Ansible] Hostname 변경 본문
inventory 파일 sample
[root@addon01_deploy_0 kubespray]# cat inventory/addon/inventory.ini
[all]
addon-master1 ansible_host=10.18.90.10 etcd_member_name=etcd1
addon-worker1 ansible_host=10.18.90.20 etcd_member_name=etcd2
addon-worker2 ansible_host=10.18.90.21 etcd_member_name=etcd3
ansible adhoc 실행
[root@addon01_deploy_0 kubespray]# ansible -m hostname -a 'name="{{ inventory_hostname }}"' -i inventory/addon/inventory.ini all
addon-worker2 | CHANGED => {
"ansible_facts": {
"ansible_domain": "",
"ansible_fqdn": "addon-worker2",
"ansible_hostname": "addon-worker2",
"ansible_nodename": "addon-worker2"
},
"changed": true,
"name": "addon-worker2"
}
addon-master1 | CHANGED => {
"ansible_facts": {
"ansible_domain": "",
"ansible_fqdn": "addon-master1",
"ansible_hostname": "addon-master1",
"ansible_nodename": "addon-master1"
},
"changed": true,
"name": "addon-master1"
}
addon-worker1 | CHANGED => {
"ansible_facts": {
"ansible_domain": "",
"ansible_fqdn": "addon-worker1",
"ansible_hostname": "addon-worker1",
"ansible_nodename": "addon-worker1"
},
"changed": true,
"name": "addon-worker1"
}
확인
[root@addon01_deploy_0 kubespray]# ansible -m shell -a 'hostname' -f 1 -i inventory/addon/inventory.ini all
addon-master1 | CHANGED | rc=0 >>
addon-master1
addon-worker1 | CHANGED | rc=0 >>
addon-worker1
addon-worker2 | CHANGED | rc=0 >>
addon-worker2
반응형