add os_update role
This commit is contained in:
commit
4a721d8e4d
3
README.md
Normal file
3
README.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Ansible Collection - copyrights.on_premises
|
||||
|
||||
Documentation for the collection.
|
||||
61
galaxy.yml
Normal file
61
galaxy.yml
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
### REQUIRED
|
||||
# The namespace of the collection. This can be a company/brand/organization or product namespace under which all
|
||||
# content lives. May only contain alphanumeric lowercase characters and underscores. Namespaces cannot start with
|
||||
# underscores or numbers and cannot contain consecutive underscores
|
||||
namespace: copyrights
|
||||
|
||||
# The name of the collection. Has the same character restrictions as 'namespace'
|
||||
name: on_premises
|
||||
|
||||
# The version of the collection. Must be compatible with semantic versioning
|
||||
version: 0.0.1
|
||||
|
||||
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
|
||||
readme: README.md
|
||||
|
||||
# A list of the collection's content authors. Can be just the name or in the format 'Full Name <email> (url)
|
||||
# @nicks:irc/im.site#channel'
|
||||
authors:
|
||||
- Frank Adaemmer <frank@adaemmer.com>
|
||||
|
||||
|
||||
### OPTIONAL but strongly recommended
|
||||
# A short summary description of the collection
|
||||
description: A collection of my on-premises ansible roles and playbooks
|
||||
|
||||
# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only
|
||||
# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file'
|
||||
license:
|
||||
- GPL-3.0-or-later
|
||||
|
||||
# The path to the license file for the collection. This path is relative to the root of the collection. This key is
|
||||
# mutually exclusive with 'license'
|
||||
license_file: ''
|
||||
|
||||
# A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character
|
||||
# requirements as 'namespace' and 'name'
|
||||
tags: ['docker', 'on-premises']
|
||||
|
||||
# Collections that this collection requires to be installed for it to be usable. The key of the dict is the
|
||||
# collection label 'namespace.name'. The value is a version range
|
||||
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
|
||||
# range specifiers can be set and are separated by ','
|
||||
dependencies: {}
|
||||
|
||||
# The URL of the originating SCM repository
|
||||
repository: http://example.com/repository
|
||||
|
||||
# The URL to any online docs
|
||||
documentation: http://docs.example.com
|
||||
|
||||
# The URL to the homepage of the collection/project
|
||||
homepage: http://example.com
|
||||
|
||||
# The URL to the collection issue tracker
|
||||
issues: http://example.com/issue/tracker
|
||||
|
||||
# A list of file glob-like patterns used to filter any files or directories that should not be included in the build
|
||||
# artifact. A pattern is matched from the relative path of the file or directory of the collection directory. This
|
||||
# uses 'fnmatch' to match the files or directories. Some directories and files like 'galaxy.yml', '*.pyc', '*.retry',
|
||||
# and '.git' are always filtered
|
||||
build_ignore: []
|
||||
3
roles/os_update/README.md
Normal file
3
roles/os_update/README.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# copyrights.on_premises.os_update
|
||||
|
||||
Update all OS packages.
|
||||
66
roles/os_update/meta/main.yml
Normal file
66
roles/os_update/meta/main.yml
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
galaxy_info:
|
||||
author: Frank Adaemmer <frank@adaemmer.com>
|
||||
description: Update all OS packages
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Choose a valid license ID from https://spdx.org - some suggested licenses:
|
||||
# - BSD-3-Clause (default)
|
||||
# - MIT
|
||||
# - GPL-2.0-or-later
|
||||
# - GPL-3.0-only
|
||||
# - Apache-2.0
|
||||
# - CC-BY-4.0
|
||||
license: GPL-3.0-or-later
|
||||
|
||||
min_ansible_version: '2.9'
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
#
|
||||
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
#
|
||||
platforms:
|
||||
- name: EL
|
||||
version:
|
||||
- '7'
|
||||
- '8'
|
||||
- '9'
|
||||
- name: Debian
|
||||
version:
|
||||
- bullseye
|
||||
- buster
|
||||
- jessie
|
||||
- name: ArchLinux
|
||||
version:
|
||||
- any
|
||||
|
||||
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
21
roles/os_update/tasks/main.yml
Normal file
21
roles/os_update/tasks/main.yml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
# tasks file for os_update
|
||||
- name: What OS?
|
||||
ansible.builtin.debug:
|
||||
msg: "ansible_os_family={{ ansible_os_family }}"
|
||||
|
||||
- name: Update with DNF
|
||||
import_tasks: update_dnf.yml
|
||||
when: ansible_pkg_mgr == 'dnf'
|
||||
|
||||
- name: Update with YUM
|
||||
import_tasks: update_yum.yml
|
||||
when: ansible_pkg_mgr == 'yum'
|
||||
|
||||
- name: Update with APT
|
||||
import_tasks: update_apt.yml
|
||||
when: ansible_pkg_mgr == 'apt' or ansible_pkg_mgr == 'zypper'
|
||||
|
||||
- name: Update with pacman
|
||||
import_tasks: update_pacman.yml
|
||||
when: ansible_pkg_mgr == 'pacman'
|
||||
12
roles/os_update/tasks/update_apt.yml
Normal file
12
roles/os_update/tasks/update_apt.yml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
- name: Update packages with apt
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
upgrade: dist
|
||||
become: true
|
||||
|
||||
- name: Clean up apt
|
||||
ansible.builtin.apt:
|
||||
autoremove: yes
|
||||
purge: yes
|
||||
become: true
|
||||
6
roles/os_update/tasks/update_dnf.yml
Normal file
6
roles/os_update/tasks/update_dnf.yml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
- name: update packages with dnf
|
||||
become: true
|
||||
ansible.builtin.dnf:
|
||||
name: '*'
|
||||
state: latest # noqa package-latest
|
||||
6
roles/os_update/tasks/update_pacman.yml
Normal file
6
roles/os_update/tasks/update_pacman.yml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
- name: Update packages with pacman
|
||||
pacman:
|
||||
update_cache: true
|
||||
upgrade: true
|
||||
become: true
|
||||
6
roles/os_update/tasks/update_yum.yml
Normal file
6
roles/os_update/tasks/update_yum.yml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
- name: update packages with yum
|
||||
become: true
|
||||
ansible.builtin.yum:
|
||||
name: '*'
|
||||
state: latest # noqa package-latest
|
||||
Loading…
Reference in a new issue