[root@db04 ansible]# cat firewalld.yml
---
- host: db01
tasks:
- name: install firewalld
yum:
name: firewalld
state: present
- name: run firewalld
service:
name: firewalld
state: started
enabled: yes
- name: set firewalld rule.
firewalld:
port: 80/tcp
permanent: yes
state: enabled
[root@db04 ansible]#
[root@db04 ansible]# cat template.yml
---
- hosts: db01
tasks:
- name: use template copy index.html to webserver.
template:
src: ~/ansible/template/index.html
dest: /var/www/html/index.html
[root@db04 template]# pwd
/root/ansible/template
[root@db04 template]# cat index.html
welcome to {{ansible_hostname}}