Skip to content

Commit

Permalink
upd: Global refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
jtprogru committed Jul 1, 2023
1 parent 2541922 commit 6cb243b
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 41 deletions.
25 changes: 16 additions & 9 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
---
profile: production

exclude_paths:
- ./molecule/
- ./.github/
- .github/
- molecule/
- venv/

parseable: true
quiet: true
quiet: false

skip_list:
- '401'
- '204'
- '403'
- '702'
- '305'
- "401"
- "204"
- "403"
- "702"
- "305"

use_default_rules: true
verbosity: 1
verbosity: 3
2 changes: 1 addition & 1 deletion .github/settings.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
repository:
description: Prepare your system to be managed by Ansible.
homepage: https://savinmi.ru/
homepage: https://s11l.me/
topics: bootstrap, python, sudo, ansible, molecule, playbook
8 changes: 4 additions & 4 deletions .github/workflows/galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: Release to Ansible Galaxy

on:
"on":
release:
types: [created, edited, published, released]
types: [ created, edited, published, released ]

jobs:
release:
Expand All @@ -13,12 +13,12 @@ jobs:
- name: Check out the codebase.
uses: actions/checkout@v2
with:
path: 'jtprogru.sample_role'
path: "jtprogru.sample_role"

- name: Set up Python 3.
uses: actions/setup-python@v2
with:
python-version: '3.x'
python-version: "3.x"

- name: Install Ansible.
run: pip3 install ansible
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

name: Ansible Molecule

on:
"on":
push:
tags-ignore:
- '*'
- "*"
pull_request:
schedule:
- cron: '3 2 2 * *'
- cron: "3 2 2 * *"

jobs:
lint:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/todo.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
name: "TODO 2 Issue"

on:
"on":
push:


jobs:
build:
runs-on: "ubuntu-20.04"
Expand Down
1 change: 1 addition & 0 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
ignore: |
.github/*
molecule/*
venv/*

extends: default

Expand Down
64 changes: 64 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# yaml-language-server: $schema=https://taskfile.dev/schema.json
---
version: "3"

set:
- pipefail

silent: true

tasks:
default:
desc: Show help
silent: true
cmds:
- task --list --color

venv:
desc: Create python3 virtual environment
preconditions:
- test -f $(which python3)
cmds:
- $(which python3) -m venv venv
- ./venv/bin/python -m pip install --upgrade pip

install:pip:
desc: Install python requirements
deps:
- venv
preconditions:
- test -d ./venv
- test -f requirements.txt
cmds:
- ./venv/bin/pip install -r requirements.txt

anslint:
desc: Run ansible-lint
deps:
- install:pip
preconditions:
- test -f ./venv/bin/ansible-lint
cmds:
- ./venv/bin/ansible-lint --force-color .

ymllint:
desc: Run yamllint
deps:
- install:pip
preconditions:
- test -f ./venv/bin/yamllint
cmds:
- ./venv/bin/yamllint --format auto --strict .

lint:
desc: Run all linters
cmds:
- task: ymllint
- task: anslint

test:
desc: Run test for this role
deps:
- lint
cmds:
- echo "Oooops... Need to implement!"
22 changes: 11 additions & 11 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ galaxy_info:
namespace: jtprogru
author: Michael Savin
description: This is sample ansible role used me as boilerplate
company: SysOps
company: Bear on server

# 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
issue_tracker_url: https://github.com/jtprogru/sample-role/issues

# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
Expand All @@ -18,7 +18,7 @@ galaxy_info:
# - CC-BY-4.0
license: WTFPL

min_ansible_version: 2.9
min_ansible_version: "2.9"

# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
Expand All @@ -41,19 +41,19 @@ galaxy_info:
# - 7
# - 99.99

# 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.
galaxy_tags:
- sample
- role
- example
- sample-role
- example-role
# 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.

# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
16 changes: 6 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# These role have been tested with these PIP component.
# To install the required version yourself, use a command as:
# `python -m pip --user install -r requirements.txt`
# See the pip requirements file documentation for details:
# https://pip.pypa.io/en/stable/user_guide/#requirements-files
#
# Tests run on the previous and current (latest) version of Ansible.
ansible>=2.10
# Some Jinja2 filters are used that are available in the newer releases.
jinja2>=2.11.2
ansible==7.5.0
ansible-core==2.14.5
ansible-lint==6.17.2
black==23.3.0
jmespath==1.0.1
yamllint==1.31.0
4 changes: 2 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
# tasks file for sample-role
- name: sample_role | sample ping
ping:
- name: Sample ping
ansible.builtin.ping:

0 comments on commit 6cb243b

Please sign in to comment.