给我编写一个ansible的role示例,把代码整理好
时间: 2023-03-13 20:17:20 浏览: 134
ansible-role-eclipse:安装 eclipse 的 Ansible 角色
我可以帮你编写一个ansible role示例,下面是代码:---
- name: Ansible role example
hosts: all
tasks:
- name: Install common packages
package:
name:
- vim
- tree
- git
- unzip
- curl
- wget
- name: Create a directory
file:
path: /tmp/ansible
state: directory
owner: root
group: root
mode: 0775
- name: Copy files from src to dest
copy:
src: /src/files
dest: /tmp/ansible/
owner: root
group: root
mode: 0775
remote_src: yes
- name: Create a file
file:
path: /tmp/ansible/sample.txt
state: touch
owner: root
group: root
mode: 0644
阅读全文