From 8ecccc67daf90045f9e0da9ac73e9eef8ce3b84c Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Mon, 12 Aug 2019 10:48:40 +0200 Subject: apt-repos: Supporting custom filenames. Useful if the package also delivers a sources.list file. --- ansible/all.yml | 6 ++---- ansible/group_vars/workstation/apt-repos.yml | 1 + ansible/plays/apt-repos.yml | 6 ++++++ ansible/roles/apt-repos/tasks/repo.yml | 3 +++ 4 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 ansible/plays/apt-repos.yml diff --git a/ansible/all.yml b/ansible/all.yml index 05502bf..e4b4550 100644 --- a/ansible/all.yml +++ b/ansible/all.yml @@ -7,10 +7,8 @@ tags: packages become: yes - trygvis-base - - role: apt-repos - tags: apt-repos - become: yes -# - ufw + +- import_playbook: plays/apt-repos.yml - hosts: - knot diff --git a/ansible/group_vars/workstation/apt-repos.yml b/ansible/group_vars/workstation/apt-repos.yml index dcdca16..b5df581 100644 --- a/ansible/group_vars/workstation/apt-repos.yml +++ b/ansible/group_vars/workstation/apt-repos.yml @@ -116,3 +116,4 @@ apt_repos: sections: main key_id: ACCC4CF8 keyserver: hkp://keyserver.ubuntu.com:80 + filename: apt_postgresql_org_pub_repos_apt.list diff --git a/ansible/plays/apt-repos.yml b/ansible/plays/apt-repos.yml new file mode 100644 index 0000000..7a9156c --- /dev/null +++ b/ansible/plays/apt-repos.yml @@ -0,0 +1,6 @@ +- hosts: + - all + roles: + - role: apt-repos + tags: apt-repos + become: yes diff --git a/ansible/roles/apt-repos/tasks/repo.yml b/ansible/roles/apt-repos/tasks/repo.yml index 135aeac..3ed3632 100644 --- a/ansible/roles/apt-repos/tasks/repo.yml +++ b/ansible/roles/apt-repos/tasks/repo.yml @@ -14,6 +14,9 @@ - name: "add repo {{ item.key }}" when: item.value.url is defined and state == "present" + vars: + filename: "{{ item.filename | default(item.key) }}" +# filename: "{{ item.filename if item.filename is defined else item.key }}" copy: dest: "/etc/apt/sources.list.d/{{ item.key }}.list" content: | -- cgit v1.2.3