Implemented ctop role (#1)

Role to download and install ctop.
This commit is contained in:
John Freeman 2018-08-26 15:22:30 +01:00 committed by GitHub
parent f8e31989bc
commit d1549559db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 823 additions and 97 deletions

93
.travis.yml Normal file
View File

@ -0,0 +1,93 @@
---
language: python
python: '2.7'
# Spin off separate builds for each of the following versions
# of Ansible and Linux.
matrix:
include:
- env:
- ANSIBLE_VERSION=2.4.6
- MOLECULE_SCENARIO=centos
- env:
- ANSIBLE_VERSION=2.4.6
- MOLECULE_SCENARIO=debian_max
- env:
- ANSIBLE_VERSION=2.4.6
- MOLECULE_SCENARIO=debian_min
- env:
- ANSIBLE_VERSION=2.4.6
- MOLECULE_SCENARIO=ubuntu_max
- env:
- ANSIBLE_VERSION=2.4.6
- MOLECULE_SCENARIO=ubuntu_min
- env:
- ANSIBLE_VERSION=2.4.6
- MOLECULE_SCENARIO=opensuse
- env:
- ANSIBLE_VERSION=2.6.3
- MOLECULE_SCENARIO=centos
- env:
- ANSIBLE_VERSION=2.6.3
- MOLECULE_SCENARIO=debian_max
- env:
- ANSIBLE_VERSION=2.6.3
- MOLECULE_SCENARIO=debian_min
- env:
- ANSIBLE_VERSION=2.6.3
- MOLECULE_SCENARIO=ubuntu_max
- env:
- ANSIBLE_VERSION=2.6.3
- MOLECULE_SCENARIO=ubuntu_min
- env:
- ANSIBLE_VERSION=2.6.3
- MOLECULE_SCENARIO=opensuse
# Require the standard build environment
sudo: required
# Require Ubuntu 14.04
dist: trusty
# Require Docker
services:
- docker
# Cache Ansible and Molecule to speed things up
cache:
- pip
before_install:
- sudo apt-get -qq update
- sudo apt-get install -o Dpkg::Options::='--force-confold' --force-yes -y docker-ce
install:
# Install Ansible
- pip install "ansible~=$ANSIBLE_VERSION"
# Install Python Docker library
- pip install docker
# Install Molecule
- pip install 'molecule==2.17.0'
# Check Ansible version
- ansible --version
# Check Molecule version
- molecule --version
# Build the Docker images
- molecule create --scenario-name=$MOLECULE_SCENARIO
- molecule destroy --scenario-name=$MOLECULE_SCENARIO
script:
- molecule test --scenario-name=$MOLECULE_SCENARIO
branches:
only:
- master
- /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)([\.\-].*)?$/
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View File

@ -10,4 +10,4 @@ rules:
line-length: disable
# NOTE(retr0h): Templates no longer fail this lint rule.
# Uncomment if running old Molecule templates.
# truthy: disable
truthy: disable

139
README.md
View File

@ -1,38 +1,149 @@
Role Name
=========
Ansible Role: ctop
======================
A brief description of the role goes here.
[![Build Status](https://travis-ci.com/gantsign/ansible_role_ctop.svg?branch=master)](https://travis-ci.com/gantsign/ansible_role_ctop)
[![Ansible Galaxy](https://img.shields.io/badge/ansible--galaxy-gantsign.ctop-blue.svg)](https://galaxy.ansible.com/gantsign/ctop)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/gantsign/ansible_role_ctop/master/LICENSE)
Role to download and install [ctop](https://ctop.sh) the top-like interface for
container metrics. View CPU, RAM and network I/O for your Docker containers at
a glance from your terminal.
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.
* Ansible >= 2.4
* Linux Distribution
* Debian Family
* Debian
* Jessie (8)
* Stretch (9)
* Ubuntu
* Trusty (14.04)
* Xenial (16.04)
* Bionic (18.04)
* RedHat Family
* CentOS
* 7
* Fedora
* 28
* SUSE Family
* OpenSUSE
* 42.2
* Note: other versions are likely to work but have not been tested.
* Docker (already installed)
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.
The following variables will change the behavior of this role (default values
are shown below):
Dependencies
------------
```yaml
# ctop version number
ctop_version: '0.7.1'
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.
# SHA256 sum for the ctop redistributable
ctop_redis_sha256sum: '38cfd92618ba2d92e0e1262c0c43d7690074b4b8dc77844b654f8e565166b577'
# Directory to store files downloaded for ctop
ctop_download_dir: "{{ x_ansible_download_dir | default(ansible_env.HOME + '/.ansible/tmp/downloads') }}"
```
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:
```yaml
- hosts: servers
roles:
- role: gantsign.ctop
```
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
Tab Completion for Zsh
----------------------
### Using Ansible
We recommend using the
[gantsign.antigen](https://galaxy.ansible.com/gantsign/antigen) role to enable
tab completion for ctop (this must be configured for each user).
```yaml
- hosts: servers
roles:
- role: gantsign.ctop
- role: gantsign.antigen
users:
- username: example
antigen_bundles:
- name: ctop
url: gantsign/zsh-plugins
location: ctop
```
### Using Antigen
If you prefer to use [Antigen](https://github.com/zsh-users/antigen) directly
add the following to your Antigen configuration:
```bash
antigen bundle gantsign/zsh-plugins ctop
```
More Roles From GantSign
------------------------
You can find more roles from GantSign on
[Ansible Galaxy](https://galaxy.ansible.com/gantsign).
Development & Testing
---------------------
This project uses [Molecule](http://molecule.readthedocs.io/) to aid in the
development and testing; the role is unit tested using
[Testinfra](http://testinfra.readthedocs.io/) and
[pytest](http://docs.pytest.org/).
To develop or test you'll need to have installed the following:
* Linux (e.g. [Ubuntu](http://www.ubuntu.com/))
* [Docker](https://www.docker.com/)
* [Python](https://www.python.org/) (including python-pip)
* [Ansible](https://www.ansible.com/)
* [Molecule](http://molecule.readthedocs.io/)
To test this role run the following command from the project root:
```bash
molecule test
```
License
-------
BSD
MIT
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
John Freeman
GantSign Ltd.
Company No. 06109112 (registered in England)

View File

@ -1,2 +1,9 @@
---
# defaults file for ansible_role_ctop
# ctop version number
ctop_version: '0.7.1'
# SHA256 sum for the ctop redistributable
ctop_redis_sha256sum: '38cfd92618ba2d92e0e1262c0c43d7690074b4b8dc77844b654f8e565166b577'
# Directory to store files downloaded for ctop
ctop_download_dir: "{{ x_ansible_download_dir | default(ansible_env.HOME + '/.ansible/tmp/downloads') }}"

View File

@ -1,2 +1,2 @@
---
# handlers file for ansible_role_ctop
# handlers file for ansible_role_ctop

View File

@ -1,57 +1,29 @@
---
galaxy_info:
author: your name
description: your description
company: your company (optional)
# 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
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 1.2
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
#
# platforms is a list of platforms, and each platform has a name and a list of versions.
#
# platforms:
# - 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.
author: John Freeman
role_name: ctop
description: Ansible role for downloading and installing ctop.
company: GantSign Ltd.
license: MIT
min_ansible_version: 2.4
platforms:
- name: EL
versions:
- 7
- name: Fedora
versions:
- 28
- name: Ubuntu
versions:
- trusty
- xenial
- bionic
- name: Debian
versions:
- jessie
- stretch
galaxy_tags:
- ctop
- docker
- development
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@ -0,0 +1,14 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi

View File

@ -0,0 +1,26 @@
*******
Docker driver installation guide
*******
Requirements
============
* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
* Docker Engine
* docker-py
* docker
Install
=======
Ansible < 2.6
.. code-block:: bash
$ sudo pip install docker-py
Ansible >= 2.6
.. code-block:: bash
$ sudo pip install docker

View File

@ -0,0 +1,29 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: ansible_role_ctop_centos
image: centos:7
provisioner:
name: ansible
playbooks:
converge: ../default/playbook.yml
lint:
name: ansible-lint
scenario:
name: centos
verifier:
name: testinfra
directory: ../default/tests
lint:
name: flake8

View File

@ -0,0 +1,14 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi

View File

@ -0,0 +1,26 @@
*******
Docker driver installation guide
*******
Requirements
============
* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
* Docker Engine
* docker-py
* docker
Install
=======
Ansible < 2.6
.. code-block:: bash
$ sudo pip install docker-py
Ansible >= 2.6
.. code-block:: bash
$ sudo pip install docker

View File

@ -0,0 +1,29 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: ansible_role_ctop_debian_max
image: debian:9
provisioner:
name: ansible
playbooks:
converge: ../default/playbook.yml
lint:
name: ansible-lint
scenario:
name: debian_max
verifier:
name: testinfra
directory: ../default/tests
lint:
name: flake8

View File

@ -0,0 +1,14 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi

View File

@ -0,0 +1,26 @@
*******
Docker driver installation guide
*******
Requirements
============
* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
* Docker Engine
* docker-py
* docker
Install
=======
Ansible < 2.6
.. code-block:: bash
$ sudo pip install docker-py
Ansible >= 2.6
.. code-block:: bash
$ sudo pip install docker

View File

@ -0,0 +1,29 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: ansible_role_ctop_debian_min
image: debian:8
provisioner:
name: ansible
playbooks:
converge: ../default/playbook.yml
lint:
name: ansible-lint
scenario:
name: debian_min
verifier:
name: testinfra
directory: ../default/tests
lint:
name: flake8

View File

@ -1,19 +1,25 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: instance
image: centos:7
- name: ansible_role_ctop_default
image: ubuntu:18.04
provisioner:
name: ansible
lint:
name: ansible-lint
scenario:
name: default
verifier:
name: testinfra
lint:

View File

@ -1,14 +0,0 @@
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_hosts_file(host):
f = host.file('/etc/hosts')
assert f.exists
assert f.user == 'root'
assert f.group == 'root'

View File

@ -0,0 +1,30 @@
import os
import testinfra.utils.ansible_runner
import re
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_dir(host):
dir = host.file('/usr/local/bin')
assert dir.exists
assert dir.is_directory
assert dir.user == 'root'
assert dir.group == 'root'
def test_file(host):
installed_file = host.file('/usr/local/bin/ctop')
assert installed_file.exists
assert installed_file.is_file
assert installed_file.user == 'root'
assert installed_file.group == 'root'
def test_version(host):
version = host.check_output('ctop -v')
pattern = 'ctop version [0-9\\.]+'
assert re.search(pattern, version)

View File

@ -0,0 +1,14 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi

View File

@ -0,0 +1,26 @@
*******
Docker driver installation guide
*******
Requirements
============
* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
* Docker Engine
* docker-py
* docker
Install
=======
Ansible < 2.6
.. code-block:: bash
$ sudo pip install docker-py
Ansible >= 2.6
.. code-block:: bash
$ sudo pip install docker

View File

@ -0,0 +1,29 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: ansible_role_ctop_fedora
image: fedora:28
provisioner:
name: ansible
playbooks:
converge: ../default/playbook.yml
lint:
name: ansible-lint
scenario:
name: fedora
verifier:
name: testinfra
directory: ../default/tests
lint:
name: flake8

View File

@ -0,0 +1,14 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi

View File

@ -0,0 +1,26 @@
*******
Docker driver installation guide
*******
Requirements
============
* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
* Docker Engine
* docker-py
* docker
Install
=======
Ansible < 2.6
.. code-block:: bash
$ sudo pip install docker-py
Ansible >= 2.6
.. code-block:: bash
$ sudo pip install docker

View File

@ -0,0 +1,29 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: ansible_role_ctop_opensuse
image: opensuse:42.2
provisioner:
name: ansible
playbooks:
converge: ../default/playbook.yml
lint:
name: ansible-lint
scenario:
name: opensuse
verifier:
name: testinfra
directory: ../default/tests
lint:
name: flake8

View File

@ -0,0 +1,14 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi

View File

@ -0,0 +1,26 @@
*******
Docker driver installation guide
*******
Requirements
============
* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
* Docker Engine
* docker-py
* docker
Install
=======
Ansible < 2.6
.. code-block:: bash
$ sudo pip install docker-py
Ansible >= 2.6
.. code-block:: bash
$ sudo pip install docker

View File

@ -0,0 +1,29 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: ansible_role_ctop_ubuntu_max
image: ubuntu:18.04
provisioner:
name: ansible
playbooks:
converge: ../default/playbook.yml
lint:
name: ansible-lint
scenario:
name: ubuntu_max
verifier:
name: testinfra
directory: ../default/tests
lint:
name: flake8

View File

@ -0,0 +1,14 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi

View File

@ -0,0 +1,26 @@
*******
Docker driver installation guide
*******
Requirements
============
* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
* Docker Engine
* docker-py
* docker
Install
=======
Ansible < 2.6
.. code-block:: bash
$ sudo pip install docker-py
Ansible >= 2.6
.. code-block:: bash
$ sudo pip install docker

View File

@ -0,0 +1,29 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: ansible_role_ctop_ubuntu_min
image: ubuntu:14.04
provisioner:
name: ansible
playbooks:
converge: ../default/playbook.yml
lint:
name: ansible-lint
scenario:
name: ubuntu_min
verifier:
name: testinfra
directory: ../default/tests
lint:
name: flake8

View File

@ -1,2 +1,31 @@
---
# tasks file for ansible_role_ctop
- name: create download directory
file:
state: directory
mode: 'u=rwx,go=rx'
dest: '{{ ctop_download_dir }}'
- name: download ctop
get_url:
url: '{{ ctop_mirror }}/{{ ctop_redis_filename }}'
dest: '{{ ctop_download_dir }}/{{ ctop_redis_filename }}'
checksum: 'sha256:{{ ctop_redis_sha256sum }}'
mode: 'u=rw,go=r'
- name: create the ctop installation dir
become: yes
file:
state: directory
owner: root
group: root
mode: 'u=rwx,go=rx'
dest: '{{ ctop_install_dir }}'
- name: install ctop
become: yes
copy:
src: '{{ ctop_download_dir }}/{{ ctop_redis_filename }}'
remote_src: yes
dest: '{{ ctop_install_path }}'
force: yes
mode: 'u=rwx,go=rx'

View File

@ -1,2 +0,0 @@
localhost

View File

@ -1,5 +0,0 @@
---
- hosts: localhost
remote_user: root
roles:
- ansible_role_ctop

View File

@ -1,2 +1,18 @@
---
# vars file for ansible_role_ctop
# Dir where ctop should be installed
ctop_install_dir: '/usr/local/bin'
# Path where ctop should be installed
ctop_install_path: '{{ ctop_install_dir }}/ctop'
# Mirror to download the ctop from
ctop_mirror: 'https://github.com/bcicen/ctop/releases/download/v{{ ctop_version }}'
# The OS of the ctop redistributable
ctop_os: 'linux'
# The CPU architecture of the ctop redistributable
ctop_architecture: 'amd64'
# File name of the ctop redistributable file
ctop_redis_filename: 'ctop-{{ ctop_version }}-{{ ctop_os }}-{{ ctop_architecture }}'