今天学了不少ansible实验,摘抄一个自己创建角色apache的实验
ansible-galaxy init apache vim apache/tasks/main.yml --- - name: one yum: name: httpd state: latest - name: two service: name: httpd state: started enabled: yes - name: three firewalld: service: http permanent: yes state: enabled immediate: yes - name: four template: src: index.html.j2 dest: /var/www/html/index.html vim apache/templates/index.html.j2 Welcome to {{ ansible_fqdn }} on {{ ansible_default_ipv4.address }}