commit 692010702792b0ce865afce4e0b13c027c8b7984 Author: Thomas Constans Date: Tue Sep 22 15:42:05 2020 +0200 initial commit diff --git a/apache.yml b/apache.yml new file mode 100644 index 0000000..050b169 --- /dev/null +++ b/apache.yml @@ -0,0 +1,61 @@ +--- +- name: install apache via ansible playbook + hosts: test + user: ansible + become: true + handlers: + - name: reload httpd + service: + name: httpd + state: reloaded + + - name: reload firewalld + service: + name: firewalld + state: reloaded + + tasks: + - name: install apache + tags: httpd + yum: + name: httpd + state: latest + + - name: conf httpd + tags: httpd + notify: reload httpd + template: + src: vhost.conf + dest: /etc/httpd/conf.d/vhost.conf + mode: 0640 + owner: root + group: apache + + - name: activate apache + tags: httpd + service: + name: httpd + enabled: yes + + - name: open firewall port + tags: [firewall,httpd] + firewalld: + service: http + permanent: yes + immediate: yes + state: enabled + ignore_errors: yes + notify: reload firewalld + + - name: create documentroot + tags: httpd + file: + name: /var/www/html/orsys.fr + state: directory + + - name: create index file + tags: httpd + copy: + src: index.html + dest: /var/www/html/orsys.fr/index.html + mode: 0644 \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..9daeafb --- /dev/null +++ b/index.html @@ -0,0 +1 @@ +test diff --git a/vhost.conf b/vhost.conf new file mode 100644 index 0000000..b352f6d --- /dev/null +++ b/vhost.conf @@ -0,0 +1,17 @@ + + ServerName orsys.fr + ServerAlias www.orsys.fr + ServerAlias 100.0.0.100 + DocumentRoot /var/www/html/orsys.fr/ + CustomLog /var/log/httpd/orsys.fr_access.log combined + ErrorLog /var/log/httpd/orsys.fr_error.log + + Options none + Allowoverride none + Require all denied + + + + Require all granted + + \ No newline at end of file