Skip to content

Commit

Permalink
Split systemd and systemV to separate files
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerker Montelius committed Apr 20, 2017
1 parent f10ba87 commit c79e411
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 31 deletions.
42 changes: 11 additions & 31 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,20 @@
---
# tasks file for xvfb
- name: "Install Xvfb package"
apt: name=xvfb
state=installed
apt:
name: xvfb
state: installed

- name: "Create Xvfb deamon script"
template:
src=init-xvfb.j2
dest=/etc/init.d/xvfb
mode=755
when: ansible_distribution_version == "12.04"
- name: Install for systemV
include: systemv.yml
when: ansible_service_mgr != "systemd"

- name: "Create Xvfb deamon configuration"
template:
src=systemd-xvfb.j2
dest=/etc/systemd/system/xvfb.service
mode=755
when: ansible_distribution_version == "16.04"
- name: Install for systemd
include: systemd.yml
when: ansible_service_mgr == "systemd"

- name: "Configure display environment variable"
template:
src=profile-xvfb.sh.j2
dest=/etc/profile.d/xvfb.sh

- name: "Configure Xvfb automatic startup < 16.04"
service:
name=xvfb
pattern=/usr/bin/Xvfb
enabled=yes
state=started
when: "ansible_distribution_version | version_compare('16.04', '<') "

- name: "Configure Xvfb automatic startup >= 16.04"
service:
name=xvfb
enabled=yes
state=started
when: "ansible_distribution_version | version_compare('16.04', '>=') "
src: profile-xvfb.sh.j2
dest: /etc/profile.d/xvfb.sh

14 changes: 14 additions & 0 deletions tasks/systemd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: "systemd - Create Xvfb deamon configuration"
template:
src=systemd-xvfb.j2
dest=/etc/systemd/system/xvfb.service
mode=755

- name: "systemd - Configure Xvfb automatic startup >= 16.04"
service:
name=xvfb
enabled=yes
state=started


14 changes: 14 additions & 0 deletions tasks/systemv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: "systemv - Create Xvfb deamon script"
template:
src=init-xvfb.j2
dest=/etc/init.d/xvfb
mode=755

- name: "systemv - Configure Xvfb automatic startup < 16.04"
service:
name=xvfb
pattern=/usr/bin/Xvfb
enabled=yes
state=started

0 comments on commit c79e411

Please sign in to comment.