Initial commit

This commit is contained in:
2022-06-26 19:46:33 +02:00
commit 818d34657c
106 changed files with 1390 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
- name: Aktivera Apache i Debian
tags:
- apache
- systemd
systemd:
name: apache2
enabled: yes
state: started
- name: Aktivera Apache i RedHat
tags:
- apache
- systemd
systemd:
name: httpd
enabled: yes
state: started

20
tasks/aktivera-apache.yml Normal file
View File

@@ -0,0 +1,20 @@
- name: Aktivera Apache i Debian
tags:
- apache
- systemd
when: ansible_os_family == 'Debian'
systemd:
name: apache2
enabled: yes
state: started
- name: Aktivera Apache i RedHat
tags:
- apache
- systemd
when: ansible_os_family == 'RedHat'
systemd:
name: httpd
enabled: yes
state: started

10
tasks/firewalld-http.yml Normal file
View File

@@ -0,0 +1,10 @@
- name: Öppna brandväggen i RedHat
tags:
- firewall
when: ansible_os_family == 'RedHat'
firewalld:
service: http
permanent: yes
immediate: yes
state: enabled

View File

@@ -0,0 +1,9 @@
- name: Öppna brandväggen i RedHat
tags:
- firewall
firewalld:
service: http
permanent: yes
immediate: yes
state: enabled

View File

@@ -0,0 +1,34 @@
- name: Installera Apache och PHP i Debian
tags:
- apache
- package
when: ansible_os_family == 'Debian'
apt:
update_cache: yes
name: "{{ item }}"
state: present
install_recommends: yes
with_items:
- apache2
- libapache2-mod-php
notify:
- Ta bort eventuell exempelsida
- Aktivera Apache i Debian
- name: Installera Apache och PHP i RedHat
tags:
- apache
- package
when: ansible_os_family == 'RedHat'
dnf:
name: "{{ item }}"
state: present
update_cache: yes
install_weak_deps: yes
with_items:
- httpd
- php
notify:
- Ta bort eventuell exempelsida
- Aktivera Apache i RedHat
- Öppna brandväggen i RedHat

View File

@@ -0,0 +1,28 @@
- name: Installera Apache och PHP i Debian
tags:
- apache
- package
when: ansible_os_family == 'Debian'
apt:
update_cache: yes
name: "{{ item }}"
state: present
install_recommends: yes
with_items:
- apache2
- libapache2-mod-php
- name: Installera Apache och PHP i RedHat
tags:
- apache
- package
when: ansible_os_family == 'RedHat'
dnf:
name: "{{ item }}"
state: present
update_cache: yes
install_weak_deps: yes
with_items:
- httpd
- php

View File

@@ -0,0 +1,8 @@
- name: Ta bort eventuell exempelsida
tags:
- index
- remove
file:
path: /var/www/html/index.html
state: absent

View File

@@ -0,0 +1,8 @@
- name: Kopiera PHP-filen till värdarna
tags:
- index
- copy
copy:
src: ../files/index.php
dest: /var/www/html/index.php

16
tasks/skapa-webbsida.yml Normal file
View File

@@ -0,0 +1,16 @@
- name: Ta bort eventuell exempelsida
tags:
- index
- remove
file:
path: /var/www/html/index.html
state: absent
- name: Kopiera PHP-filen till värdarna
tags:
- index
- copy
copy:
src: ../files/index.php
dest: /var/www/html/index.php

View File

@@ -0,0 +1,8 @@
- name: Anslut till webbservrarna
tags:
- connect
uri:
url: "http://{{ item }}"
with_items: "{{ groups[min_grupp] | map('extract', \
hostvars, ['ansible_host']) }}"