zerotao / ansible-packages

Ansible role to install packages

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

conditional on debconf-set-selections

jardleex opened this issue · comments

Hello @zerotao,

sorry to bother you again. In my tests I just did, I found a minor thing to improve. As it its only one line, may you add it directly?
It's again in apt.yml and adds the when: packages_accept. Background:
Without the conditional the empty template file will get placed by Ansible and apt | run debconf-set-selections will get executed afterwards. In my tests this altered the output of debconf-get-selections. As some users may not want this, the conditional checks if packages_accept is empty (default) or not (changed by user).

- name: apt | config debconf-set-selections
  template:
    src: debconf-set-selections.j2
    dest: /tmp/debconf-set-selections.conf
  when: packages_accept
  register: selections_status

Thank you

Jard

Good suggestion, I am still working back thru a lot of my ansible scripts to make them more idempotent and this helps a lot.