roles
This commit is contained in:
16
02_roles.yml
Normal file
16
02_roles.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
- name: Webserver Role
|
||||
hosts: linuxservers
|
||||
become: true
|
||||
|
||||
roles:
|
||||
- webserver
|
||||
|
||||
tasks:
|
||||
- name: Copy Index.php
|
||||
ansible.builtin.copy:
|
||||
src: index.php
|
||||
dest: /var/www/html/index.php
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
4
index.php
Normal file
4
index.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?PHP
|
||||
echo "Welcome to your new webserver: ";
|
||||
echo gethostname();
|
||||
?>
|
||||
@@ -1,2 +1,9 @@
|
||||
---
|
||||
# defaults file for webserver
|
||||
package:
|
||||
- httpd
|
||||
- mod_ssl
|
||||
- openssl
|
||||
- php
|
||||
- php-gd
|
||||
- php-mbstring
|
||||
|
||||
@@ -1,2 +1,11 @@
|
||||
---
|
||||
# handlers file for webserver
|
||||
- name: Firewall reload
|
||||
ansible.builtin.systemd:
|
||||
name: firewalld
|
||||
state: reloaded
|
||||
|
||||
- name: Httpd restart
|
||||
ansible.builtin.systemd:
|
||||
name: httpd
|
||||
state: restarted
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your role description
|
||||
company: your company (optional)
|
||||
author: Alex
|
||||
description: a role for installing a webserver
|
||||
company: UFST
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
@@ -14,9 +14,9 @@ galaxy_info:
|
||||
# - GPL-3.0-only
|
||||
# - Apache-2.0
|
||||
# - CC-BY-4.0
|
||||
license: license (GPL-2.0-or-later, MIT, etc)
|
||||
license: BSD-3-Clause
|
||||
|
||||
min_ansible_version: 2.1
|
||||
min_ansible_version: "2.1"
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
@@ -38,6 +38,10 @@ galaxy_info:
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- "8"
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
|
||||
@@ -1,2 +1,21 @@
|
||||
---
|
||||
# tasks file for webserver
|
||||
- name: Install Packages
|
||||
ansible.builtin.package:
|
||||
name: "{{ package }}"
|
||||
state: present
|
||||
notify: Httpd restart
|
||||
|
||||
- name: Enable httpd service
|
||||
ansible.builtin.systemd:
|
||||
name: httpd
|
||||
state: started
|
||||
enabled: true
|
||||
|
||||
- name: Configure firewall
|
||||
ansible.posix.firewalld:
|
||||
zone: public
|
||||
service: http
|
||||
permanent: true
|
||||
state: enabled
|
||||
notify: Firewall reload
|
||||
|
||||
Reference in New Issue
Block a user