feat: no create usr in the role

This commit is contained in:
Adrien Waksberg 2018-08-15 09:30:18 +02:00
parent b3fd17bdf8
commit 1735ff1ffd
4 changed files with 6 additions and 28 deletions

View file

@ -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 }}'

View file

@ -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 }}

View file

@ -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

View file

@ -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 }