Feat: migrate from with_X to loop

Signed-off-by: Hadrien Patte <hadrien.patte@protonmail.com>
This commit is contained in:
Hadrien Patte 2019-03-23 19:49:13 +01:00
parent c20d4fbf18
commit 66f7b1061a
No known key found for this signature in database
GPG Key ID: 0954F2874A54F4B1
4 changed files with 16 additions and 16 deletions

View File

@ -61,8 +61,8 @@
# User skeleton
- name: Configure user skeleton
copy:
src: skel/{{ item.key }}
dest: /etc/skel/{{ item.value }}
with_dict:
dot_zshrc: .zshrc
dot_zshrc.local: .zshrc.local
src: skel/dot_{{ item.key }}
dest: /etc/skel/.{{ item.value }}
loop:
- zshrc
- zshrc.local

View File

@ -32,11 +32,11 @@
- name: Configure NSS to use LDAP
lineinfile:
dest: /etc/nsswitch.conf
regexp: "^{{ item.key }}:"
line: "{{ item.value }}"
with_dict:
passwd: 'passwd: files ldap'
group: 'group: files ldap'
shadow: 'shadow: files ldap'
sudoers: 'sudoers: files ldap'
regexp: "^{{ item }}:"
line: "{{ item }}: files ldap"
loop:
- passwd
- group
- shadow
- sudoers
notify: Restart nslcd service

View File

@ -5,7 +5,7 @@
src: "{{ item }}.j2"
dest: /usr/local/bin/{{ item }}
mode: 0755
with_items:
loop:
- chsh
- passwd

View File

@ -31,7 +31,7 @@
file:
path: "{{ item }}"
state: absent
with_items:
loop:
- /etc/ldap/slapd.d
- /var/lib/ldap
@ -40,7 +40,7 @@
file:
path: "{{ item }}"
state: directory
with_items:
loop:
- /etc/ldap/slapd.d
- /var/lib/ldap
@ -56,7 +56,7 @@
owner: openldap
group: openldap
recurse: true
with_items:
loop:
- /var/lib/ldap
- /etc/ldap/slapd.d