yum_tasks

pdk
tasks
Ad-hoc tasks to interact with yum to install packages, apply security patches etc
kinners00

kinners00

kinners00

908 downloads

874 latest version

5.0 quality score

Version information

  • 1.0.0 (latest)
  • 0.6.1
  • 0.6.0
  • 0.5.5
released Jun 8th 2020
This version is compatible with:
  • Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x
  • Puppet >= 5.5.10 < 7.0.0
  • Oracle Enterprise Linux, RedHat, CentOS
Tasks:
  • cve
  • advisory
  • install
  • remove
  • security
  • update
  • update_all
  • and 1 more. See all tasks
Plans:
  • package_cache
  • security_cache

Start using this module

Documentation

kinners00/yum_tasks — version 1.0.0 Jun 8th 2020

yum_tasks

Table of Contents

  1. Description
  2. New to bolt?
  3. Gotchas/Limitations
  4. Usage - Examples and general tips on how to use the content in this module
  5. Contributions - Guide for contributing to the module

Description

These tasks help interact with yum at various levels via Puppet Bolt or Puppet Enterprise tasks.

New to bolt?

Check these out:

Installing Bolt

Running Bolt commands

Inventory File Examples

Bolt Command reference

Newcomers quickstart

Create a Bolt project + Boltdir > Create Puppetfile + Add this module > Install module > Run tasks! :)

mkdir -p bolt/Boltdir/
cd bolt/Boltdir/

cat << EOF >> Puppetfile
# Modules from the Puppet Forge.
mod 'kinners00-yum_tasks', '1.0.0'
EOF

bolt puppetfile install

Gotchas

Bolt tasks are copied and executed under /tmp

If you can't execute scripts under that directory, you can pass --tmpdir flag on your bolt command followed by your chosen directory for example --tmpdir /var/tmp

Pass 'run as root' parameter

Depending on your targets user level permissions, you may have to pass --run-as root on your bolt command or add run-as: root to your config in your inventory.yaml file.

Security related tasks only work on RHEL + OEL

yum_tasks::security, yum_tasks::cve and yum_tasks::advisory tasks will only work if you have the relevant security metadata repos enabled.

To the best of my knowledge, this effectively limits this task to RHEL and OEL boxes. It will look like it works on centos etc (i.e. executes successfully) but it will never "find" any security updates if the corresponding repo isn't there.

Usage

Show all available yum tasks

Will show all tasks that match the module name yum_tasks.

bolt task show --filter yum_tasks

Show task info/metadata

This will show a brief description of the tasks function as well the parameters that the task can consume.

bolt task show yum_tasks::security

Running a task

Pass in the relevant parameters and run the task.

bolt task run --targets rhelboxes yum_tasks::security security=minimal

Plan example

If you a bolt aficionado, you can ignore this section.

I've included two sample plans to demonstrate how you can chain together tasks to achieve an overall workflow. In these plans we are running the cache task followed by either a security or install package task, depending on which plan you run. Plans can be made up of tasks from other modules too.

You can see the content of security_cache plan below:

plan yum_tasks::security_cache(
  TargetSpec $targets,
  String $cache,
  String $security
) {

  run_task('yum_tasks::update_cache', $targets, cache => $cache)
  run_task('yum_tasks::security', $targets, security => $security)

  }

Running plans

(Optional) Add --verbose to the end of your bolt command to get output from each task in the plan.

bolt plan run yum_tasks::security_cache targets=rhelboxes cache=update security=minimal --verbose
bolt plan run yum_tasks::package_cache targets=rhelboxes cache=update package=nano --verbose

Contributions

This module contains a simple set of tasks (written in bash). The logic on some tasks could be smarter/cleaner but they should all work. I will get round to improving them at some point in the near future.

If anyone would like to contribute to the module, that would be awesome and very much welcomed.

If you're experiencing any bugs, please raise an issue below:

Repo: https://github.com/kinners00/yum_tasks/issues

Issues link: https://github.com/kinners00/yum_tasks/issues