Skip to content
Snippets Groups Projects
Commit 2c33ed47 authored by nimrod's avatar nimrod
Browse files

Move to GitLab, deprecation and remove TravisCI.

- Update pre-commit hooks.
- Fix complaints from pre-commit.
- Remove checks for the ldap_attr, I'm not going to check it.
- Remove TravisCI (left the file for future reference).
- Add note about project deprecation and replacement.
- Add GitLab CI with pre-commit.
parent d7656c81
No related branches found
No related tags found
No related merge requests found
Pipeline #253 passed
---
image: adarnimrod/ci-images:docker
stages:
- lint
pre-commit:
stage: lint
image: adarnimrod/ci-images:pre-commit
variables:
XDG_CACHE_HOME: "$CI_PROJECT_DIR/.cache"
before_script:
# yamllint disable-line rule:line-length
- git clone https://git.shore.co.il/ansible/debian-bootstrap.git tests/roles/debian-bootstrap
script:
- pre-commit run --all-files
cache:
paths:
- .cache/
- repo: git://github.com/pre-commit/pre-commit-hooks ---
sha: v0.8.0 repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks: hooks:
- id: check-added-large-files - id: check-added-large-files
- id: check-yaml - id: check-executables-have-shebangs
- id: check-merge-conflict - id: check-merge-conflict
- id: flake8
- repo: https://github.com/adarnimrod/shell-pre-commit - repo: https://github.com/adarnimrod/shell-pre-commit
sha: v0.5.4 rev: v0.6.0
hooks: hooks:
- id: shell-lint - id: shell-lint
files: &shellscripts collectd/collectd_facts|nginx/nginx_facts|ssl/dhparams
- id: shellcheck - id: shellcheck
files: *shellscripts
- repo: https://github.com/adarnimrod/ansible-pre-commit.git - repo: https://github.com/adarnimrod/ansible-pre-commit
sha: v0.6.0 rev: v0.10.0
hooks: hooks:
- id: ansible-syntax-check - id: ansible-syntax-check
files: &playbook tests/playbook.yaml files: tests/playbook.yaml
- repo: https://github.com/willthames/ansible-lint
sha: v3.4.13 - repo: https://github.com/myint/rstcheck
rev: master
hooks: hooks:
- id: ansible-lint - id: rstcheck
files: *playbook
- repo: https://github.com/adrienverge/yamllint
rev: v1.25.0
hooks:
- id: yamllint
ansible-modules ansible-modules
############### ###############
.. image:: https://travis-ci.org/adarnimrod/ansible-modules.svg?branch=master .. image:: https://git.shore.co.il/ansible/ansible-modules/badges/master/pipeline.svg
:target: https://travis-ci.org/adarnimrod/ansible-modules :target: https://git.shore.co.il/ansible/ansible-modules/-/commits/master
:alt: pipeline status
A repository of Ansible modules. A repository of Ansible modules.
This project is deprecated. All of the modules in this repo have equivalents in
the Ansible project making them obsolete. Right now the only tests that are done
are linters with pre-commit.
Installation Installation
------------ ------------
...@@ -30,10 +35,10 @@ Remember to commit :code:`.gitmodules`! ...@@ -30,10 +35,10 @@ Remember to commit :code:`.gitmodules`!
Modules Modules
------- -------
- collectd_facts - collectd_facts (use the :code:`package_facts` module instead)
- ldap_attr - ldap_attr (has been accepted in to the Ansible project)
- nginx_facts - nginx_facts (use the :code:`package_facts` module instead)
- dhparams - dhparams (use the :code:`openssl_dhparams` module instead)
Usage Usage
----- -----
...@@ -50,11 +55,10 @@ Testing ...@@ -50,11 +55,10 @@ Testing
------- -------
Modules are tested on Ubuntu Precise, Trusty and Xenial and Debian Wheezy, Modules are tested on Ubuntu Precise, Trusty and Xenial and Debian Wheezy,
Jessie and Stretch with Ansible version 2.0.2.0, 2.1.6.0, 2.2.3.0 and 2.3.1.0 Jessie and Stretch with Ansible version 2.0.2.0, 2.1.6.0, 2.2.3.0 and 2.3.1.0.
in `TravisCI <https://travis-ci.org/adarnimrod/ansible-modules>`_. To tests The tests require `Tox <https://tox.readthedocs.io/>`_ and `Docker
require `Tox <https://tox.readthedocs.io/>`_ and `Docker <https://docker.com>`_. `Pre-commit <http://pre-commit.com/>`_ is also setup for
<https://docker.com>`_. `Pre-commit <http://pre-commit.com/>`_ is also setup this project.
for this project.
Author Author
------ ------
...@@ -62,7 +66,7 @@ Author ...@@ -62,7 +66,7 @@ Author
Nimrod Adar, `contact me <nimrod@shore.co.il>`_ or visit my `website Nimrod Adar, `contact me <nimrod@shore.co.il>`_ or visit my `website
<https://www.shore.co.il/>`_. Patches are welcome via `git send-email <https://www.shore.co.il/>`_. Patches are welcome via `git send-email
<http://git-scm.com/book/en/v2/Git-Commands-Email>`_. The repository is located <http://git-scm.com/book/en/v2/Git-Commands-Email>`_. The repository is located
at: https://www.shore.co.il/git/. at: https://git.shore.co.il/explore/.
TODO TODO
---- ----
......
...@@ -8,6 +8,6 @@ fail () ...@@ -8,6 +8,6 @@ fail ()
exit exit
} }
which collectd > /dev/null 2>&1 || fail "Can't find collectd executable." command -v collectd > /dev/null 2>&1 || fail "Can't find collectd executable."
collectd -h 2>&1 | sed -n 's/[a-zA-Z ]*\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/{"changed": false, "ansible_facts": {"collectd": {"major":\1, "minor":\2, "patch":\3, "version":"\1.\2.\3"}}}/p' collectd -h 2>&1 | sed -n 's/[a-zA-Z ]*\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/{"changed": false, "ansible_facts": {"collectd": {"major":\1, "minor":\2, "patch":\3, "version":"\1.\2.\3"}}}/p'
...@@ -8,6 +8,6 @@ fail () ...@@ -8,6 +8,6 @@ fail ()
exit exit
} }
which nginx > /dev/null 2>&1 || fail "Can't find nginx executable." command -v nginx > /dev/null 2>&1 || fail "Can't find nginx executable."
nginx -v 2>&1 | sed -n 's/[a-zA-Z :\/]*\([0-9]*\)\.\([0-9]*\)\.\([0-9]\)*.*$/{"changed": false, "ansible_facts": {"nginx": {"major":\1, "minor":\2, "patch":\3, "version":"\1.\2.\3"}}}/gp' nginx -v 2>&1 | sed -n 's/[a-zA-Z :\/]*\([0-9]*\)\.\([0-9]*\)\.\([0-9]\)*.*$/{"changed": false, "ansible_facts": {"nginx": {"major":\1, "minor":\2, "patch":\3, "version":"\1.\2.\3"}}}/gp'
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
apt: apt:
name: collectd-core name: collectd-core
state: latest state: latest
install_recommends: no install_recommends: false
- name: Collectd facts - name: Collectd facts
collectd_facts: collectd_facts:
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
- name: Assertions - name: Assertions
assert: assert:
that: that:
- collectd_facts|changed == False - collectd_facts|changed == false
- collectd.major is number - collectd.major is number
- collectd.minor is number - collectd.minor is number
- collectd.patch is number - collectd.patch is number
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
apt: apt:
name: nginx-light name: nginx-light
state: latest state: latest
install_recommends: no install_recommends: false
- name: Nginx facts - name: Nginx facts
nginx_facts: nginx_facts:
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
- name: Assertions - name: Assertions
assert: assert:
that: that:
- nginx_facts|changed == False - nginx_facts|changed == false
- nginx.major is number - nginx.major is number
- nginx.minor is number - nginx.minor is number
- nginx.patch is number - nginx.patch is number
......
--- ---
- hosts: localhost - hosts: localhost
connection: local connection: local
gather_facts: False gather_facts: false
become: False become: false
tasks: tasks:
- name: Assertion - name: Assertion
assert: assert:
...@@ -15,14 +15,20 @@ ...@@ -15,14 +15,20 @@
# consistency across different versions of Ansible. # consistency across different versions of Ansible.
command: 'docker rm -f ansible_modules_{{ distro }}_{{ release }}' command: 'docker rm -f ansible_modules_{{ distro }}_{{ release }}'
register: docker_rm register: docker_rm
failed_when: "docker_rm|failed and 'no such container' not in docker_rm.stderr|lower" failed_when: |-
docker_rm|failed and 'no such container' not in docker_rm.stderr|lower
changed_when: "'no such container' not in docker_rm.stderr|lower" changed_when: "'no such container' not in docker_rm.stderr|lower"
- name: Create Docker container - name: Create Docker container
# Use the command module instead of docker/ docker-container for # Use the command module instead of docker/ docker-container for
# consistency across different versions of Ansible. # consistency across different versions of Ansible.
command: 'docker run --detach --name ansible_modules_{{ distro }}_{{ release }} {{ distro }}:{{ release }} tail -f /.dockerenv' command: >-
changed_when: True docker run
--detach
--name ansible_modules_{{ distro }}_{{ release }}
{{ distro }}:{{ release }}
tail -f /.dockerenv
changed_when: true
- name: Add Docker container to inventory - name: Add Docker container to inventory
add_host: add_host:
...@@ -32,7 +38,7 @@ ...@@ -32,7 +38,7 @@
groups: containers groups: containers
- hosts: containers - hosts: containers
gather_facts: False gather_facts: false
roles: roles:
- name: debian-bootstrap - name: debian-bootstrap
post_tasks: post_tasks:
...@@ -42,13 +48,14 @@ ...@@ -42,13 +48,14 @@
- hosts: localhost - hosts: localhost
connection: local connection: local
become: False become: false
gather_facts: False gather_facts: false
tasks: tasks:
- name: Remove existing Docker container - name: Remove existing Docker container
# Use the command module instead of docker/ docker-container for # Use the command module instead of docker/ docker-container for
# consistency across different versions of Ansible. # consistency across different versions of Ansible.
command: 'docker rm -f ansible_modules_{{ distro }}_{{ release }}' command: 'docker rm -f ansible_modules_{{ distro }}_{{ release }}'
register: docker_rm register: docker_rm
failed_when: "docker_rm|failed and 'no such container' not in docker_rm.stderr|lower" failed_when: |-
docker_rm|failed and 'no such container' not in docker_rm.stderr|lower
changed_when: "'no such container' not in docker_rm.stderr|lower" changed_when: "'no such container' not in docker_rm.stderr|lower"
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
apt: apt:
name: openssl name: openssl
state: latest state: latest
install_recommends: no install_recommends: false
- name: DH params for missing file - name: DH params for missing file
ignore_errors: True ignore_errors: frue
dhparams: dhparams:
path: /etc/ssl/dhparams.pem path: /etc/ssl/dhparams.pem
register: missing_dhparams register: missing_dhparams
...@@ -19,12 +19,12 @@ ...@@ -19,12 +19,12 @@
assert: assert:
that: that:
- missing_dhparams.bits == 0 - missing_dhparams.bits == 0
- missing_dhparams|failed == True - missing_dhparams|failed == true
- missing_dhparams|changed == False - missing_dhparams|changed == false
- name: Generate DH params - name: Generate DH params
command: openssl dhparam -out /etc/ssl/dhparams.pem 2048 command: openssl dhparam -out /etc/ssl/dhparams.pem 2048
changed_when: True changed_when: true
- name: DH params for existing file - name: DH params for existing file
dhparams: dhparams:
...@@ -39,6 +39,6 @@ ...@@ -39,6 +39,6 @@
assert: assert:
that: that:
- existing_dhparams.bits == 2048 - existing_dhparams.bits == 2048
- existing_dhparams|failed == False - existing_dhparams|failed == false
- existing_dhparams|changed == False - existing_dhparams|changed == false
- existing_dhparams.path == '/etc/ssl/dhparams.pem' - existing_dhparams.path == '/etc/ssl/dhparams.pem'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment