Add Suse support

- set proper package and service name apache2
- configure given packages for Suse
- install packages
- start service
This commit is contained in:
liquidat 2016-02-01 10:37:57 +01:00
parent 80d2a89369
commit 170a9c2446
4 changed files with 55 additions and 0 deletions

24
tasks/configure-Suse.yml Normal file
View file

@ -0,0 +1,24 @@
---
- name: Configure Apache.
lineinfile:
dest: "{{ apache_server_root }}/conf/{{ apache_daemon }}.conf"
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
state: present
with_items: apache_ports_configuration_items
notify: restart apache
- name: Check whether certificates defined in vhosts exist.
stat: path={{ item.certificate_file }}
register: apache_ssl_certificates
with_items: apache_vhosts_ssl
- name: Add apache vhosts configuration.
template:
src: "vhosts-{{ apache_vhosts_version }}.conf.j2"
dest: "{{ apache_conf_path }}/{{ apache_vhosts_filename }}"
owner: root
group: root
mode: 0644
notify: restart apache
when: apache_create_vhosts

View file

@ -12,6 +12,9 @@
- include: setup-RedHat.yml - include: setup-RedHat.yml
when: ansible_os_family == 'RedHat' when: ansible_os_family == 'RedHat'
- include: setup-Suse.yml
when: ansible_os_family == 'Suse'
- include: setup-Debian.yml - include: setup-Debian.yml
when: ansible_os_family == 'Debian' when: ansible_os_family == 'Debian'
@ -39,6 +42,9 @@
- include: configure-RedHat.yml - include: configure-RedHat.yml
when: ansible_os_family == 'RedHat' when: ansible_os_family == 'RedHat'
- include: configure-Suse.yml
when: ansible_os_family == 'Suse'
- include: configure-Debian.yml - include: configure-Debian.yml
when: ansible_os_family == 'Debian' when: ansible_os_family == 'Debian'

6
tasks/setup-Suse.yml Normal file
View file

@ -0,0 +1,6 @@
---
- name: Ensure Apache is installed.
zypper:
name: "{{ item }}"
state: installed
with_items: apache_packages

19
vars/Suse.yml Normal file
View file

@ -0,0 +1,19 @@
---
apache_service: apache2
apache_daemon: apache2
apache_daemon_path: /usr/sbin/
apache_server_root: /etc/apache2
apache_conf_path: /etc/apache2/conf.d
apache_vhosts_version: "2.2"
__apache_packages:
- apache2
- apache2-devel
- openssh
apache_ports_configuration_items:
- regexp: "^Listen "
line: "Listen {{ apache_listen_port }}"
- regexp: "^#?NameVirtualHost "
line: "NameVirtualHost *:{{ apache_listen_port }}"