From 1735ff1ffd5ccd8116919991d87801aee352c969 Mon Sep 17 00:00:00 2001 From: Adrien Waksberg Date: Wed, 15 Aug 2018 09:30:18 +0200 Subject: [PATCH] feat: no create usr in the role --- tasks/pools.yml | 19 ------------------- templates/pools.conf.j2 | 2 +- test/integration/phpfpm/default.yml | 7 +++++-- .../phpfpm/serverspec/phpfpm_spec.rb | 6 ------ 4 files changed, 6 insertions(+), 28 deletions(-) diff --git a/tasks/pools.yml b/tasks/pools.yml index eced0f8..763c34f 100644 --- a/tasks/pools.yml +++ b/tasks/pools.yml @@ -1,22 +1,3 @@ -- name: create user for php-fpm with a specify uid - user: - name: '{{ item.user }}' - group: '{{ item.group|default(phpfpm_group) }}' - uid: '{{ item.uid }}' - home: '{{ item.home }}' - with_items: '{{ phpfpm_pools }}' - when: item.uid is defined - tags: phpfpm - -- name: create user for php-fpm without a specify uid - user: - name: '{{ item.user }}' - group: '{{ item.group|default(phpfpm_group) }}' - home: '{{ item.home }}' - with_items: '{{ phpfpm_pools }}' - when: not item.uid is defined - tags: phpfpm - - name: set attributes on homes directories file: path: '{{ item.home }}' diff --git a/templates/pools.conf.j2 b/templates/pools.conf.j2 index fc4f0eb..771c732 100644 --- a/templates/pools.conf.j2 +++ b/templates/pools.conf.j2 @@ -4,7 +4,7 @@ [{{ pool.name }}] user = {{ pool.user }} -group = {{ pool.group|default(phpfpm_group) }} +group = users listen = /var/run/php{{ phpfpm_version }}-fpm-{{ pool.name }}.sock listen.owner = {{ pool.user }} diff --git a/test/integration/phpfpm/default.yml b/test/integration/phpfpm/default.yml index 49c7a9f..60eb9db 100644 --- a/test/integration/phpfpm/default.yml +++ b/test/integration/phpfpm/default.yml @@ -5,12 +5,15 @@ - name: website1 user: www home: /opt/www - uid: 1001 - name: website2 - user: website2 + user: www home: /opt/website2 pm: static pm_max_children: 4 + pre_tasks: + - user: + name: www + roles: - ansible-role-phpfpm diff --git a/test/integration/phpfpm/serverspec/phpfpm_spec.rb b/test/integration/phpfpm/serverspec/phpfpm_spec.rb index 3784a21..c57f615 100644 --- a/test/integration/phpfpm/serverspec/phpfpm_spec.rb +++ b/test/integration/phpfpm/serverspec/phpfpm_spec.rb @@ -19,12 +19,6 @@ puts '================================' end end -describe user('www') do - it { should exist } - it { should have_uid 1001 } - it { should belong_to_group 'www-data' } -end - describe file('/etc/logrotate.d/php7.0-fpm') do it { should be_file } it { should be_mode 644 }