-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
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
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 |