--- - name: add repository key copy: src: repo.gpg dest: /etc/apt/keyrings/kubic-project.gpg register: apt_repo_kubic_project_key ## TODO: remove once all servers have been converted - name: remove repository key from old location file: path: /etc/apt/trusted.gpg.d/kubic-project.gpg state: absent - name: add repository entry copy: content: | deb [signed-by=/etc/apt/keyrings/kubic-project.gpg] http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/{{ (ansible_distribution == 'Ubuntu') | ternary('xUbuntu', ansible_distribution) }}_{{ ansible_distribution_version }}/ / dest: /etc/apt/sources.list.d/kubic-project.list register: apt_repo_kubic_project_sources - name: update apt cache when: apt_repo_kubic_project_key is changed or apt_repo_kubic_project_sources is changed command: apt-get update