Compare commits
No commits in common. "7d3a8d8f77c96a64dd9b677e90b57a916cad5d64" and "f4a48844487d487514d2cf006d730210915e8ff7" have entirely different histories.
7d3a8d8f77
...
f4a4884448
@ -3,4 +3,3 @@ skip_list:
|
|||||||
- yaml[empty-lines]
|
- yaml[empty-lines]
|
||||||
- yaml[line-length]
|
- yaml[line-length]
|
||||||
- no-changed-when
|
- no-changed-when
|
||||||
- galaxy[no-changelog]
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
export ANSIBLE_LINT_EXCLUSION="--exclude .gitea"
|
|
||||||
export ANSIBLE_INVENTORY="-i 127.0.0.1, --connection=local"
|
|
||||||
export ANSIBLE_PLAYBOOK="baseos.yml"
|
|
111
.drone.yml
111
.drone.yml
@ -1,111 +0,0 @@
|
|||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: CentOS_9-Ansible-Pipeline
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
exclude:
|
|
||||||
- main
|
|
||||||
event: [push]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: ansible_environment_verify
|
|
||||||
image: gitea.thezengarden.net/podman/ansible-dev/centos9:release
|
|
||||||
commands:
|
|
||||||
- . ./.drone.env
|
|
||||||
- env
|
|
||||||
- git log -1
|
|
||||||
- ansible --version
|
|
||||||
- ansible-lint --version
|
|
||||||
|
|
||||||
- name: ansible_lint
|
|
||||||
image: gitea.thezengarden.net/podman/ansible-dev/centos9:release
|
|
||||||
commands:
|
|
||||||
- . ./.drone.env
|
|
||||||
- ansible-lint --offline --nocolor $ANSIBLE_LINT_EXCLUSION
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: Fedora_39-Ansible-Pipeline
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
exclude:
|
|
||||||
- main
|
|
||||||
event: [push]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: ansible_environment_verify
|
|
||||||
image: gitea.thezengarden.net/podman/ansible-dev/fedora39:release
|
|
||||||
commands:
|
|
||||||
- . ./.drone.env
|
|
||||||
- env
|
|
||||||
- git log -1
|
|
||||||
- ansible --version
|
|
||||||
- ansible-lint --version
|
|
||||||
|
|
||||||
- name: ansible_lint
|
|
||||||
image: gitea.thezengarden.net/podman/ansible-dev/fedora39:release
|
|
||||||
commands:
|
|
||||||
- . ./.drone.env
|
|
||||||
- ansible-lint --offline --nocolor $ANSIBLE_LINT_EXCLUSION
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: Debian_11-Ansible-Pipeline
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
exclude:
|
|
||||||
- main
|
|
||||||
event: [push]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: ansible_environment_verify
|
|
||||||
image: gitea.thezengarden.net/podman/ansible-dev/debian11:release
|
|
||||||
commands:
|
|
||||||
- . ./.drone.env
|
|
||||||
- env
|
|
||||||
- git log -1
|
|
||||||
- ansible --version
|
|
||||||
- ansible-lint --version
|
|
||||||
|
|
||||||
- name: ansible_lint
|
|
||||||
image: gitea.thezengarden.net/podman/ansible-dev/debian11:release
|
|
||||||
commands:
|
|
||||||
- . ./.drone.env
|
|
||||||
- ansible-lint --offline --nocolor $ANSIBLE_LINT_EXCLUSION
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: Debian_12-Ansible-Pipeline
|
|
||||||
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
exclude:
|
|
||||||
- main
|
|
||||||
event: [push]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: ansible_environment_verify
|
|
||||||
image: gitea.thezengarden.net/podman/ansible-dev/debian12:release
|
|
||||||
commands:
|
|
||||||
- . ./.drone.env
|
|
||||||
- env
|
|
||||||
- git log -1
|
|
||||||
- ansible --version
|
|
||||||
- ansible-lint --version
|
|
||||||
|
|
||||||
- name: ansible_lint
|
|
||||||
image: gitea.thezengarden.net/podman/ansible-dev/debian12:release
|
|
||||||
commands:
|
|
||||||
- . ./.drone.env
|
|
||||||
- ansible-lint --offline --nocolor $ANSIBLE_LINT_EXCLUSION
|
|
@ -1,30 +0,0 @@
|
|||||||
name: Ansible Code Pipeline
|
|
||||||
run-name: ${{ gitea.actor }} is running Ansible Code Pipeline
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- testing
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
Ansible-Development-Pipeline:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ ansible-dev-centos9, ansible-dev-fedora39, ansible-dev-debian11, ansible-dev-debian12 ]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Clone repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Ansible Environment Verify
|
|
||||||
run: |
|
|
||||||
. ./.drone.env
|
|
||||||
env
|
|
||||||
git log -1
|
|
||||||
ansible --version
|
|
||||||
ansible-lint --version
|
|
||||||
|
|
||||||
- name: Run Ansible-Lint
|
|
||||||
run: |
|
|
||||||
. ./.drone.env
|
|
||||||
ansible-lint --offline --nocolor $ANSIBLE_LINT_EXCLUSION
|
|
@ -1,2 +0,0 @@
|
|||||||
[defaults]
|
|
||||||
roles_path = roles
|
|
11
galaxy.yml
11
galaxy.yml
@ -8,7 +8,7 @@ namespace: jchristianh
|
|||||||
name: baseos
|
name: baseos
|
||||||
|
|
||||||
# The version of the collection. Must be compatible with semantic versioning
|
# The version of the collection. Must be compatible with semantic versioning
|
||||||
version: 1.0.20
|
version: 1.0.17
|
||||||
|
|
||||||
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
|
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
|
||||||
readme: README.md
|
readme: README.md
|
||||||
@ -16,7 +16,7 @@ readme: README.md
|
|||||||
# A list of the collection's content authors. Can be just the name or in the format 'Full Name <email> (url)
|
# A list of the collection's content authors. Can be just the name or in the format 'Full Name <email> (url)
|
||||||
# @nicks:irc/im.site#channel'
|
# @nicks:irc/im.site#channel'
|
||||||
authors:
|
authors:
|
||||||
- Chris Hammer <chris@thezengarden.net>
|
- Chris Hammer <chris@thezengarden.net>
|
||||||
|
|
||||||
|
|
||||||
### OPTIONAL but strongly recommended
|
### OPTIONAL but strongly recommended
|
||||||
@ -25,8 +25,8 @@ description: A collection of roles to manage your environment.
|
|||||||
|
|
||||||
# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only
|
# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only
|
||||||
# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file'
|
# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file'
|
||||||
# license:
|
#license:
|
||||||
# - GPL-2.0-or-later
|
#- GPL-2.0-or-later
|
||||||
|
|
||||||
# The path to the license file for the collection. This path is relative to the root of the collection. This key is
|
# The path to the license file for the collection. This path is relative to the root of the collection. This key is
|
||||||
# mutually exclusive with 'license'
|
# mutually exclusive with 'license'
|
||||||
@ -34,8 +34,7 @@ license_file: 'LICENSE'
|
|||||||
|
|
||||||
# A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character
|
# A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character
|
||||||
# requirements as 'namespace' and 'name'
|
# requirements as 'namespace' and 'name'
|
||||||
tags:
|
tags: []
|
||||||
- linux
|
|
||||||
|
|
||||||
# Collections that this collection requires to be installed for it to be usable. The key of the dict is the
|
# Collections that this collection requires to be installed for it to be usable. The key of the dict is the
|
||||||
# collection label 'namespace.name'. The value is a version range
|
# collection label 'namespace.name'. The value is a version range
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
---
|
---
|
||||||
requires_ansible: ">=2.15.0"
|
requires_ansible: ">=2.14"
|
||||||
|
10
roles/base_packages/defaults/main.yml
Normal file
10
roles/base_packages/defaults/main.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
__project_author : Chris Hammer
|
||||||
|
__project_email : chris@thezengarden.net
|
||||||
|
__project_repo : https://github.com/jchristianh-ansible-collections/baseos
|
||||||
|
|
||||||
|
|
||||||
|
__template_header : The Zen Garden
|
||||||
|
|
||||||
|
|
||||||
|
...
|
@ -2,18 +2,18 @@
|
|||||||
- name: Include distribution specific variables or include defaults
|
- name: Include distribution specific variables or include defaults
|
||||||
block:
|
block:
|
||||||
- name: Include distribution specific variables
|
- name: Include distribution specific variables
|
||||||
ansible.builtin.include_vars:
|
include_vars:
|
||||||
file: "{{ ansible_distribution | lower }}_{{ ansible_distribution_major_version }}.yml"
|
file: "{{ ansible_distribution | lower }}_{{ ansible_distribution_major_version }}.yml"
|
||||||
|
|
||||||
|
|
||||||
rescue:
|
rescue:
|
||||||
- name: Non-supported distribution; using default package set
|
- name: Non-supported distribution; using default package set
|
||||||
ansible.builtin.include_vars:
|
include_vars:
|
||||||
file: default_packages.yml
|
file: __default_packages.yml
|
||||||
|
|
||||||
|
|
||||||
- name: Install EPEL for CentOS hosts - Required for some packages
|
- name: Install EPEL for CentOS hosts - Required for some of our packages
|
||||||
ansible.builtin.package:
|
package:
|
||||||
name : epel-release
|
name : epel-release
|
||||||
state : present
|
state : present
|
||||||
when:
|
when:
|
||||||
@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
|
|
||||||
- name: Install package set
|
- name: Install package set
|
||||||
ansible.builtin.package:
|
package:
|
||||||
name : "{{ base_packages_package_set }}"
|
name : "{{ __base_packages }}"
|
||||||
state : present
|
state : present
|
||||||
|
|
||||||
|
|
||||||
|
2
roles/base_packages/tests/inventory
Normal file
2
roles/base_packages/tests/inventory
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
5
roles/base_packages/tests/test.yml
Normal file
5
roles/base_packages/tests/test.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- base_packages
|
@ -5,7 +5,7 @@
|
|||||||
# Please adjust accordingly, or include a vars file matching the pattern:
|
# Please adjust accordingly, or include a vars file matching the pattern:
|
||||||
# <ansible_distribution>_<ansible_distribution_major_version>.yml
|
# <ansible_distribution>_<ansible_distribution_major_version>.yml
|
||||||
|
|
||||||
base_packages_package_set:
|
__base_packages:
|
||||||
- bc
|
- bc
|
||||||
- bzip2
|
- bzip2
|
||||||
- file
|
- file
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
base_packages_package_set:
|
__base_packages:
|
||||||
- bc
|
- bc
|
||||||
- bind-utils
|
- bind-utils
|
||||||
- bzip2
|
- bzip2
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
base_packages_package_set:
|
__base_packages:
|
||||||
- bc
|
- bc
|
||||||
- bind-utils
|
- bind-utils
|
||||||
- bzip2
|
- bzip2
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
base_packages_package_set:
|
__base_packages:
|
||||||
- bc
|
- bc
|
||||||
- bind-utils
|
- bind-utils
|
||||||
- bzip2
|
- bzip2
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
base_packages_package_set:
|
__base_packages:
|
||||||
- bc
|
- bc
|
||||||
- bind9utils
|
- bind9utils
|
||||||
- bzip2
|
- bzip2
|
||||||
|
2
roles/base_packages/vars/main.yml
Normal file
2
roles/base_packages/vars/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# vars file for base_packages
|
@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
- name: Deploy .bashrc
|
- name: Deploy .bashrc
|
||||||
ansible.builtin.copy:
|
copy:
|
||||||
src : files/bashrc
|
src : files/bashrc
|
||||||
dest : /root/.bashrc
|
dest : /root/.bashrc
|
||||||
mode : "0640"
|
mode : 0640
|
||||||
|
|
||||||
|
|
||||||
...
|
...
|
||||||
|
2
roles/bashrc/tests/inventory
Normal file
2
roles/bashrc/tests/inventory
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
5
roles/bashrc/tests/test.yml
Normal file
5
roles/bashrc/tests/test.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- bashrc
|
2
roles/default_services/tests/inventory
Normal file
2
roles/default_services/tests/inventory
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
5
roles/default_services/tests/test.yml
Normal file
5
roles/default_services/tests/test.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- default_services
|
@ -1,15 +1,15 @@
|
|||||||
---
|
---
|
||||||
etc_hosts_project_author : Chris Hammer
|
__project_author : Chris Hammer
|
||||||
etc_hosts_project_email : chris@thezengarden.net
|
__project_email : chris@thezengarden.net
|
||||||
etc_hosts_project_repo : https://github.com/jchristianh-ansible-collections/baseos
|
__project_repo : https://github.com/jchristianh-ansible-collections/baseos
|
||||||
|
|
||||||
|
|
||||||
etc_hosts_template_header : The Zen Garden
|
__template_header : The Zen Garden
|
||||||
|
|
||||||
|
|
||||||
etc_hosts_etc_hosts_file : /etc/hosts
|
__etc_hosts_file : /etc/hosts
|
||||||
etc_hosts_etc_hosts_version : 1.0.1
|
__etc_hosts_version : 1.0.0
|
||||||
etc_hosts_etc_hosts_revision : 231216
|
__etc_hosts_revision : 22314
|
||||||
|
|
||||||
|
|
||||||
...
|
...
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
---
|
---
|
||||||
- name: Set etc_hosts_etc_hosts_file if running in Docker
|
- name: Set etc_hosts_file if running in Docker
|
||||||
ansible.builtin.set_fact:
|
set_fact:
|
||||||
etc_hosts_etc_hosts_file: "{{ etc_hosts_etc_hosts_file }}.docker"
|
__etc_hosts_file: "{{ __etc_hosts_file }}.docker"
|
||||||
when:
|
when:
|
||||||
- ansible_virtualization_type | regex_search("docker|podman|container")
|
- ansible_virtualization_type | regex_search("docker|podman|container")
|
||||||
|
|
||||||
|
|
||||||
- name: Deploy {{ etc_hosts_etc_hosts_file }}
|
- name: Deploy {{ __etc_hosts_file }}
|
||||||
ansible.builtin.template:
|
template:
|
||||||
src: templates/etc_hosts.j2
|
src: templates/etc_hosts.j2
|
||||||
dest: "{{ etc_hosts_etc_hosts_file }}"
|
dest: "{{ __etc_hosts_file }}"
|
||||||
mode: "0644"
|
mode: 0644
|
||||||
|
|
||||||
|
|
||||||
...
|
...
|
||||||
|
0
roles/etc_hosts/templates/.keep
Normal file
0
roles/etc_hosts/templates/.keep
Normal file
@ -1,11 +1,11 @@
|
|||||||
###############################################
|
###############################################
|
||||||
# {{ etc_hosts_template_header }}
|
# {{ __template_header }}
|
||||||
###############################################
|
###############################################
|
||||||
#
|
#
|
||||||
# Configuration : {{ etc_hosts_etc_hosts_file }}
|
# Configuration : {{ __etc_hosts_file }}
|
||||||
# Template Version : {{ etc_hosts_etc_hosts_version }}-{{ etc_hosts_etc_hosts_revision }}
|
# Template Version : {{ __etc_hosts_version}}-{{ __etc_hosts_revision }}
|
||||||
#
|
#
|
||||||
# {{ etc_hosts_project_author }} ({{ etc_hosts_project_email }})
|
# {{ __project_author }} ({{ __project_email }})
|
||||||
###############################################
|
###############################################
|
||||||
|
|
||||||
|
|
||||||
@ -17,13 +17,13 @@
|
|||||||
|
|
||||||
# OUR PERSONAL INFO
|
# OUR PERSONAL INFO
|
||||||
#############################################
|
#############################################
|
||||||
{{ ansible_default_ipv4.address | default('127.0.0.1') }} {{ ansible_fqdn }} {{ ansible_hostname }} {{ inventory_hostname }}
|
{{ ansible_default_ipv4.address | default('127.0.0.1') }} {{ ansible_fqdn }} {{ ansible_hostname }} {{ inventory_hostname }}
|
||||||
|
|
||||||
|
|
||||||
{% if etc_hosts_custom_hosts is defined and etc_hosts_custom_hosts != '' %}
|
{% if custom_hosts is defined and custom_hosts != '' %}
|
||||||
# CUSTOM HOSTS:
|
# CUSTOM HOSTS:
|
||||||
#############################################
|
#############################################
|
||||||
{% for item in etc_hosts_custom_hosts %}
|
{% for item in custom_hosts %}
|
||||||
{{ item }}
|
{{ item }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
2
roles/etc_hosts/tests/inventory
Normal file
2
roles/etc_hosts/tests/inventory
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
5
roles/etc_hosts/tests/test.yml
Normal file
5
roles/etc_hosts/tests/test.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- etc_hosts
|
@ -1,46 +1,46 @@
|
|||||||
---
|
---
|
||||||
- name: Restart_syslog_centos_7
|
- name: restart_syslog_centos_7
|
||||||
ansible.builtin.service:
|
service:
|
||||||
name : rsyslog
|
name : rsyslog
|
||||||
state : restarted
|
state : restarted
|
||||||
|
|
||||||
- name: Restart_syslog_centos_8
|
- name: restart_syslog_centos_8
|
||||||
ansible.builtin.service:
|
service:
|
||||||
name : syslog
|
name : syslog
|
||||||
state : restarted
|
state : restarted
|
||||||
|
|
||||||
- name: Restart_syslog_centos_9
|
- name: restart_syslog_centos_9
|
||||||
ansible.builtin.service:
|
service:
|
||||||
name : rsyslog
|
name : rsyslog
|
||||||
state : restarted
|
state : restarted
|
||||||
|
|
||||||
- name: Restart_syslog_redhat_8
|
- name: restart_syslog_redhat_8
|
||||||
ansible.builtin.service:
|
service:
|
||||||
name : rsyslog
|
name : rsyslog
|
||||||
state : restarted
|
state : restarted
|
||||||
|
|
||||||
- name: Restart_syslog_redhat_9
|
- name: restart_syslog_redhat_9
|
||||||
ansible.builtin.service:
|
service:
|
||||||
name : rsyslog
|
name : rsyslog
|
||||||
state : restarted
|
state : restarted
|
||||||
|
|
||||||
- name: Restart_syslog_debian_11
|
- name: restart_syslog_debian_11
|
||||||
ansible.builtin.service:
|
service:
|
||||||
name : rsyslog
|
name : rsyslog
|
||||||
state : restarted
|
state : restarted
|
||||||
|
|
||||||
- name: Restart_syslog_debian_12
|
- name: restart_syslog_debian_12
|
||||||
ansible.builtin.service:
|
service:
|
||||||
name : rsyslog
|
name : rsyslog
|
||||||
state : restarted
|
state : restarted
|
||||||
|
|
||||||
- name: Restart_syslog_fedora_35
|
- name: restart_syslog_fedora_35
|
||||||
ansible.builtin.service:
|
service:
|
||||||
name : rsyslog
|
name : rsyslog
|
||||||
state : restarted
|
state : restarted
|
||||||
|
|
||||||
- name: Restart_syslog_fedora_38
|
- name: restart_syslog_fedora_38
|
||||||
ansible.builtin.service:
|
service:
|
||||||
name : rsyslog
|
name : rsyslog
|
||||||
state : started
|
state : started
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
- name: Set hostname for host
|
- name: Set hostname for host
|
||||||
ansible.builtin.hostname:
|
hostname:
|
||||||
name: "{{ inventory_hostname }}"
|
name: "{{ inventory_hostname }}"
|
||||||
notify:
|
notify:
|
||||||
- "Restart_syslog_{{ ansible_distribution | lower }}_{{ ansible_distribution_major_version }}"
|
- "restart_syslog_{{ ansible_distribution | lower }}_{{ ansible_distribution_major_version }}"
|
||||||
|
|
||||||
|
|
||||||
...
|
...
|
||||||
|
2
roles/hostname/tests/inventory
Normal file
2
roles/hostname/tests/inventory
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
5
roles/hostname/tests/test.yml
Normal file
5
roles/hostname/tests/test.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- hostname
|
@ -1,5 +1,16 @@
|
|||||||
---
|
---
|
||||||
motd_motd_file : /etc/motd
|
__project_author : Chris Hammer
|
||||||
|
__project_email : chris@thezengarden.net
|
||||||
|
__project_repo : https://github.com/jchristianh-ansible-collections/baseos
|
||||||
|
|
||||||
|
|
||||||
|
__template_header : The Zen Garden
|
||||||
|
|
||||||
|
|
||||||
|
__motd_file : /etc/motd
|
||||||
|
__motd_file_docker : /etc/motd
|
||||||
|
__motd_version : 1.0.0
|
||||||
|
__motd_revision : 22318
|
||||||
|
|
||||||
|
|
||||||
...
|
...
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
---
|
---
|
||||||
- name: Set host IP address or set a default
|
- name: Set host IP address or set a default
|
||||||
ansible.builtin.set_fact:
|
set_fact:
|
||||||
host_ip : "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
host_ip : "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
|
||||||
|
|
||||||
|
|
||||||
- name: Install Perl if needed
|
- name: Install Perl if needed
|
||||||
ansible.builtin.package:
|
package:
|
||||||
name : perl
|
name : perl
|
||||||
state : present
|
state : present
|
||||||
|
|
||||||
|
|
||||||
- name: Get system uptime from script
|
- name: Get system uptime from script
|
||||||
ansible.builtin.script:
|
script:
|
||||||
cmd : "scripts/get_uptime.pl {{ ansible_uptime_seconds }}"
|
cmd : "scripts/get_uptime.pl {{ ansible_uptime_seconds }}"
|
||||||
register : node_uptime
|
register : node_uptime
|
||||||
changed_when : false
|
changed_when : false
|
||||||
|
|
||||||
|
|
||||||
- name: Update MOTD
|
- name: Update MOTD
|
||||||
ansible.builtin.template:
|
template:
|
||||||
src : templates/motd.j2
|
src : templates/motd.j2
|
||||||
dest : "{{ motd_motd_file }}"
|
dest : "{{ __motd_file }}"
|
||||||
mode : "0644"
|
mode : 0644
|
||||||
changed_when : false
|
changed_when : false
|
||||||
|
|
||||||
|
|
||||||
|
0
roles/motd/templates/.keep
Normal file
0
roles/motd/templates/.keep
Normal file
2
roles/motd/tests/inventory
Normal file
2
roles/motd/tests/inventory
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
5
roles/motd/tests/test.yml
Normal file
5
roles/motd/tests/test.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- motd
|
2
roles/node_status/tests/inventory
Normal file
2
roles/node_status/tests/inventory
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
5
roles/node_status/tests/test.yml
Normal file
5
roles/node_status/tests/test.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- node_status
|
@ -1,19 +1,20 @@
|
|||||||
---
|
---
|
||||||
resolv_conf_project_author : Chris Hammer
|
__project_author : Chris Hammer
|
||||||
resolv_conf_project_email : chris@thezengarden.net
|
__project_email : chris@thezengarden.net
|
||||||
resolv_conf_project_repo : https://github.com/jchristianh-ansible-collections/baseos
|
__project_repo : https://github.com/jchristianh-ansible-collections/baseos
|
||||||
|
|
||||||
|
|
||||||
resolv_conf_template_header : The Zen Garden
|
__template_header : The Zen Garden
|
||||||
|
|
||||||
|
|
||||||
resolv_conf_resolv_conf_file : /etc/resolv.conf
|
__resolv_conf_file : /etc/resolv.conf
|
||||||
resolv_conf_resolv_conf_version : 1.0.1
|
__resolv_conf_file_docker : /etc/resolv.conf.docker
|
||||||
resolv_conf_resolv_conf_revision : 221007
|
__resolv_conf_version : 1.0.1
|
||||||
|
__resolv_conf_revision : 221007
|
||||||
|
|
||||||
|
|
||||||
resolv_conf_search_domain : thezengarden.net
|
__search_domain : thezengarden.net
|
||||||
resolv_conf_nameservers :
|
__nameservers :
|
||||||
- 10.10.10.55
|
- 10.10.10.55
|
||||||
- 10.1.1.15
|
- 10.1.1.15
|
||||||
|
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
---
|
---
|
||||||
- name: Set resolv_conf_file if running in container
|
- name: Set resolv_conf_file if running in Docker
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
resolv_conf_resolv_conf_file: "{{ resolv_conf_resolv_conf_file }}.docker"
|
__resolv_conf_file: "{{ __resolv_conf_file_docker }}"
|
||||||
when:
|
when:
|
||||||
- ansible_virtualization_type | regex_search("docker|podman|container")
|
- ansible_virtualization_type | regex_search("docker|podman|container")
|
||||||
|
|
||||||
|
|
||||||
- name: Deploy {{ resolv_conf_resolv_conf_file }}
|
- name: Deploy {{ __resolv_conf_file }}
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: templates/resolv_conf.j2
|
src: templates/resolv_conf.j2
|
||||||
dest: "{{ resolv_conf_resolv_conf_file }}"
|
dest: "{{ __resolv_conf_file }}"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
|
|
||||||
|
|
||||||
|
0
roles/resolv_conf/templates/.keep
Normal file
0
roles/resolv_conf/templates/.keep
Normal file
@ -1,15 +1,15 @@
|
|||||||
# {{ resolv_conf_template_header }}
|
# {{ __template_header }}
|
||||||
###############################################
|
###############################################
|
||||||
#
|
#
|
||||||
# Configuration : {{ resolv_conf_resolv_conf_file }}
|
# Configuration : {{ __resolv_conf_file }}
|
||||||
# Template Version : {{ resolv_conf_resolv_conf_version }}-{{ resolv_conf_resolv_conf_revision }}
|
# Template Version : {{ __resolv_conf_version}}-{{ __resolv_conf_revision }}
|
||||||
#
|
#
|
||||||
# {{ resolv_conf_project_author }} ({{ resolv_conf_project_email }})
|
# {{ __project_author }} ({{ __project_email }})
|
||||||
###############################################
|
###############################################
|
||||||
|
|
||||||
|
|
||||||
search {{ resolv_conf_search_domain }}
|
search {{ __search_domain }}
|
||||||
{% for item in resolv_conf_nameservers %}
|
{% for item in __nameservers %}
|
||||||
nameserver {{ item }}
|
nameserver {{ item }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
2
roles/resolv_conf/tests/inventory
Normal file
2
roles/resolv_conf/tests/inventory
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
5
roles/resolv_conf/tests/test.yml
Normal file
5
roles/resolv_conf/tests/test.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- resolv_conf
|
@ -1,23 +1,23 @@
|
|||||||
---
|
---
|
||||||
snmpd_conf_project_author : Chris Hammer
|
__project_author : Chris Hammer
|
||||||
snmpd_conf_project_email : chris@thezengarden.net
|
__project_email : chris@thezengarden.net
|
||||||
snmpd_conf_project_repo : https://github.com/jchristianh-ansible-collections/baseos
|
__project_repo : https://github.com/jchristianh-ansible-collections/baseos
|
||||||
|
|
||||||
|
|
||||||
snmpd_conf_template_header : The Zen Garden
|
__template_header : The Zen Garden
|
||||||
|
|
||||||
|
|
||||||
snmpd_conf_snmpd_conf_file : /etc/snmp/snmpd.conf
|
__snmpd_conf_file : /etc/snmp/snmpd.conf
|
||||||
snmpd_conf_snmpd_conf_version : 1.0.1
|
__snmpd_conf_version : 1.0.1
|
||||||
snmpd_conf_snmpd_conf_revision : 231210
|
__snmpd_conf_revision : 231210
|
||||||
|
|
||||||
|
|
||||||
snmpd_conf_snmp_pkg : net-snmp
|
__snmp_pkg : net-snmp
|
||||||
|
|
||||||
|
|
||||||
snmpd_conf_snmpd_location : 'Newport News, VA'
|
__snmpd_location : 'Newport News, VA'
|
||||||
snmpd_conf_snmpd_contact_name : 'Chris Hammer'
|
__snmpd_contact_name : 'Chris Hammer'
|
||||||
snmpd_conf_snmpd_contact_email : '<chris@thezengarden.net>'
|
__snmpd_contact_email : '<chris@thezengarden.net>'
|
||||||
|
|
||||||
|
|
||||||
...
|
...
|
||||||
|
@ -1,35 +1,40 @@
|
|||||||
---
|
---
|
||||||
|
- name: Include distribution specific variables or include defaults
|
||||||
|
block:
|
||||||
|
- name: Include distribution specific variables
|
||||||
|
include_vars:
|
||||||
|
file: "{{ ansible_distribution | lower }}_{{ ansible_distribution_major_version }}.yml"
|
||||||
|
|
||||||
|
|
||||||
|
rescue:
|
||||||
|
- name: Non-supported distribution; using default package set
|
||||||
|
include_vars:
|
||||||
|
file: __default_packages.yml
|
||||||
|
|
||||||
|
|
||||||
- name: Deploy and configure SNMP
|
- name: Deploy and configure SNMP
|
||||||
block:
|
block:
|
||||||
- name: Set package name for Debian 12
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
snmpd_conf_snmp_pkg: snmpd
|
|
||||||
when:
|
|
||||||
- ansible_distribution | lower == 'debian'
|
|
||||||
- ansible_distribution_major_version == '12'
|
|
||||||
|
|
||||||
- name: Install SNMP
|
- name: Install SNMP
|
||||||
ansible.builtin.package:
|
package:
|
||||||
name: "{{ snmpd_conf_snmp_pkg }}"
|
name: "{{ __snmp_pkg }}"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Ensure /etc/snmp directory is present
|
- name: Ensure /etc/snmp directory is present
|
||||||
ansible.builtin.file:
|
file:
|
||||||
path: /etc/snmp
|
path: /etc/snmp
|
||||||
state: directory
|
state: directory
|
||||||
mode: "0755"
|
|
||||||
|
|
||||||
- name: Deploy snmpd.conf
|
- name: Deploy snmpd.conf
|
||||||
ansible.builtin.template:
|
template:
|
||||||
src: templates/snmpd_conf.j2
|
src: templates/snmpd_conf.j2
|
||||||
dest: "{{ snmpd_conf_snmpd_conf_file }}"
|
dest: "{{ __snmpd_conf_file }}"
|
||||||
mode: "0644"
|
mode: 0644
|
||||||
notify: Restart_SNMPd
|
notify: Restart_SNMPd
|
||||||
|
|
||||||
|
|
||||||
rescue:
|
rescue:
|
||||||
- name: Unable to deploy SNMP
|
- name: Unable to deploy SNMP
|
||||||
ansible.builtin.debug:
|
debug:
|
||||||
msg: "Unable to deploy SNMP to {{ inventory_hostname }}."
|
msg: "Unable to deploy SNMP to {{ inventory_hostname }}."
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
###############################################
|
###############################################
|
||||||
# {{ snmpd_conf_template_header }}
|
# {{ __template_header }}
|
||||||
###############################################
|
###############################################
|
||||||
#
|
#
|
||||||
# Configuration : {{ snmpd_conf_snmpd_conf_file }}
|
# Configuration : {{ __snmpd_conf_file }}
|
||||||
# Template Version : {{ snmpd_conf_snmpd_conf_version }}-{{ snmpd_conf_snmpd_conf_revision }}
|
# Template Version : {{ __snmpd_conf_version}}-{{ __snmpd_conf_revision }}
|
||||||
#
|
#
|
||||||
# {{ snmpd_conf_project_author }} ({{ snmpd_conf_project_email }})
|
# {{ __project_author }} ({{ __project_email }})
|
||||||
###############################################
|
###############################################
|
||||||
|
|
||||||
|
|
||||||
@ -33,6 +33,6 @@ access MyRWGroup "" any noauth exact all all none
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
# System contact information
|
# System contact information
|
||||||
#
|
#
|
||||||
syslocation {{ snmpd_conf_snmpd_location }}
|
syslocation {{ __snmpd_location }}
|
||||||
syscontact {{ snmpd_conf_snmpd_contact_name }} {{ snmpd_conf_snmpd_contact_email }}
|
syscontact {{ __snmpd_contact_name }} {{ __snmpd_contact_email }}
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
2
roles/snmpd_conf/tests/inventory
Normal file
2
roles/snmpd_conf/tests/inventory
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
5
roles/snmpd_conf/tests/test.yml
Normal file
5
roles/snmpd_conf/tests/test.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- snmpd_conf
|
5
roles/snmpd_conf/vars/__default_packages.yml
Normal file
5
roles/snmpd_conf/vars/__default_packages.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
__snmp_pkg: net-snmp
|
||||||
|
|
||||||
|
|
||||||
|
...
|
5
roles/snmpd_conf/vars/centos_7.yml
Normal file
5
roles/snmpd_conf/vars/centos_7.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
__snmp_pkg: net-snmp
|
||||||
|
|
||||||
|
|
||||||
|
...
|
5
roles/snmpd_conf/vars/centos_8.yml
Normal file
5
roles/snmpd_conf/vars/centos_8.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
__snmp_pkg: net-snmp
|
||||||
|
|
||||||
|
|
||||||
|
...
|
5
roles/snmpd_conf/vars/centos_9.yml
Normal file
5
roles/snmpd_conf/vars/centos_9.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
__snmp_pkg: net-snmp
|
||||||
|
|
||||||
|
|
||||||
|
...
|
5
roles/snmpd_conf/vars/debian_11.yml
Normal file
5
roles/snmpd_conf/vars/debian_11.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
__snmp_pkg: snmpd
|
||||||
|
|
||||||
|
|
||||||
|
...
|
5
roles/snmpd_conf/vars/debian_12.yml
Normal file
5
roles/snmpd_conf/vars/debian_12.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
__snmp_pkg: snmpd
|
||||||
|
|
||||||
|
|
||||||
|
...
|
5
roles/snmpd_conf/vars/fedora_39.yml
Normal file
5
roles/snmpd_conf/vars/fedora_39.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
__snmp_pkg: net-snmp
|
||||||
|
|
||||||
|
|
||||||
|
...
|
@ -1,4 +0,0 @@
|
|||||||
Role Name
|
|
||||||
=========
|
|
||||||
|
|
||||||
A simple role to say hello to the world.
|
|
@ -1,29 +0,0 @@
|
|||||||
galaxy_info:
|
|
||||||
author: Chris Hammer
|
|
||||||
description: Simple default role to say hello world.
|
|
||||||
|
|
||||||
license: GPL-2.0-or-later
|
|
||||||
|
|
||||||
min_ansible_version: "2.14"
|
|
||||||
|
|
||||||
platforms:
|
|
||||||
- name: Fedora
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
|
|
||||||
- name: EL
|
|
||||||
versions:
|
|
||||||
- "8"
|
|
||||||
- "9"
|
|
||||||
|
|
||||||
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.
|
|
@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Hello World.
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: Hello world.
|
|
||||||
|
|
||||||
|
|
||||||
...
|
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: Update package cache for Debian hosts
|
- name: Update package cache for Debian hosts
|
||||||
apt:
|
apt:
|
||||||
update_cache: true
|
update_cache: yes
|
||||||
when:
|
when:
|
||||||
- ansible_distribution|lower == 'debian'
|
- ansible_distribution|lower == 'debian'
|
||||||
tags:
|
tags:
|
||||||
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
- name: Update package cache for RHEL/CentOS/Fedora hosts
|
- name: Update package cache for RHEL/CentOS/Fedora hosts
|
||||||
dnf:
|
dnf:
|
||||||
update_cache: true
|
update_cache: yes
|
||||||
when:
|
when:
|
||||||
- (ansible_distribution|lower == 'centos' or
|
- (ansible_distribution|lower == 'centos' or
|
||||||
ansible_distribution|lower == 'fedora' or
|
ansible_distribution|lower == 'fedora' or
|
||||||
|
2
roles/update_all_packages/tests/inventory
Normal file
2
roles/update_all_packages/tests/inventory
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
5
roles/update_all_packages/tests/test.yml
Normal file
5
roles/update_all_packages/tests/test.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- roles/update_all_packages
|
@ -1,14 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Test the role provided in extra_vars
|
|
||||||
hosts: all
|
|
||||||
become: false
|
|
||||||
gather_facts: true
|
|
||||||
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
- name: Include role to test
|
|
||||||
ansible.builtin.include_role:
|
|
||||||
name: "{{ __test_role | default('testing') }}"
|
|
||||||
|
|
||||||
|
|
||||||
...
|
|
Loading…
x
Reference in New Issue
Block a user