apply ansible-lint suggestions

Sun, 14 Jul 2019 02:56:26 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Sun, 14 Jul 2019 02:56:26 -0500
changeset 89
86248a83a3dd
parent 88
3dbfd253c775
child 90
48ec8001075f

apply ansible-lint suggestions

roles/devbox/tasks/dist-debian.yml file | annotate | diff | comparison | revisions
roles/devbox/tasks/dist-macosx.yml file | annotate | diff | comparison | revisions
roles/disable_stock_users/tasks/main.yml file | annotate | diff | comparison | revisions
roles/sudo/tasks/main.yml file | annotate | diff | comparison | revisions
roles/user/tasks/main.yml file | annotate | diff | comparison | revisions
--- a/roles/devbox/tasks/dist-debian.yml
+++ b/roles/devbox/tasks/dist-debian.yml
@@ -44,5 +44,5 @@
     dest: /etc/lightdm/lightdm.conf
     section: SeatDefaults
     option: user-session
-    value: "{{gui_session}}"
+    value: "{{ gui_session }}"
     backup: true
--- a/roles/devbox/tasks/dist-macosx.yml
+++ b/roles/devbox/tasks/dist-macosx.yml
@@ -6,7 +6,9 @@
 # - set macports in /etc/paths.d/ ?
 
 - name: Install base packages
-  macports: name={{item}} state=active
+  macports:
+    name: "{{ item }}"
+    state: active
   with_items:
     - zsh
     - MacVim
--- a/roles/disable_stock_users/tasks/main.yml
+++ b/roles/disable_stock_users/tasks/main.yml
@@ -1,6 +1,6 @@
 ---
 - name: "Disable stock users"
-  shell: usermod -e 1 {{item}}
+  shell: "usermod -e 1 {{ item }}"
   ignore_errors: true
   with_items:
     - pi
--- a/roles/sudo/tasks/main.yml
+++ b/roles/sudo/tasks/main.yml
@@ -1,8 +1,9 @@
 ---
 
-- package:
+- name: sudo package
+  package:
     name: sudo
-    state: latest
+    state: present
   tags: packages, install
 
 - name: sudo group
--- a/roles/user/tasks/main.yml
+++ b/roles/user/tasks/main.yml
@@ -2,8 +2,8 @@
 # Create/update my user, don't clobber my extra groups.
 - name: "User setup"
   user:
-    name: "{{user_name}}"
-    comment: "{{user_comment}}"
+    name: "{{ user_name }}"
+    comment: "{{ user_comment }}"
     shell: /bin/zsh
     groups: sudo
     append: true
@@ -13,46 +13,46 @@
 - name: "User authorized_keys"
   authorized_key:
     manage_dir: true
-    user: "{{user_name}}"
-    key: "{{item}}"
+    user: "{{ user_name }}"
+    key: "{{ item }}"
   with_file:
-    - public_keys/{{user_name}}
+    - public_keys/{{ user_name }}
   tags: user, ssh
 
 - name: "Clone dotfiles"
   become: true
-  become_user: "{{user_name}}"
+  become_user: "{{ user_name }}"
   shell: >
-    hg clone -U {{dotfiles_default | quote}} _dotfiles_
+    hg clone -U {{ dotfiles_default | quote }} _dotfiles_
     && mv _dotfiles_/.hg .
     && rmdir _dotfiles_
     && hg -R ~ update -C master
   args:
-    chdir: "{{user.home}}"
-    creates: "{{user.home}}/.hg"
+    chdir: "{{ user.home }}"
+    creates: "{{ user.home }}/.hg"
   tags: user, dotfiles
 
 - name: "Dotfiles hg sources"
   become: true
-  become_user: "{{user_name}}"
+  become_user: "{{ user_name }}"
   ini_file:
-    dest: "{{user.home}}/.hg/hgrc"
+    dest: "{{ user.home }}/.hg/hgrc"
     section: paths
-    option: "{{item.name}}"
-    value:  "{{item.url}}"
+    option: "{{ item.name }}"
+    value:  "{{ item.url }}"
     mode: 0640
     create: no
   with_items:
-    - {name: 'default',      url: "{{dotfiles_default}}"}
-    - {name: 'default-push', url: "{{dotfiles_default_push}}"}
+    - {name: 'default',      url: "{{ dotfiles_default }}"}
+    - {name: 'default-push', url: "{{ dotfiles_default_push }}"}
   tags: user, dotfiles
 
 - name: "Update dotfiles"
   become: true
-  become_user: "{{user_name}}"
+  become_user: "{{ user_name }}"
   command: hg pull -u
   args:
-    chdir: "{{user.home}}"
+    chdir: "{{ user.home }}"
   register: update_dotfiles
   changed_when: update_dotfiles.stdout | match("added|updated")
   failed_when: update_dotfiles.rc > 1
@@ -60,10 +60,10 @@
 
 - name: "Run bin/homedir-setup"
   become: true
-  become_user: "{{user_name}}"
+  become_user: "{{ user_name }}"
   shell: bin/homedir-setup
   args:
-    chdir: "{{user.home}}"
+    chdir: "{{ user.home }}"
   register: homedir_setup
   changed_when: homedir_setup.stdout | match("Updating|Cloning")
   failed_when: homedir_setup.rc != 0

mercurial