From 66f7b1061a9ed5b0f3bbfcb847bc86444c73d35b Mon Sep 17 00:00:00 2001 From: Hadrien Patte Date: Sat, 23 Mar 2019 19:49:13 +0100 Subject: [PATCH] Feat: migrate from with_X to loop Signed-off-by: Hadrien Patte --- roles/baseconfig/tasks/main.yml | 10 +++++----- roles/ldap-client/tasks/0_install_ldap.yml | 14 +++++++------- roles/ldap-client/tasks/2_userland_scripts.yml | 2 +- roles/ldap-replica/tasks/main.yml | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/roles/baseconfig/tasks/main.yml b/roles/baseconfig/tasks/main.yml index 59cd77b..c3d548e 100644 --- a/roles/baseconfig/tasks/main.yml +++ b/roles/baseconfig/tasks/main.yml @@ -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 diff --git a/roles/ldap-client/tasks/0_install_ldap.yml b/roles/ldap-client/tasks/0_install_ldap.yml index 31665cc..d21bbb9 100644 --- a/roles/ldap-client/tasks/0_install_ldap.yml +++ b/roles/ldap-client/tasks/0_install_ldap.yml @@ -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 diff --git a/roles/ldap-client/tasks/2_userland_scripts.yml b/roles/ldap-client/tasks/2_userland_scripts.yml index 4799765..fa41780 100644 --- a/roles/ldap-client/tasks/2_userland_scripts.yml +++ b/roles/ldap-client/tasks/2_userland_scripts.yml @@ -5,7 +5,7 @@ src: "{{ item }}.j2" dest: /usr/local/bin/{{ item }} mode: 0755 - with_items: + loop: - chsh - passwd diff --git a/roles/ldap-replica/tasks/main.yml b/roles/ldap-replica/tasks/main.yml index ce19bdb..914ce4e 100644 --- a/roles/ldap-replica/tasks/main.yml +++ b/roles/ldap-replica/tasks/main.yml @@ -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