---
- name: Sync Pacman
  become: true
  pacman:
    update_cache: yes

- name: Enable pacman.conf options
  become: true
  shell:
    sed -i '/Color$/s/^#//g' /etc/pacman.conf
    sed -i '/TotalDownload$/s/^#//g' /etc/pacman.conf
    sed -i '/CheckSpace$/s/^#//g' /etc/pacman.conf
    sed -i '/VerbosePkgLists$/s/^#//g' /etc/pacman.conf

- name: Install Pacman packages
  become: true
  shell:
    pacman -S $(< {{ playbook_dir }}/roles/archlinux/tasks/pkgs.pacman) \
    --noconfirm --needed

---
- name: Sync Pacman
  become: true
  pacman:
    update_cache: yes

- name: Install Pacman packages
  become: true
  shell:
    pacman -S $(< {{ playbook_dir }}/roles/archlinux/tasks/pkgs.pacman) \
    --noconfirm --needed

- name: Enable Pacman color in pacman.conf
  become: true
  lineinfile:
    dest: /etc/pacman.conf
    regexp: '^#Color$'
    line: 'Color'

- name: Enable Pacman Total download in pacman.conf
  become: true
  lineinfile:
    dest: /etc/pacman.conf
    regexp: '^#TotalDownload$'
    line: 'TotalDownload'

- name: Enable Pacman check space in pacman.conf
  become: true
  lineinfile:
    dest: /etc/pacman.conf
    regexp: '^#CheckSpace$'
    line: 'CheckSpace'

- name: Enable Pacman verbose pkg list in pacman.conf
  become: true
  lineinfile:
    dest: /etc/pacman.conf
    regexp: '^#VerbosePkgLists$'
    line: 'VerbosePkgLists'

Use lineinfile instead of sed
Chore/archlinux: Use lineinfile instead of sed
