You've already forked ansible-role-automysqlbackup
Initial commit
This commit is contained in:
6
.ansible-lint
Normal file
6
.ansible-lint
Normal file
@@ -0,0 +1,6 @@
|
||||
profile: basic
|
||||
|
||||
skip_list: # or 'skip_list' to silence them completely
|
||||
- experimental # all rules tagged as experimental
|
||||
- unnamed-task # All tasks should be named
|
||||
- fqcn-builtins
|
||||
104
.github/workflows/CI.yml
vendored
Normal file
104
.github/workflows/CI.yml
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
---
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
tags:
|
||||
- "!**"
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
cache: 'pip' # caching pip dependencies
|
||||
|
||||
- name: Ensure requirements are installed
|
||||
run: pip install -r requirements.txt
|
||||
|
||||
- name: Lint with ansible-lint
|
||||
run: ansible-lint --exclude ./tests -c ".ansible-lint"
|
||||
env:
|
||||
PY_COLORS: '1'
|
||||
ANSIBLE_FORCE_COLOR: '1'
|
||||
- name: Lint with yamllint
|
||||
run: yamllint .
|
||||
env:
|
||||
PY_COLORS: '1'
|
||||
ANSIBLE_FORCE_COLOR: '1'
|
||||
molecule:
|
||||
name: Molecule Test
|
||||
runs-on: ubuntu-latest
|
||||
needs: lint
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
os: [almalinux8, almalinux9]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
cache: 'pip' # caching pip dependencies
|
||||
- name: Ensure requirements are installed
|
||||
run: pip install -r requirements.txt
|
||||
- name: Run Molecule tests.
|
||||
run: molecule test
|
||||
env:
|
||||
PY_COLORS: '1'
|
||||
ANSIBLE_FORCE_COLOR: '1'
|
||||
MOLECULE_DISTRO: ${{ matrix.os }}
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- lint
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.22'
|
||||
- run: |
|
||||
echo "github repo: ${GITHUB_REPOSITORY}"
|
||||
echo "env vars: $(env)"
|
||||
- uses: go-semantic-release/action@v1
|
||||
with:
|
||||
custom-arguments: --provider=gitea
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.G_TOKEN }}
|
||||
GITEA_HOST: ${{ secrets.G_SERVER_URL}}
|
||||
notify:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- lint
|
||||
- release
|
||||
steps:
|
||||
- name: ntfy-success-notifications
|
||||
uses: niniyas/ntfy-action@master
|
||||
if: success()
|
||||
with:
|
||||
url: '${{ vars.NTFY_URL }}'
|
||||
title: Workflow success for ${GITHUB_REPOSITORY}
|
||||
topic: 'ci-status'
|
||||
priority: 4
|
||||
tags: +1,partying_face,action,successfully,completed
|
||||
details: Workflow has been successfully completed!
|
||||
icon: 'https://styles.redditmedia.com/t5_32uhe/styles/communityIcon_xnt6chtnr2j21.png'
|
||||
image: true
|
||||
|
||||
- name: ntfy-failed-notifications
|
||||
uses: niniyas/ntfy-action@master
|
||||
if: failure()
|
||||
with:
|
||||
url: '${{ vars.NTFY_URL }}'
|
||||
title: Workflow failed for ${GITHUB_REPOSITORY}
|
||||
topic: 'ci-status'
|
||||
priority: 5
|
||||
tags: -1,skull,action,failed
|
||||
details: Workflow has failed!
|
||||
actions: 'default'
|
||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
**/*.bak
|
||||
|
||||
39
README.md
Normal file
39
README.md
Normal file
@@ -0,0 +1,39 @@
|
||||
%role_name%
|
||||
=========
|
||||
|
||||
%role_description%
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
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.
|
||||
|
||||
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:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
%author_name%
|
||||
|
||||
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
||||
2
defaults/main.yml
Normal file
2
defaults/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# defaults file for template_role
|
||||
2
handlers/main.yml
Normal file
2
handlers/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# handlers file for template_role
|
||||
54
meta/main.yml
Normal file
54
meta/main.yml
Normal file
@@ -0,0 +1,54 @@
|
||||
galaxy_info:
|
||||
author: %author_name%
|
||||
role_name: %role_name%
|
||||
description: %role_description%
|
||||
company: %company_name%
|
||||
namespace: %namespace%
|
||||
|
||||
# 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
|
||||
|
||||
# Choose a valid license ID from https://spdx.org - some suggested licenses:
|
||||
# - BSD-3-Clause (default)
|
||||
# - MIT
|
||||
# - GPL-2.0-or-later
|
||||
# - GPL-3.0-only
|
||||
# - Apache-2.0
|
||||
# - CC-BY-4.0
|
||||
license: license (GPL-2.0-or-later, MIT, etc)
|
||||
|
||||
min_ansible_version: 2.1
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
#
|
||||
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
#
|
||||
# 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.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
8
molecule/default/converge.yml
Normal file
8
molecule/default/converge.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Replace this task with one that validates your content
|
||||
ansible.builtin.debug:
|
||||
msg: "This is the effective test"
|
||||
35
molecule/default/create.yml
Normal file
35
molecule/default/create.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
- name: Create
|
||||
hosts: localhost
|
||||
connection: local
|
||||
gather_facts: false
|
||||
# no_log: "{{ molecule_no_log }}"
|
||||
tasks:
|
||||
# TODO: Developer must implement and populate 'server' variable
|
||||
|
||||
- name: Create instance config
|
||||
when: server.changed | default(false) | bool # noqa no-handler
|
||||
block:
|
||||
- name: Populate instance config dict # noqa jinja
|
||||
ansible.builtin.set_fact:
|
||||
instance_conf_dict: {}
|
||||
# instance': "{{ }}",
|
||||
# address': "{{ }}",
|
||||
# user': "{{ }}",
|
||||
# port': "{{ }}",
|
||||
# 'identity_file': "{{ }}", }
|
||||
with_items: "{{ server.results }}"
|
||||
register: instance_config_dict
|
||||
|
||||
- name: Convert instance config dict to a list
|
||||
ansible.builtin.set_fact:
|
||||
instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}"
|
||||
|
||||
- name: Dump instance config
|
||||
ansible.builtin.copy:
|
||||
content: |
|
||||
# Molecule managed
|
||||
|
||||
{{ instance_conf | to_json | from_json | to_yaml }}
|
||||
dest: "{{ molecule_instance_config }}"
|
||||
mode: "0600"
|
||||
24
molecule/default/destroy.yml
Normal file
24
molecule/default/destroy.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
- name: Destroy
|
||||
hosts: localhost
|
||||
connection: local
|
||||
gather_facts: false
|
||||
# no_log: "{{ molecule_no_log }}"
|
||||
tasks:
|
||||
# Developer must implement.
|
||||
|
||||
# Mandatory configuration for Molecule to function.
|
||||
|
||||
- name: Populate instance config
|
||||
ansible.builtin.set_fact:
|
||||
instance_conf: {}
|
||||
|
||||
- name: Dump instance config
|
||||
ansible.builtin.copy:
|
||||
content: |
|
||||
# Molecule managed
|
||||
|
||||
{{ instance_conf | to_json | from_json | to_yaml }}
|
||||
dest: "{{ molecule_instance_config }}"
|
||||
mode: "0600"
|
||||
when: server.changed | default(false) | bool # noqa no-handler
|
||||
19
molecule/default/molecule.yml
Normal file
19
molecule/default/molecule.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
dependency:
|
||||
name: galaxy
|
||||
driver:
|
||||
name: docker
|
||||
platforms:
|
||||
- name: molecule-${MOLECULE_DISTRO:-almalinux8}
|
||||
image: "cybercinch/docker-${MOLECULE_DISTRO:-almalinux8}-ansible:latest"
|
||||
command: ${MOLECULE_DOCKER_COMMAND:-""}
|
||||
volumes:
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
||||
cgroupns_mode: host
|
||||
privileged: true
|
||||
pre_build_image: true
|
||||
provisioner:
|
||||
name: ansible
|
||||
env:
|
||||
MOLECULE_NO_LOG: true
|
||||
|
||||
6
requirements.txt
Normal file
6
requirements.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
ansible-core<2.17
|
||||
ansible-compat >= 4
|
||||
molecule[docker]== 24.2.1
|
||||
ansible-lint==24.2.2
|
||||
yamllint==1.35.1
|
||||
passlib==1.7.4
|
||||
29
scripts/rename.sh
Executable file
29
scripts/rename.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
|
||||
#!/bin/bash
|
||||
# Ask the user for their name
|
||||
echo What is your name? e.g Joe Bloggs
|
||||
read varname
|
||||
echo What is your Company/Org name?
|
||||
read varorg
|
||||
echo What is this roles name?
|
||||
read varrolename
|
||||
echo Please enter a description for this role
|
||||
read vardesc
|
||||
echo What is your galaxy namespace? e.g cybercinch
|
||||
read varnamespace
|
||||
echo -n "Updating role information..."
|
||||
sed -i -e "s/%author_name%/${varname}/g" \
|
||||
-e "s/%role_description%/${vardesc}/g" \
|
||||
-e "s/%company_name%/${varorg}/g" \
|
||||
-e "s/%role_name%/${varrolename}/g" \
|
||||
-e "s/%namespace%/${varnamespace}/g" \
|
||||
meta/main.yml
|
||||
|
||||
sed -i -e "s/%author_name%/${varname}/g" \
|
||||
-e "s/%role_name%/${varrolename}/g" \
|
||||
README.md
|
||||
echo "done"
|
||||
|
||||
echo "Now finish any remaining changes in meta/main.yml and README.md"
|
||||
echo "Once that is completed commit and happy developing!"
|
||||
|
||||
2
tasks/main.yml
Normal file
2
tasks/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# tasks file for template_role
|
||||
2
vars/main.yml
Normal file
2
vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# vars file for template_role
|
||||
Reference in New Issue
Block a user