728x90
host server의 config file 변경
- host server의 config 파일을 수정하는 playbook
---
- hosts: all
become: true
tasks:
- stat:
path: /tmp/local_test2.repo
register: result
- name: move old file
command: mv /tmp/local_test2.repo /tmp/local_test2_old.repo
when:
- result.stat.exists
- name: make local.repo file
file:
path: /tmp/local_test2.repo
state: touch
- name: modify line
blockinfile:
path: /tmp/local_test2.repo
block: |
[test_repo]
name=test_repo
baseurl=http://www.test_repo_url.com
gpgcheck=0
enabled=1
Ansible Playbook 예제 시리즈
2022.08.17 - [Dev/Linux] - [Ansible] Ansible playbook example - 1
2022.08.18 - [Dev/Linux] - [Ansible] Ansible playbook example - 2
2022.08.19 - [Dev/Linux] - [Ansible] Ansible playbook example - 3
728x90
'Dev > Linux' 카테고리의 다른 글
[Ansible] Ansible playbook example - 3 (0) | 2022.08.19 |
---|---|
[Ansible] Ansible playbook example - 2 (0) | 2022.08.18 |
[Linux] traceroute (0) | 2022.08.15 |
[Ansible] Include (0) | 2022.08.11 |
[Ansible] Module (0) | 2022.08.10 |
댓글