To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 2749dae0 authored by Bengt Giger's avatar Bengt Giger
Browse files

Merge branch 'base_packages' into 'master'

Added base_packages

See merge request !2
parents 85b845bd 4bd7a622
Pipeline #89831 passed with stage
in 8 minutes and 51 seconds
......@@ -91,3 +91,18 @@ administrator_keys-test:
changes:
- .gitlab-ci.yml
- roles/administrator_keys/**/*
# Test base_packages on Kubernetes
base_packages-test:
stage: tests
tags:
- k8s-runner
variables:
DOCKER_HOST: tcp://localhost:2375
script:
- cd roles/base_packages;
molecule test;
only:
changes:
- .gitlab-ci.yml
- roles/base_packages/**/*
......@@ -8,7 +8,7 @@ namespace: ethz
name: system_configuration
# The version of the collection. Must be compatible with semantic versioning
version: 2.1.0
version: 2.2.0
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md
......
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Deploy SSH keys, and remove obsolete keys.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
- `admin_keys`: list of complete keys to be added
- `admin_obsolete_keys`: list of keys to be removed
- `admin_user`: destination user, defaults to *root*
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
---
# Based on ansible-lint config
extends: default
rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
colons:
max-spaces-after: -1
level: error
commas:
max-spaces-after: -1
level: error
comments: disable
comments-indentation: disable
document-start: disable
empty-lines:
max: 3
level: error
hyphens:
level: error
indentation: disable
key-duplicates: enable
line-length: disable
new-line-at-end-of-file: disable
new-lines:
type: unix
trailing-spaces: disable
truthy: disable
Role Name
=========
Install a list of OS packages.
Role Variables
--------------
- `base_packages`: package names common to both RPM and DEB based systems
- `base_deb_packages`: package names unique to DEB based systems
- `base_rpm_packages`: package names unique to RPM based systems
- `base_obsolete_packages`: packages to be removed
If you deploy older and newer variants of an OS like RHEL7 and RHEL8, packages may be absent or renamed in one or the other release. Use variables like this as workaround:
```
- name: My playbook
hosts: all
tasks:
- name: Get list for all RHEL releases
include_vars: packages.yml
- name: Install packages
include_role: base_packages
- name: Get lists for specific RHEL releases
include_vars: "{{ ansible_os_family | lower }}.yml"
- name: Install packages
include_role: base_packages
```
---
id_cd_base_packages_depreciated: ""
*******
Delegated driver installation guide
*******
Requirements
============
This driver is delegated to the developer. Up to the developer to implement
requirements.
Install
=======
This driver is delegated to the developer. Up to the developer to implement
requirements.
---
- name: Converge
hosts: all
vars:
base_packages:
- tree
base_rpm_packages:
- bind-utils
base_deb_packages:
- dnsutils
base_obsolete_packages:
- rsync
tasks:
- name: "Include base_packages"
include_role:
name: "base_packages"
---
dependency:
name: galaxy
driver:
name: docker
lint: |
set -e
yamllint -c molecule/default/yaml-lint.yml .
ansible-lint tasks
platforms:
- name: el7
image: geerlingguy/docker-centos7-ansible:latest
pre_build_image: true
- name: el8
image: geerlingguy/docker-centos8-ansible:latest
pre_build_image: true
- name: debian10
image: registry.ethz.ch/ansible-community/images/docker-debian10-ansible:latest
pre_build_image: true
- name: ubuntu2004
image: geerlingguy/docker-ubuntu2004-ansible:latest
pre_build_image: true
provisioner:
name: ansible
verifier:
name: ansible
---
- name: Prepare
hosts: all
tasks:
- name: Update apt cache
apt:
update-cache: true
register: apt_updated
retries: 10
until: apt_updated is not failed
when: ansible_os_family | lower == "debian"
changed_when: false
- name: Install rsync for later removal test
package:
name: rsync
---
# This is an example playbook to execute Ansible tests.
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Execute "tree"
command: tree --help
register: tree_output
changed_when: false
ignore_errors: true
- name: Test if "tree" is executable
assert:
that: "'usage: tree' in tree_output.stdout or 'usage: tree' in tree_output.stderr"
- name: Execute "host"
command: host --help
register: host_output
changed_when: false
ignore_errors: true
- name: Test if "host" is executable
assert:
that: "'host: illegal option' in host_output.stderr"
- name: Try if "rsync" has been removed
command: rsync
register: rsync_output
changed_when: false
ignore_errors: true
- name: Test if rsync command returned an error
assert:
that: rsync_output.rc == 2
---
extends: default
rules:
line-length:
max: 190
level: warning
---
- name: Update apt cache
apt:
update-cache: true
register: apt_updated
retries: 10
until: apt_updated is not failed
when: ansible_os_family | lower == "debian"
changed_when: false
- name: Install general commodity packages
package:
state: present
name: "{{ base_packages }}"
- name: Install RHEL commodity packages
package:
state: present
name: "{{ base_rpm_packages }}"
when: ansible_os_family | lower == "redhat"
- name: Install commodity deb packages
package:
state: present
name: "{{ base_deb_packages }}"
when: ansible_os_family | lower == "debian" or ansible_os_family | lower == "ubuntu"
- name: Deinstall unwanted packages
package:
state: absent
name: "{{ base_obsolete_packages }}"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment