From 56a794af8e46de2cdd34b0722249a58407255b8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Tue, 1 Aug 2017 11:08:16 +0200 Subject: [PATCH] Install packages. --- .travis.yml | 29 +++++++++++++++ README.md | 95 +++++++++++++++++++++++++++++++++++++++++++++++ defaults/main.yml | 6 +++ meta/main.yml | 22 +++++++++++ tasks/main.yml | 19 ++++++++++ tests/inventory | 1 + tests/test.yml | 5 +++ vars/debian.yml | 24 ++++++++++++ 8 files changed, 201 insertions(+) create mode 100644 .travis.yml create mode 100644 README.md create mode 100644 defaults/main.yml create mode 100644 meta/main.yml create mode 100644 tasks/main.yml create mode 100644 tests/inventory create mode 100644 tests/test.yml create mode 100644 vars/debian.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..36bbf62 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,29 @@ +--- +language: python +python: "2.7" + +# Use the new container infrastructure +sudo: false + +# Install ansible +addons: + apt: + packages: + - python-pip + +install: + # Install ansible + - pip install ansible + + # Check ansible version + - ansible --version + + # Create ansible.cfg with correct roles_path + - printf '[defaults]\nroles_path=../' >ansible.cfg + +script: + # Basic role syntax check + - ansible-playbook tests/test.yml -i tests/inventory --syntax-check + +notifications: + webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..8c8701b --- /dev/null +++ b/README.md @@ -0,0 +1,95 @@ +# PKG_UTILS + +1. [Overview](#overview) +2. [Role Variables](#role-variables) + * [OS Specific Variables](#os-specific-variables) +3. [Example Playbook](#example-playbook) +4. [Packages](#packages) +5. [Development](#development) +5. [License](#license) +6. [Author Information](#author-information) + +## Overview + +Manage some packages from 'utils' section (Apt). + +## Role Variables + +* **pkg_utils_new_state** : State of new pkg_utils packages [default : `latest`]. + +### OS Specific Variables + +Please see default value by Operating System file in [vars][vars directory] directory. + +* **pkg_utils_new_list** : The list of packages to install to provide `pkg_utils`. + +## Example Playbook + +* Use defaults vars : + +``` yml +- hosts: serverXYZ + roles: + - role: ipr-cnrs.pkg_utils +``` + +## Packages + +### New Packages +* **bdsmainutils** : Collection of more utilities from FreeBSD. +* **colordiff** : Tool to colorize 'diff' output. +* **cpio** : GNU cpio; a program to manage archives of files. +* **debian-goodies** : Small toolbox-style utilities for Debian systems. + * Show which installed packages occupy the most place : + +``` sh +dpigs +``` + +* **htop** : Interactive processes viewer. +* **lsof** : Utility to list open files (eg. useful to redirect stdout). +* **lzip** : Lossless data compressor based on the LZMA algorithm. +* **mlocate** : Quickly find files on the filesystem based on their name. +* **moreutils** : Additionnal Unix utilities. + * `vidir` : Edit directory content as a file with vim +* **multitail** : View multiple logfiles windowed on console : + +``` sh +sudo multitail /var/log/auth.log /var/log/syslog +sudo multitail -s 2 /var/log/auth.log /var/log/syslog /var/log/mail.log +``` + +* **tmux** : Terminal multiplexer. +* **tree** : Displays an indented directory tree,in color. +* **unrar** : Unarchiver for .rar files (non-free version). +* **unzip** : De-archiver for .zip files. +* **vim-nox** : Vi IMproved - enhanced vi editor - with scripting languages support. +* **vim-doc** : Vi IMproved - HTML documentation. +* **vim-scripts** : Plugins for vim, adding bells and whistles. +* **zip** : Archiver for .zip files. +* **zsh** : Shell with lots of features. + +## Development + +This source code comes from our [Gogs instance][pkg_utils source] and the [Github repo][pkg_utils github] exist just to be able to send the role to Ansible Galaxy… + +But feel free to send issue/PR here :) + +Thanks to this [hook][gogs to github hook], Github automatically got updates from our [Gogs instance][pkg_utils source] :) + +## License + +[WTFPL][wtfpl website] + +## Author Information + +Jérémy Gardais +* Source : [on IPR's Gogs][pkg_utils source] +* [IPR][ipr website] (Institut de Physique de Rennes) + +[vars directory]: ./vars +[gogs to github hook]: https://stackoverflow.com/a/21998477 +[pkg_utils source]: https://git.ipr.univ-rennes1.fr/cellinfo/ansible.pkg_utils +[pkg_utils github]: https://github.com/ipr-cnrs/pkg_utils +[wtfpl website]: http://www.wtfpl.net/about/ +[ipr website]: https://ipr.univ-rennes1.fr/ diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..47ebbd3 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,6 @@ +--- +# defaults file for pkg_utils + +# packages +pkg_utils_new_state: 'installed' + diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..e56420b --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,22 @@ +galaxy_info: + author: "Jérémy Gardais" + description: "Manage some packages from 'utils' section (Apt)." + license: WTFPL + company: IPR + issue_tracker_url: https://git.ipr.univ-rennes1.fr/cellinfo/ansible.pkg_utils/issues + min_ansible_version: 2.2 + platforms: + - name: Debian + versions: + - stretch + #- name: opensuse + # versions: + # - all + # - 12.1 + # - 12.2 + # - 12.3 + # - 13.1 + # - 13.2 + galaxy_tags: + - system + - package diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..e862fb6 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,19 @@ +--- +# tasks file for pkg_utils + +- name: Load specific OS vars + include_vars: "{{ item }}" + with_first_found: + - "{{ ansible_distribution|lower }}-{{ ansible_distribution_version }}.yml" + - "{{ ansible_distribution|lower }}.yml" + - "{{ ansible_os_family|lower }}.yml" + +# packages {{{ +- name: Ensure useful packages + apt: + name: '{{ item }}' + state: '{{ pkg_utils_new_state }}' + with_items: + - '{{ pkg_utils_new_list }}' + +# }}} diff --git a/tests/inventory b/tests/inventory new file mode 100644 index 0000000..d18580b --- /dev/null +++ b/tests/inventory @@ -0,0 +1 @@ +localhost \ No newline at end of file diff --git a/tests/test.yml b/tests/test.yml new file mode 100644 index 0000000..caa1f7d --- /dev/null +++ b/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - pkg_utils \ No newline at end of file diff --git a/vars/debian.yml b/vars/debian.yml new file mode 100644 index 0000000..6a2af66 --- /dev/null +++ b/vars/debian.yml @@ -0,0 +1,24 @@ +--- + +# vars file for Debian-based distros + +pkg_utils_new_list: + - 'bsdmainutils' + - 'colordiff' + - 'cpio' + - 'debian-goodies' + - 'htop' + - 'lsof' + - 'lzip' + - 'mlocate' + - 'moreutils' + - 'multitail' + - 'tmux' + - 'tree' + - 'unrar' + - 'unzip' + - 'vim-nox' + - 'vim-doc' + - 'vim-scripts' + - 'zip' + - 'zsh'