Skip to content

Instantly share code, notes, and snippets.

@dreamuth
Created February 4, 2020 12:23
Show Gist options
  • Save dreamuth/1cc3a219a6a58992ed252172a12b172c to your computer and use it in GitHub Desktop.
Save dreamuth/1cc3a219a6a58992ed252172a12b172c to your computer and use it in GitHub Desktop.
Deploy httpd
---
- 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
---
- 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