ansible-ffibk/roles/packages/tasks/main.yml

60 lines
1.9 KiB
YAML
Raw Normal View History

---
# we don't want to disrupt servers where this role is manually maintained!
# thus: warning and block statement
- name: full-stop if package role is manually maintained on this server
debug: msg="package role skipped to not disrupt manual maintenance - set really_do to True to enable ansible control"
when: (not really_do is defined) or (not really_do)
# observe value of really_do
- block:
# ensure apt keys and apt repos if defined
- block:
- name: ensure defined apt keys
apt_key:
state: present
id: "{{pkg_item.id}}"
keyserver: "{{pkg_item.server}}"
with_items: "{{ (pkg_repo_list|default({})).repo_keys | default([]) }}"
loop_control:
loop_var: pkg_item
# see defaults in with - when: (pkg_repo_list is defined) and (pkg_repo_list.repo_keys is defined)
- name: ensure defined apt repos
apt_repository:
state: present
repo: "{{pkg_item.repo}}"
update_cache: "{{pkg_item.update_cache}}"
filename: freifunk
with_items: "{{ (pkg_repo_list|default({})).repos | default([]) }}"
loop_control:
loop_var: pkg_item
# see defaults in with - when: (pkg_repo_list is defined) and (pkg_repo_list.repos is defined)
# see defaults in with - when: pkg_repo_list is defined
# end block
- name: ensure defined apt packages
apt:
state: present
name: "{{mwu_m_item}}"
update_cache: yes
cache_valid_time: 21600
with_items: "{{meshing_pkg_pkg_list | default([])}}"
loop_control:
loop_var: mwu_m_item
# see default in with - when: meshing_pkg_pkg_list is defined
- name: ensure defined python libs
pip: name={{mwu_m_item}} executable=pip3
with_items: "{{meshing_pkg_pip_list | default([])}}"
loop_control:
loop_var: mwu_m_item
# see default in with - when: meshing_pkg_pip_list is defined
when: (really_do is defined) and (really_do)
# end block