debops / ansible-apt

Configure and manage APT Package Manager
GNU General Public License v3.0
10 stars 15 forks source link

Trigger an update after custom APT repositories adding. #62

Closed azman0101 closed 8 years ago

azman0101 commented 8 years ago

Hi,

As I understand, "Update package lists" is executed only if the main source.list is altered (Configure main APT package sources) or if early update plays.

So, may I know how to trigger an "apt-get update" after adding of "custom APT repositories" (Configure custom APT repositories) ?

apt


- name: Configure custom APT repositories
  apt_repository:
    repo: '{{ item.repo }}'
    state: '{{ item.state | default("present") }}'
    update_cache: False
  with_items: '{{ apt__repositories_combined }}'
  when: ((item.repo is defined and item.repo) and
         (item.state is undefined or item.state is defined))

- name: Configure main APT package sources
  template:
    src: 'etc/apt/sources.list.j2'
    dest: '/etc/apt/sources.list'
    owner: 'root'
    group: 'root'
    mode: '0644'
  register: apt__register_sources_list
  when: apt__sources_combined
- name: Update package lists
  apt:
    update_cache: True
    cache_valid_time: '{{ omit if (apt__register_sources_list|changed) else apt__update_cache_early }}'
le9i0nx commented 8 years ago

73