commit 5a236e6e30f82e2cbee56ec6dc3cb96e74ce5fac Author: Gardais Jérémy Date: Fri Nov 23 15:19:21 2018 +0100 Add linux.dell.com repo 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/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..187b429 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ + +## v1.0.0 + +### Features +* Add linux.dell.com repo diff --git a/README.md b/README.md new file mode 100644 index 0000000..feb824c --- /dev/null +++ b/README.md @@ -0,0 +1,60 @@ +# Openmanage + +1. [Overview](#overview) +2. [Role Variables](#role-variables) +3. [Example Playbook](#example-playbook) +4. [Configuration](#configuration) +5. [Development](#development) +6. [License](#license) +7. [Author Information](#author-information) + +## Overview + +A role to manage Openmanage installation and configuration. + +## Role Variables + +* ** +openmanage__repositories** : List of APT repositories that can provide OpenManage. Each entry is a dict [default : `See default/main.yml`]. +* **openmanage__base_packages** : List of base packages in order to provide Openmanage [default : `openmanage`]. +* **openmanage__deploy_state** : The desired state this role should achieve. [default : `absent`]. + +## Example Playbook + +* Use defaults vars : + +``` yaml +- hosts: mynode.DOMAIN + roles: + - role: ipr-cnrs.openmanage + tags: ['role::openmanage', 'ipr', 'idrac'] +``` + +## Configuration + +This role will : +* Add an APT repository in order to provide OpenManage. + +## Development + +This source code comes from our [Gogs instance][openmanage source] and the [Github repo][openmanage 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][openmanage source] :) + +## License + +[WTFPL][wtfpl website] + +## Author Information + +Jérémy Gardais +* Source : [on IPR's Gogs][openmanage source] +* [IPR][ipr website] (Institut de Physique de Rennes) + +[gogs to github hook]: https://stackoverflow.com/a/21998477 +[openmanage source]: https://git.ipr.univ-rennes1.fr/cellinfo/ansible.openmanage +[openmanage github]: https://github.com/ipr-cnrs/openmanage +[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..4ba6829 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,50 @@ +--- +# .. vim: foldmarker=[[[,]]]:foldmethod=marker + +# ipr-cnrs.openmanage default variables [[[ +# ====================================== + +# Repository [[[ +# ----------------------------- + +# .. envvar:: openmanage__repositories [[[ +# +# List of APT repositories (and related info such gpg keys) that can provide +# OpenManage. Each entry is a dict that can be used to provide both +# apt_repository and apt_key. +# +openmanage__repositories: + # Version 910 - for Debian Stretch and Ubuntu Xenial + - repo: 'deb http://linux.dell.com/repo/community/openmanage/910/{{ ansible_distribution_release }} {{ ansible_distribution_release }} main' + filename: 'dell.openmanage' + key_id: '1285491434D8786F' + key_keyserver: 'pool.sks-keyservers.net' + state: '{{ openmanage__deploy_state + if (ansible_distribution_release in ["stretch", "xenial"]) + else "absent" }}' + # Previous version for Debian until Jessie and Ubuntu until Trusty + - repo: 'deb http://linux.dell.com/repo/community/debian/dists/{{ ansible_distribution_release }} {{ ansible_distribution_release }} openmanage' + filename: 'dell.openmanage' + key_id: '1285491434D8786F' + key_keyserver: 'pool.sks-keyservers.net' + state: '{{ openmanage__deploy_state + if (ansible_distribution_release not in ["stretch", "xenial"]) + else "absent" }}' + # ]]] + # ]]] +# Packages and installation [[[ +# ----------------------------- + +# .. envvar:: openmanage__deploy_state [[[ +# +# What is the desired state which this role should achieve ? Possible options : +# +# ``present`` +# Default. Ensure that openmanage is installed and configured as requested. +# +# ``absent`` +# Ensure that openmanage is uninstalled and it's configuration is removed. +# +openmanage__deploy_state: 'absent' + # ]]] + # ]]] diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..f5f8293 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,16 @@ +galaxy_info: + author: "Jérémy Gardais" + description: "Setup Openmanage" + license: WTFPL + company: IPR + issue_tracker_url: https://git.ipr.univ-rennes1.fr/cellinfo/ansible.netadata/issues + min_ansible_version: 2.6 + platforms: + - name: Debian + versions: + - stretch + galaxy_tags: + - system + - openmanage + - idrac + - dell diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..0ffaca4 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,35 @@ +--- +# .. vim: foldmarker=[[[,]]]:foldmethod=marker +# +# tasks file for netdata + +# Manage repository [[[1 +## Add repository +- name: Add OpenManage repository + apt_repository: + update_cache: False + repo: '{{ item.repo }}' + mode: '{{ item.mode | d(omit) }}' + filename: '{{ item.filename | d(omit) }}' + state: '{{ item.state | d("present") }}' + with_flattened: + - '{{ openmanage__repositories }}' + register: openmanage__register_repositories + +## Add repository key +- name: Add OpenManage repo key + apt_key: + url: '{{ item.key_url | d(omit) }}' + id: '{{ item.key_id | d(omit) }}' + keyserver: '{{ item.key_keyserver | d(omit) }}' + with_flattened: + - '{{ openmanage__repositories }}' + register: openmanage__register_key + +## Update cache +- name: Update APT cache + apt: + update_cache: True + when: (openmanage__deploy_state == "present") and + (openmanage__register_repositories.changed or + openmanage__register_key.changed) 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..e6bde1a --- /dev/null +++ b/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - openmanage