Created
November 21, 2019 16:44
-
-
Save rifkiaz/b2534fc8a3a35c4e3588c70cec11b332 to your computer and use it in GitHub Desktop.
Code for site.yml example site for Ansible
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: install and start httpd | |
hosts: web | |
tasks: | |
- name: install epel repo | |
yum: name=epel-release state=latest | |
- name: install python bindings for selinux | |
yum: name={{item}} state=latest | |
with_items: | |
- libselinux-python | |
- libsemanage-python | |
- name: test to see if selinux is running | |
command: getenforce | |
register: sestatus | |
changed_when: false | |
- name: install httpd | |
yum: name=httpd state=latest | |
notify: restart httpd | |
- name: start httpd service | |
service: name=httpd state=started enabled=yes | |
- name: copy index.html | |
template: src=index.html.j2 dest=/var/www/html/index.html | |
- name: install firewalld | |
yum: name=firewalld state=latest | |
- name: start firewalld service | |
service: name=firewalld state=started enabled=yes | |
- name: insert firewalld rule | |
firewalld: service=http permanent=true state=enabled immediate=yes | |
handlers: | |
- name: restart httpd | |
service: name=httpd state=restarted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment