Skip to content

Commit

Permalink
Merge pull request #1 from AutomationWithAnsible/feature/non-interactive
Browse files Browse the repository at this point in the history
make sure shell commands are in non iteractive
  • Loading branch information
ahelal committed Jan 6, 2016
2 parents b794e9f + c61ec0d commit 20f7c23
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ apt_config :
"APT::Install-Suggests" : "no" # Install the "suggested" packages recommanded 'no'
"APT::Get::Show-Upgraded" : "yes" # Print out a list of all packages that are to be upgraded

apt_cloud_init_preserve_apt_list : false # if youru sing cloud init ant want to preserve_sources_list being overwritten

## *********** Unattended upgrade config ***********
unattended_install : false # Install unattended packages false or true (default not to install)
unattended_blacklist : [] # Array of packages not to be updated (set [ ] for empty list or [ "vim", "libc6" ])
Expand Down
10 changes: 10 additions & 0 deletions tasks/apt.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
---

- name: APT | Configure cloud init to preserve source list
copy:
'content="apt_preserve_sources_list: true"
dest="/etc/cloud/cloud.cfg.d/91_apt_preserve"'
when: apt_cloud_init_preserve_apt_list

- name: APT | Ensure the "standard" sources list /etc/apt/sources.list is updated
copy:
src: sources_{{ ansible_distribution_release }}.list
Expand Down Expand Up @@ -34,13 +40,17 @@
- name: APT | Remove packages that are left over dependencies (no longer needed)
shell: apt-get -y autoremove
when: apt_autoremove
environment:
DEBIAN_FRONTEND: "noninteractive"
register: apt_autoremove_var
changed_when: "'Removing' in apt_autoremove_var.stdout"
ignore_errors: yes

- name: APT | Clear local repository of retrieved package files
shell: apt-get -y autoclean
when: apt_autoclean
environment:
DEBIAN_FRONTEND: "noninteractive"
register: apt_autoclean_var
changed_when: "'Del' in apt_autoclean_var.stdout"
ignore_errors: yes
Expand Down

0 comments on commit 20f7c23

Please sign in to comment.