Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Ubuntu 16.04 test environment #77

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ env:
# version: 7
# init: /usr/lib/systemd/systemd
# run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
# - distribution: ubuntu
# version: 16.04
# init: /sbin/init
# run_opts: ""
- distribution: ubuntu
version: 16.04
init: /sbin/init
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro --volume=/sys/fs/cgroup/systemd:/sys/fs/cgroup/systemd:rw"
- distribution: ubuntu-upstart
version: 14.04
init: /sbin/init
Expand Down
4 changes: 2 additions & 2 deletions postgresql/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
postgresql_version: "9.3"

# table locale and character encoding
postgresql_locale: "en_US"
postgresql_locale: "C"
postgresql_encoding: "UTF-8"

# shell locale and character encoding
postgresql_shell_locale: "{{ postgresql_locale }}"
postgresql_shell_encoding: "{{ postgresql_encoding | replace('-', '') | lower }}"
postgresql_shell_encoding: "{{ postgresql_encoding }}"

# default application database
db_user: '' # name of the user (empty means no user is created)
Expand Down
3 changes: 3 additions & 0 deletions systemd/usermanager/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
# list of user names, that use systemd user manager
users: []
3 changes: 3 additions & 0 deletions systemd/usermanager/tasks/Debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- name: Debian | Install libpam for systemd
apt:
pkg: libpam-systemd
29 changes: 29 additions & 0 deletions systemd/usermanager/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
- include_tasks: Debian.yml
when: ansible_os_family == "Debian"


- name: Enable systemd User Manager
systemd:
name: user@{{ item }}
state: started
loop: "{{ users }}"


- command: systemctl status user@deploy
register: foo
failed_when: false
- debug: var=foo

- command: ps aux
register: psaux
- debug: var=psaux


- name: Check for systemd user session
shell: 'ps aux | grep "systemd --user" | grep -v grep'
register: bar
failed_when: bar.stdout == ""


- name: Print out result
debug: var=bar
19 changes: 13 additions & 6 deletions tests/itedd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@
# pool: 5

pre_tasks:
- file:
path: '/etc/locale.gen'
state: 'absent'
- shell: 'locale-gen "en_US.UTF-8"'
changed_when: no

- name: Create App User
user:
name: "{{ app_user }}"
shell: /bin/bash

roles:

- role: dresden-weekly.Rails/systemd/usermanager
users:
- "{{ app_user }}"
when: ansible_service_mgr == "systemd"

- dresden-weekly.Rails/postgresql

- dresden-weekly.Rails/ruby/rvm
Expand All @@ -76,6 +76,13 @@
- role: dresden-weekly.Rails/upstart/userjobs
users:
- "{{ app_user }}"
when: ansible_service_mgr == "upstart"

- role: dresden-weekly.Rails/systemd/usermanager
users:
- "{{ app_user }}"
when: ansible_service_mgr == "systemd"

- dresden-weekly.Rails/webrick/service
- dresden-weekly.Rails/nginx/server
- dresden-weekly.Rails/nginx/webrick
Expand Down
45 changes: 45 additions & 0 deletions webrick/service/tasks/systemd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,36 @@
become: yes
when: "{{ 'Failed' in systemd_linger_enabled_test.stderr }}"



- name: ps aux
command: "ps aux"
register: psaux
- debug: var=psaux



- name: systemctl status
command: "systemctl status user@deploy"
register: systemctl
failed_when: false
- debug: var=systemctl

- become_user: "{{ webrick_user }}"
block:
- name: env
command: "env"
register: envc
- debug: var=envc


- command: "sudo -iu {{ webrick_user }} env"
register: envs
- debug: var=envs




- become_user: "{{ webrick_user }}"
block:
- name: "Systemd | Ensure complete .profile"
Expand All @@ -20,6 +50,13 @@
regexp: "^export XDG_RUNTIME_DIR="
line: "export XDG_RUNTIME_DIR=/run/user/`id -u`"

- become_user: "{{ webrick_user }}"
block:
- name: env
command: "env"
register: envc
- debug: var=envc

- name: Systemd | Ensure the user units folder exists
file:
path: "{{ webrick_systemd_user_units }}"
Expand All @@ -29,6 +66,14 @@
template:
dest: "{{ webrick_systemd_unit }}"
src: systemd.service.j2
failed_when: false

- name: Systemd | Enable unit at boot
shell: "/bin/bash -lc -- 'env'"
register: envb

- debug: var=envb


- name: Systemd | Enable unit at boot
shell: "/bin/bash -lc -- 'systemctl --user enable {{ webrick_service_name }}.service'"
Expand Down