ansible awx에서 windows 노드들에 수행할 playbook 예제
직접 테스트한 것만 올렸다.
아래 사이트를 참조하였다.
https://www.devopsschool.com/tutorial/ansible/ansible-windows-playbooks.html
계정 추가
---
- name: Add a user
hosts: all
gather_facts: false
tasks:
- name: Add User
win_user:
name: ansible
password: "Wlsldks123!"
state: present
hostname 변경
---
- hosts: all
tasks:
- name: Change the hostname to sample-hostname
win_hostname:
name: sample-hostname
register: res
- name: Reboot
win_reboot:
when: res.reboot_required
ping테스트
---
- hosts: all
tasks:
- name: Ping Windows Hosts
win_ping:
서비스 name은 아래와 같이 확인한다.
서비스 중단(Google Compute Engine)
---
- hosts: all
tasks:
- name: Stop service google commpute engine
win_service:
name: GCEAgent
state: stopped
서비스 시작(Google Compute Engine)
---
- hosts: all
tasks:
- name: Start service google commpute engine
win_service:
name: GCEAgent
state: started
반응형
'인프라 > 앤서블(Ansible)' 카테고리의 다른 글
ansible 에러 Failed to connect to the host via ssh: Permission denied (0) | 2022.05.03 |
---|---|
ansible awx 구축(cenot7 k8s) (0) | 2022.05.02 |
ansible awx windows playbook 생성 및 실행 (0) | 2022.05.01 |
ansible awx window node 설정 (0) | 2022.05.01 |
앤서블(ansible) 명령어 (0) | 2022.02.25 |
댓글