Skip to content

Commit

Permalink
Create basic-web-server.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Renrut5 authored Mar 3, 2022
1 parent 92c073f commit 542fb36
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions basic-web-server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
# Playbook to install required services and configure
# a basic web server on a CentOS 7 server.

- name: ServicesVM Installation
hosts: localhost
ignore_errors: yes
remote_user: root
become: true
tasks:
- name: Update all packages (This may take a while)
yum:
name: "*"
state: latest
- name: Install basic services
yum:
name: "{{ item }}"
state: present
update_cache: true
loop:
- firewalld
- yum-utils
- net-tools
- samba
- openssh-server

- name: Install Web Services and Modules
yum:
name: "{{ item }}"
state: present
update_cache: true
loop:
- httpd
- php
- php-common
- php-opcache
- php-mcrypt
- php-cli
- php-gd
- php-curl
- php-mysqlnd

- name: Open firewall ports
firewalld:
service: "{{ item }}"
permanent: true
state: enabled
loop:
- http
- https

- name: Reload firewall service to enable changes
systemd:
name: firewalld
state: reloaded

- name: Ensure web services are started or restarted
ansible.builtin.systemd:
name: "{{ item }}"
state: restarted
loop:
- httpd

0 comments on commit 542fb36

Please sign in to comment.