Created
February 4, 2020 12:23
-
-
Save dreamuth/1cc3a219a6a58992ed252172a12b172c to your computer and use it in GitHub Desktop.
Deploy httpd
This file contains 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: Revert web server | |
hosts: ansible2 | |
tasks: | |
- name: Stop httpd service | |
service: | |
name: httpd | |
state: stopped | |
become: yes | |
- name: Remove http package | |
package: | |
name: httpd | |
state: absent | |
become: yes | |
- name: Remove file | |
file: | |
path: "/var/www/html/index.html" | |
state: absent | |
become: yes |
This file contains 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: deploy web server | |
hosts: ansible2 | |
tasks: | |
- name: install http package | |
package: | |
name: httpd | |
state: present | |
become: yes | |
- name: Allow firewall | |
firewalld: | |
service: http | |
permanent: yes | |
immediate: yes | |
state: enabled | |
become: yes | |
- name: Add Content | |
copy: | |
dest: "/var/www/html/index.html" | |
mode: 0777 | |
content: | | |
<h1>Ansible Testing</h1> | |
Sample | |
become: yes | |
- name: Start httpd service | |
service: | |
name: httpd | |
state: started | |
become: yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment