728x90
Home directory 아래 폴더 생성
- Home directory 아래 폴더 ( tomcat, Jenkins, apps, logs (tomcat, apache) ) 를 생성하는 playbook
---
- name: makedir
hosts: all
become: true
tasks:
- name: make directory - basic
file:
owner: "{{ USER_NAME }}"
group: "{{ USER_GROUP }}"
path: "/home/{{ USER_NAME }}/{{ item }}"
state: directory
mode: 0755
with_items:
- jenkins
- tomcat
- apps
- log
- stat:
path: "/home/{{ USER_NAME }}/log"
register: result
- name: make directory - log
file:
owner: "{{ USER_NAME }}"
group: "{{ USER_GROUP }}"
path: "/home/{{ USER_NAME }}/log/{{ item }}"
state: directory
mode: 0755
with_items:
- tomcat
- apache
when:
- result.stat.exists == true
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' 카테고리의 다른 글
[Linux] Network commands - curl, wget (0) | 2022.08.25 |
---|---|
[Linux] soft link와 hard link의 차이점 (0) | 2022.08.23 |
[Ansible] Ansible playbook example - 2 (0) | 2022.08.18 |
[Ansible] Ansible playbook example - 1 (0) | 2022.08.17 |
[Linux] traceroute (0) | 2022.08.15 |
댓글