1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_packages.git synced 2024-08-16 10:19:51 +02:00

Starting rewrite...

Cleanup and refactor...
This commit is contained in:
L3D 2023-07-26 23:17:15 +02:00
parent b0c817c681
commit bc965e18e5
Signed by: l3d
GPG key ID: CD08445BFF4313D1
7 changed files with 75 additions and 101 deletions

View file

@ -1,8 +1,11 @@
[![MIT License](https://raw.githubusercontent.com/roles-ansible/ansible_role_base/master/.github/license.svg?sanitize=true)](https://github.com/roles-ansible/ansible_role_base/blob/master/LICENSE) | [![Ansible Lint check](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-linting-check.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-linting-check.yml) | [![Galaxy release](https://github.com/roles-ansible/ansible_role_base/actions/workflows/galaxy.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions/workflows/galaxy.yml)
Ansible Role to install packages
---------------------
```
WARNING: REWRITE
```
A base ansible role that should run on common Linux systems.
This role adds more package sources to Debian. And installs some useful tools. This role adds more package sources to Debian. And installs some useful tools. The complete list of tools to install can be found in the [vars/main.yml](https://github.com/roles-ansible/ansible_role_base/blob/master/vars/main.yml).
@ -53,33 +56,3 @@ base__install_vim: true
# perform a simple versions check (true is recomended)
submodules_versioncheck: false
```
### testing
This role is tested with [these github-action](https://github.com/search?q=topic%3Acheck-ansible+topic%3Agithub-actions+org%3Aroles-ansible&type=Repositories) tests for different versions of differen linux systems.
If you want to find out more about our tests, please have a look at the github marketplace.
| test status | Github Marketplace |
| :--------- | :---------------- |
| [![Galaxy release](https://github.com/roles-ansible/ansible_role_base/actions/workflows/galaxy.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions/workflows/galaxy.yml) | [publish-ansible-role-to-galaxy](https://github.com/marketplace/actions/publish-ansible-role-to-galaxy) |
| [![Yamllint GitHub Actions](https://github.com/roles-ansible/ansible_role_base/actions/workflows/yamllint.yaml/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions/workflows/yamllint.yaml) | [yamllint-github-action](https://github.com/marketplace/actions/yamllint-github-action) |
| [![Ansible Lint check](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-linting-check.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-linting-check.yml) | [ansible-lint action](https://github.com/marketplace/actions/ansible-lint)
| [![Ansible check debian:latest](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-debian-latest.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-debian-latest.yml) | [ansible test with debian stable](https://github.com/marketplace/actions/check-ansible-debian-stable) |
| [![Ansible check debian:latest](https://github.com/roles-ansible/ansible_role_base/workflows/Ansible%20check%20debian:latest/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions?query=workflow%3A%22Ansible+check+debian%3Alatest%22) | [ansible test with debian latest](https://github.com/marketplace/actions/check-ansible-debian-latest) |
| [![Ansible check debian:sid](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-debian-sid.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-debian-sid.yml) | [ansible test with debian sid](https://github.com/marketplace/actions/check-ansible-debian-sid) |
| [![Ansible check debian:stable](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-debian-stable.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-debian-stable.yml) | [ansible test with debian stable](https://github.com/marketplace/actions/check-ansible-debian-stable) |
| [![Ansible check debian:buster](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-debian-buster.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-debian-buster.yml) | [ansible test with debian buster](https://github.com/marketplace/actions/check-ansible-debian-buster) |
| | |
| [![Ansible check archlinux:latest](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-archlinux-latest.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-archlinux-latest.yml) | [ansible test with archlinux latest](https://github.com/marketplace/actions/check-ansible-archlinux-latest) |
| | |
| [![Ansible check ubuntu:latest](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-ubuntu-latest.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-ubuntu-latest.yml) | [ansible test with ubuntu latest](https://github.com/marketplace/actions/check-ansible-ubuntu-latest) |
| [![Ansible check ubuntu:bionic](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-ubuntu-bionic.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-ubuntu-bionic.yml) | [ansible test with ubuntu bionic](https://github.com/marketplace/actions/check-ansible-ubuntu-bionic) |
| [![Ansible check ubuntu:trusty](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-ubuntu-trusty.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-ubuntu-trusty.yml) | [ansible test with ubuntu trusty](https://github.com/marketplace/actions/check-ansible-ubuntu-trusty) |
| | |
| [![Ansible check fedora:latest](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-fedora-latest.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-fedora-latest.yml) | [ansible test with fedora latest](https://github.com/marketplace/actions/check-ansible-fedora-latest) |
| [![Ansible check fedora:33](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-fedora-33.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-fedora-33.yml) | [ansible test with fedora 33](https://github.com/marketplace/actions/check-ansible-fedora-33) |
| [![Ansible check fedora:32](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-fedora-32.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-fedora-32.yml) | [ansible test with fedora 32](https://github.com/marketplace/actions/check-ansible-fedora-32) |
| [![Ansible check fedora:31](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-fedora-31.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-fedora-31.yml) | [ansible test with fedora 31](https://github.com/marketplace/actions/check-ansible-fedora-31) |
| | |
| [![Ansible check centos:latest](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-centos-latest.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-centos-latest.yml) | [ansible test with centos latest](https://github.com/marketplace/actions/check-ansible-centos-latest) |
| [![Ansible check centos:centos8](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-centos-centos8.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-centos-centos8.yml) | [ansible test with centos centos8](https://github.com/marketplace/actions/check-ansible-centos-centos8) |
| [![Ansible check centos:centos7](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-centos-centos7.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_base/actions/workflows/ansible-centos-centos7.yml) | [ansible test with centos centos7](https://github.com/marketplace/actions/check-ansible-centos-centos7) |

View file

@ -4,7 +4,7 @@ galaxy_info:
description: Ansible role to install some base packages and make some base configuration on all common linux systems
role_name: base
license: MIT
min_ansible_version: "2.11"
min_ansible_version: "2.12"
platforms:
- name: ArchLinux
versions: ['all']

View file

@ -1,21 +1,20 @@
---
- name: Optional print os infos
- name: Show Information about target OS (on verbose)
ansible.builtin.include_tasks: os_info.yml
when: print_os_vars | bool
- name: Optional versionscheck
- name: Run simple versionscheck (optional)
ansible.builtin.include_tasks: versioncheck.yml
when: submodules_versioncheck | bool
- name: Optional add apt sources
ansible.builtin.include_tasks: sources.yml
- name: Adding additional apt sources (optional)
ansible.builtin.include_tasks: sources_ethz.yml
when:
- base__add_ethz | bool
- ansible_architecture == 'x86_64'
- ansible_distribution == 'Debian' and ansible_distribution_version | float >= 8
- ansible_pkg_mgr == "apt"
- name: Install packages
- name: Install some recomended packages
ansible.builtin.include_tasks: packages.yml
- name: Upgrade all packages to latest
@ -26,16 +25,16 @@
when:
- base__upgrade_packages_to_latest_version | bool
- name: Optional configure editor
ansible.builtin.include_tasks: editor.yml
when: base__install_vim | bool
- name: Optional install keychain
ansible.builtin.include_tasks: keychain.yml
when: base__install_keychain | bool
- name: Install optional packages
become: true
ansible.builtin.package:
name: "{{ base__extra_packages }}"
state: present
# - name: Optional configure editor
# ansible.builtin.include_tasks: editor.yml
# when: base__install_vim | bool
#
# - name: Optional install keychain
# ansible.builtin.include_tasks: keychain.yml
# when: base__install_keychain | bool
#
# - name: Install optional packages
# become: true
# ansible.builtin.package:
# name: "{{ base__extra_packages }}"
# state: present

View file

@ -11,3 +11,4 @@
inventory_hostname = '{{ inventory_hostname }}'
ansible_hostname = '{{ ansible_hostname }}'
ansible_fqdn = '{{ ansible_fqdn }}'
verbosity: 1

View file

@ -1,5 +1,5 @@
---
- name: Update repo-cache for debian/ubuntu
- name: Update apt repo-cache for debian/ubuntu
become: true
ansible.builtin.apt:
update_cache: true
@ -7,7 +7,7 @@
when:
- ansible_pkg_mgr == "apt"
- name: Update repo-cache for debian/ubuntu
- name: Update dnf repo-cache RHEL/Fedora
become: true
ansible.builtin.dnf:
update_cache: true
@ -17,8 +17,9 @@
- name: Install base packages for all operating systems
become: true
ansible.builtin.package:
name: "{{ base__packages }}"
name: "{{ item }}"
state: "{{ base__package_state }}"
with_items: "{{ base__packages }}"
- name: Install python3 for all non-legacy systems
become: true
@ -30,48 +31,48 @@
ansible_os_family == 'RedHat' and ansible_distribution_version | float >= 7 or
ansible_distribution == 'Debian' and ansible_distribution_version | float >= 7
- name: Install python for systems where python3 packages are renamed to python
become: true
ansible.builtin.package:
name: "{{ base__python_packages }}"
state: "{{ base__package_state }}"
when: ansible_os_family == 'Archlinux'
- name: Install packages for all non-legacy systems
become: true
ansible.builtin.package:
name: "{{ base__modern_packages }}"
state: "{{ base__package_state }}"
when: |
ansible_distribution == 'Ubuntu' and ansible_distribution_version | float >= 16.0 or
ansible_os_family == 'RedHat' and ansible_distribution_version | float >= 7 or
ansible_distribution == 'Debian' and ansible_distribution_version | float >= 8 or
ansible_os_family == 'Archlinux'
- name: Install packages for all non-legacy Debian/Ububntu systems
become: true
ansible.builtin.package:
name: "{{ base__debian_packages }}"
state: "{{ base__package_state }}"
when: |
ansible_distribution == 'Ubuntu' and ansible_distribution_version | float >= 16.0 or
ansible_distribution == 'Debian' and ansible_distribution_version | float >= 8
- name: Install packages for all reasonable non-legacy systems
become: true
ansible.builtin.package:
name: "{{ base__linux_packages }}"
state: "{{ base__package_state }}"
when: |
ansible_distribution == 'Ubuntu' and ansible_distribution_version | float >= 18.0 or
ansible_distribution == 'Fedora' and ansible_distribution_version | float >= 32 or
ansible_distribution == 'Debian' and ansible_distribution_version | float >= 9 or
ansible_os_family == 'Archlinux'
- name: Install mailx on debian
become: true
ansible.builtin.package:
name:
- bsd-mailx
state: "{{ base__package_state }}"
when: ansible_distribution == 'Debian' and ansible_distribution_version | float >= 7 and base__install_mailx | bool
# - name: Install python for systems where python3 packages are renamed to python
# become: true
# ansible.builtin.package:
# name: "{{ base__python_packages }}"
# state: "{{ base__package_state }}"
# when: ansible_os_family == 'Archlinux'
#
# - name: Install packages for all non-legacy systems
# become: true
# ansible.builtin.package:
# name: "{{ base__modern_packages }}"
# state: "{{ base__package_state }}"
# when: |
# ansible_distribution == 'Ubuntu' and ansible_distribution_version | float >= 16.0 or
# ansible_os_family == 'RedHat' and ansible_distribution_version | float >= 7 or
# ansible_distribution == 'Debian' and ansible_distribution_version | float >= 8 or
# ansible_os_family == 'Archlinux'
#
# - name: Install packages for all non-legacy Debian/Ububntu systems
# become: true
# ansible.builtin.package:
# name: "{{ base__debian_packages }}"
# state: "{{ base__package_state }}"
# when: |
# ansible_distribution == 'Ubuntu' and ansible_distribution_version | float >= 16.0 or
# ansible_distribution == 'Debian' and ansible_distribution_version | float >= 8
#
# - name: Install packages for all reasonable non-legacy systems
# become: true
# ansible.builtin.package:
# name: "{{ base__linux_packages }}"
# state: "{{ base__package_state }}"
# when: |
# ansible_distribution == 'Ubuntu' and ansible_distribution_version | float >= 18.0 or
# ansible_distribution == 'Fedora' and ansible_distribution_version | float >= 32 or
# ansible_distribution == 'Debian' and ansible_distribution_version | float >= 9 or
# ansible_os_family == 'Archlinux'
#
# - name: Install mailx on debian
# become: true
# ansible.builtin.package:
# name:
# - bsd-mailx
# state: "{{ base__package_state }}"
# when: ansible_distribution == 'Debian' and ansible_distribution_version | float >= 7 and base__install_mailx | bool

View file

@ -62,5 +62,5 @@ base__linux_packages:
- bzip2
- jq
playbook_version_number: 9019
playbook_version_number: 9020
playbook_version_path: 'base-packages_roles-ansible_github.version'