编写针对控制服务器的Ansible playbook。
代码示例:
---
- name: Control server playbook
hosts: control_server
tasks:
- name: Install necessary packages
apt:
name: "{{ item }}"
state: present
with_items:
- git
- vim
- curl
- name: Configure firewall
ufw:
rule: allow
name: ssh
state: enabled
- name: Copy configuration file
copy:
src: files/config.ini
dest: /etc/app/config.ini