aboutsummaryrefslogblamecommitdiffstatshomepage
path: root/roles/apt_repo/tasks/main.yml
blob: 8cee575c6ad107e3fc2de093a32f6b88b67335c4 (plain) (tree)
1
2
3
4
5
6
7
8




                              
                             
              




                                   
 







                                      
 
                        

                            
 










                                                                       
 
                                             
- name: Enable HTTPS transport
  become: true
  ansible.builtin.package:
    name: apt-transport-https
    state: present

- name: Create keys directory
  become: true
  ansible.builtin.file:
    path: '{{ apt_repo_keys_dir }}'
    state: directory
    owner: root
    group: root
    mode: '755'

- name: 'Add key: {{ apt_repo_name }}'
  become: true
  ansible.builtin.get_url:
    url: '{{ apt_repo_key_url }}'
    dest: '{{ apt_repo_key_path }}'
    owner: root
    group: root
    mode: '644'
  notify: apt_repo_update

- name: Get host distro
  ansible.builtin.setup:
    gather_subset:
      - distribution
      - distribution_release

# Not using the apt_repository module, since it _adds_ a new repository
# in the .list file. That way, we can end up with an invalid repository
# line.
- name: 'Add repository: {{ apt_repo_name }}'
  become: true
  ansible.builtin.template:
    src: repo.list.j2
    dest: '/etc/apt/sources.list.d/{{ apt_repo_name }}.list'
    owner: root
    group: root
    mode: '644'
  notify: apt_repo_update

- name: Refresh apt repositories if necessary
  ansible.builtin.meta: flush_handlers