Correctly set user to become

This commit is contained in:
Jake Howard 2018-09-14 09:01:11 +01:00
parent cfa484b8cb
commit 3cfb80a324
Signed by: jake
GPG key ID: 57AFB45680EDD477
3 changed files with 19 additions and 8 deletions

View file

@ -1,5 +1,7 @@
- hosts: local - hosts: local
connection: local connection: local
become: true
become_user: root
tasks: tasks:
- ping: - ping:
- include_vars: - include_vars:

View file

@ -2,7 +2,8 @@
name: aur_builder name: aur_builder
group: wheel group: wheel
- lineinfile: - name: sudoers file
lineinfile:
path: /etc/sudoers.d/11-install-aur_builder path: /etc/sudoers.d/11-install-aur_builder
line: 'aur_builder ALL=(ALL) NOPASSWD: /usr/bin/pacman' line: 'aur_builder ALL=(ALL) NOPASSWD: /usr/bin/pacman'
create: true create: true
@ -12,20 +13,23 @@
aur: aur:
skip_installed: true skip_installed: true
name: yay name: yay
become: aur_builder become: true
become_user: aur_builder
- name: "Upgrade system" - name: "Upgrade system"
aur: aur:
use: yay use: yay
upgrade: true upgrade: true
become: aur_builder become: true
become_user: aur_builder
- name: "Install initial packages" - name: "Install initial packages"
aur: aur:
use: yay use: yay
skip_installed: true skip_installed: true
name: "{{ item }}" name: "{{ item }}"
become: aur_builder become: true
become_user: aur_builder
with_items: with_items:
- 'i3-gaps' - 'i3-gaps'
- 'ttf-google-fonts-git' - 'ttf-google-fonts-git'
@ -36,7 +40,8 @@
use: yay use: yay
skip_installed: true skip_installed: true
name: "{{ item }}" name: "{{ item }}"
become: aur_builder become: true
become_user: aur_builder
with_items: with_items:
- 'acpi' - 'acpi'
- 'advanced-ssh-config' - 'advanced-ssh-config'

View file

@ -10,13 +10,17 @@
mode: 0644 mode: 0644
owner: jake owner: jake
- shell: "code --list-extensions" - name: "Get VSCode extensions"
shell: "code --list-extensions"
become: true
become_user: jake
register: vscode_extensions register: vscode_extensions
- name: "Install VSCode extensions" - name: "Install VSCode extensions"
shell: "code --install-extension {{ item }}" shell: "code --install-extension {{ item }}"
become: jake become: true
when: "item not in vscode_extensions" become_user: jake
when: "item not in vscode_extensions.stdout_lines"
with_items: with_items:
- 'PKief.material-icon-theme' - 'PKief.material-icon-theme'
- 'PeterJausovec.vscode-docker' - 'PeterJausovec.vscode-docker'