Skip to content

Commit

Permalink
[#188360028] Minimize role
Browse files Browse the repository at this point in the history
  • Loading branch information
eifelmicha committed Oct 8, 2024
1 parent ffe4b98 commit 4d44500
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 46 deletions.
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ _ops_tools:
# suites: stable
# components: main
# signed_by: https://artifacts.elastic.co/GPG-KEY-elasticsearch
tools:
packages:
- iotop
- sysstat
- sysdig
Expand Down
48 changes: 3 additions & 45 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# vim: ft=ansible et ts=2
---
# tasks file for ops_tools

- name: Add Repository Credentials
ansible.builtin.copy:
content: "machine {{ item.machine }} login {{ item.login }} password {{ item.password }}"
Expand All @@ -13,42 +11,6 @@
with_items: "{{ _ops_tools.credentials | default([]) }}"
register: new_credentials

- name: Add Repository Key by URL
ansible.builtin.apt_key:
url: "{{ item.key_url }}"
id: "{{ item.key_id | default(omit) }}"
state: present
when: item.key_url is defined
with_items: "{{ _ops_tools.apt_repos | default([]) }}"
register: new_keys_by_url

- name: Add Repository Key by ID
ansible.builtin.apt_key:
id: "{{ item.key_id }}"
keyserver: "{{ item.key_server | default('keyserver.ubuntu.com') }}"
state: present
when: item.key_id is defined
with_items: "{{ _ops_tools.apt_repos | default([]) }}"
register: new_keys_by_id

- name: Add Repositories URL
ansible.builtin.apt_repository:
repo: "{{ item.repo_line }}"
state: present
update_cache: no
when: item.repo_line is defined
with_items: "{{ _ops_tools.apt_repos | default([]) }}"
register: new_repos

- name: Add Repositories PPA
ansible.builtin.apt_repository:
repo: "{{ item.ppa }}"
state: present
update_cache: no
when: item.ppa is defined
with_items: "{{ _ops_tools.apt_repos | default([]) }}"
register: new_ppas

- name: Add Deb822 Repo
ansible.builtin.deb822_repository:
name: "{{ item.name }}"
Expand All @@ -61,12 +23,8 @@
with_items: "{{ _ops_tools.deb822_repository | default([]) }}"
register: new_deb822

- name: Update APT Cache # noqa: no-handler
ansible.builtin.apt:
update_cache: yes
when: new_keys_by_url is changed or new_keys_by_id is changed or new_repos is changed or new_ppas is changed or new_deb822 is changed or new_credentials is changed

- name: Install Ops Tools
- name: Install Packages
ansible.builtin.apt:
state: present
name: "{{ _ops_tools.tools }}"
name: "{{ _ops_tools.packages }}"
update_cache: true

0 comments on commit 4d44500

Please sign in to comment.