mirror of
https://github.com/roles-ansible/ansible_role_base.git
synced 2024-08-16 14:29:50 +02:00
Migrate packages to new layout
This commit is contained in:
parent
0f34555f8b
commit
985fe96b0a
4 changed files with 98 additions and 72 deletions
|
@ -13,6 +13,8 @@ base__pkg_contrib: "{{ base_pkg_contrib }}"
|
||||||
# optionaly print some OS vars
|
# optionaly print some OS vars
|
||||||
base__print_os_vars: "{{ print_os_vars }}"
|
base__print_os_vars: "{{ print_os_vars }}"
|
||||||
|
|
||||||
|
base__package_state: 'present'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# LEGACY VARS
|
# LEGACY VARS
|
||||||
|
|
143
tasks/main.yml
143
tasks/main.yml
|
@ -11,81 +11,86 @@
|
||||||
- base__add_ethz | bool
|
- base__add_ethz | bool
|
||||||
- ansible_architecture == 'x86_64'
|
- ansible_architecture == 'x86_64'
|
||||||
|
|
||||||
- name: Install common base packages [Debian]
|
- include_tasks: packages.yml
|
||||||
become: yes
|
|
||||||
apt:
|
|
||||||
package: "{{ debian_packages }}"
|
|
||||||
state: present
|
|
||||||
update_cache: yes
|
|
||||||
cache_valid_time: 43200
|
|
||||||
when: ansible_os_family == 'Debian' and ansible_distribution_version != '7' and ansible_distribution_release != 'wheezy' and ansible_machine != 'armv6l'
|
|
||||||
|
|
||||||
- name: Install common base packages [all - wheezy]
|
|
||||||
become: yes
|
|
||||||
package:
|
|
||||||
name: "{{ base_packages_extended }}"
|
|
||||||
state: present
|
|
||||||
when:
|
|
||||||
- ansible_machine != 'armv6l'
|
|
||||||
- ansible_distribution_release != 'wheezy'
|
|
||||||
- ansible_architecture != 'armv7l'
|
|
||||||
|
|
||||||
- name: Install extended base packages [all - wheezy - rpi]
|
|
||||||
become: yes
|
|
||||||
package:
|
|
||||||
name: "{{ base_packages }}"
|
|
||||||
state: present
|
|
||||||
when: ansible_machine != 'armv6l' and ansible_distribution_release != 'wheezy'
|
|
||||||
|
|
||||||
|
|
||||||
- name: Install common base packages [Fedora]
|
|
||||||
become: yes
|
|
||||||
package:
|
|
||||||
name: "{{ fedora_packages }}"
|
|
||||||
state: present
|
|
||||||
when: ansible_distribution == 'Fedora'
|
|
||||||
|
|
||||||
- name: install packages for everyone except centos/rhel
|
|
||||||
become: true
|
|
||||||
package:
|
|
||||||
name: "{{ packages_for_all_except_rhel }}"
|
|
||||||
state: present
|
|
||||||
when:
|
|
||||||
- ansible_os_family != 'RedHat'
|
|
||||||
- ansible_distribution_version != "14.04"
|
|
||||||
- ansible_distribution_version != "12.04"
|
|
||||||
- ansible_distribution_release != 'wheezy'
|
|
||||||
- ansible_machine != 'armv6l' and ansible_distribution_release != 'wheezy'
|
|
||||||
|
|
||||||
- name: Install extra packages
|
#- name: Install common base packages [Debian]
|
||||||
become: true
|
# become: yes
|
||||||
package:
|
# apt:
|
||||||
name: "{{ packages_extra }}"
|
# package: "{{ debian_packages }}"
|
||||||
state: present
|
# state: present
|
||||||
when:
|
# update_cache: yes
|
||||||
- packages_extra is defined
|
# cache_valid_time: 43200
|
||||||
- packages_extra != '[]'
|
# when: ansible_os_family == 'Debian' and ansible_distribution_version != '7' and ansible_distribution_release != 'wheezy' and ansible_machine != 'armv6l'
|
||||||
- ansible_machine != 'armv6l' and ansible_distribution_release != 'wheezy'
|
|
||||||
|
|
||||||
- name: Remove rpcbind, nfs-common
|
#- name: Install common base packages [all - wheezy]
|
||||||
become: yes
|
# become: yes
|
||||||
package:
|
# package:
|
||||||
name:
|
# name: "{{ base_packages_extended }}"
|
||||||
- rpcbind
|
# state: present
|
||||||
- nfs-common
|
# when:
|
||||||
state: absent
|
# - ansible_machine != 'armv6l'
|
||||||
when:
|
# - ansible_distribution_release != 'wheezy'
|
||||||
- ansible_machine != 'armv6l' and ansible_distribution_release != 'wheezy'
|
# - ansible_architecture != 'armv7l'
|
||||||
- ansible_os_family == 'Debian'
|
|
||||||
|
|
||||||
- name: Upgrade all packages to latest
|
#- name: Install extended base packages [all - wheezy - rpi]
|
||||||
become: true
|
# become: yes
|
||||||
package:
|
# package:
|
||||||
name: "*"
|
# name: "{{ base_packages }}"
|
||||||
state: latest
|
# state: present
|
||||||
when:
|
# when: ansible_machine != 'armv6l' and ansible_distribution_release != 'wheezy'
|
||||||
- upgrade_packages_to_latest_version|bool
|
|
||||||
- ansible_machine != 'armv6l' and ansible_distribution_release != 'wheezy'
|
|
||||||
|
#-# name: Install common base packages [Fedora]
|
||||||
|
# become: yes
|
||||||
|
# package:
|
||||||
|
# name: "{{ fedora_packages }}"
|
||||||
|
# state: present
|
||||||
|
# when: ansible_distribution == 'Fedora'
|
||||||
|
#
|
||||||
|
#- name: install packages for everyone except centos/rhel
|
||||||
|
# become: true
|
||||||
|
# package:
|
||||||
|
# name: "{{ packages_for_all_except_rhel }}"
|
||||||
|
# state: present
|
||||||
|
# when:
|
||||||
|
# - ansible_os_family != 'RedHat'
|
||||||
|
# - ansible_distribution_version != "14.04"
|
||||||
|
# - ansible_distribution_version != "12.04"
|
||||||
|
# - ansible_distribution_release != 'wheezy'
|
||||||
|
# - ansible_machine != 'armv6l' and ansible_distribution_release != 'wheezy'
|
||||||
|
|
||||||
|
#- name: Install extra packages
|
||||||
|
# become: true
|
||||||
|
# package:
|
||||||
|
# name: "{{ packages_extra }}"
|
||||||
|
# state: present
|
||||||
|
# when:
|
||||||
|
# - packages_extra is defined
|
||||||
|
# - packages_extra != '[]'
|
||||||
|
# - ansible_machine != 'armv6l' and ansible_distribution_release != 'wheezy'
|
||||||
|
#
|
||||||
|
#- name: Remove rpcbind, nfs-common
|
||||||
|
# become: yes
|
||||||
|
# package:
|
||||||
|
# name:
|
||||||
|
# - rpcbind
|
||||||
|
# - nfs-common
|
||||||
|
# state: absent
|
||||||
|
# when:
|
||||||
|
# - ansible_machine != 'armv6l' and ansible_distribution_release != 'wheezy'
|
||||||
|
# - ansible_os_family == 'Debian'
|
||||||
|
#
|
||||||
|
#- name: Upgrade all packages to latest
|
||||||
|
# become: true
|
||||||
|
# package:
|
||||||
|
# name: "*"
|
||||||
|
# state: latest
|
||||||
|
# when:
|
||||||
|
# - upgrade_packages_to_latest_version|bool
|
||||||
|
# - ansible_machine != 'armv6l' and ansible_distribution_release != 'wheezy'
|
||||||
|
|
||||||
- include_tasks: editor.yml
|
- include_tasks: editor.yml
|
||||||
when: editor_is_vim | bool
|
when: editor_is_vim | bool
|
||||||
|
|
17
tasks/packages.yml
Normal file
17
tasks/packages.yml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
---
|
||||||
|
- name: install base packages for all operating systems
|
||||||
|
become: true
|
||||||
|
package:
|
||||||
|
name: "{{ base__packages }}"
|
||||||
|
state: "{{ base__package_state }}"
|
||||||
|
|
||||||
|
- name: install packages for all non-legacy x86 systems
|
||||||
|
become: true
|
||||||
|
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'
|
|
@ -1,9 +1,9 @@
|
||||||
---
|
---
|
||||||
base_packages:
|
# must-have packages for all systems
|
||||||
|
base__packages:
|
||||||
- rsync
|
- rsync
|
||||||
- tmux
|
- tmux
|
||||||
- sudo
|
- sudo
|
||||||
- fail2ban
|
|
||||||
- ethtool
|
- ethtool
|
||||||
- vim
|
- vim
|
||||||
- nmap
|
- nmap
|
||||||
|
@ -16,11 +16,13 @@ base_packages:
|
||||||
- gdisk
|
- gdisk
|
||||||
- lsof
|
- lsof
|
||||||
|
|
||||||
base_packages_extended:
|
# packages for all non-legacy x86 systems
|
||||||
|
base__modern_packages:
|
||||||
- tcpdump
|
- tcpdump
|
||||||
- sysstat
|
- sysstat
|
||||||
- smartmontools
|
- smartmontools
|
||||||
|
|
||||||
|
|
||||||
debian_packages:
|
debian_packages:
|
||||||
- debian-goodies
|
- debian-goodies
|
||||||
- molly-guard
|
- molly-guard
|
||||||
|
|
Loading…
Reference in a new issue