Initial release version to AAP #5
@ -3,3 +3,4 @@ skip_list:
|
|||||||
- yaml[empty-lines]
|
- yaml[empty-lines]
|
||||||
- yaml[line-length]
|
- yaml[line-length]
|
||||||
- no-changed-when
|
- no-changed-when
|
||||||
|
- galaxy[no-changelog]
|
||||||
|
3
.drone.env
Normal file
3
.drone.env
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export ANSIBLE_LINT_EXCLUSION="--exclude .gitea"
|
||||||
|
export ANSIBLE_INVENTORY="-i 127.0.0.1, --connection=local"
|
||||||
|
export ANSIBLE_PLAYBOOK="baseos.yml"
|
111
.drone.yml
Normal file
111
.drone.yml
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
---
|
||||||
|
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
|
30
.gitea/workflows/ansible-test.yml
Normal file
30
.gitea/workflows/ansible-test.yml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
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
|
2
ansible.cfg
Normal file
2
ansible.cfg
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[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.17
|
version: 1.0.20
|
||||||
|
|
||||||
# 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,7 +34,8 @@ 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.14"
|
requires_ansible: ">=2.15.0"
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
__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
|
||||||
include_vars:
|
ansible.builtin.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
|
||||||
include_vars:
|
ansible.builtin.include_vars:
|
||||||
file: __default_packages.yml
|
file: default_packages.yml
|
||||||
|
|
||||||
|
|
||||||
- name: Install EPEL for CentOS hosts - Required for some of our packages
|
- name: Install EPEL for CentOS hosts - Required for some packages
|
||||||
package:
|
ansible.builtin.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
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name : "{{ __base_packages }}"
|
name : "{{ base_packages_package_set }}"
|
||||||
state : present
|
state : present
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
localhost
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: localhost
|
|
||||||
remote_user: root
|
|
||||||
roles:
|
|
||||||
- base_packages
|
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
__base_packages:
|
base_packages_package_set:
|
||||||
- bc
|
- bc
|
||||||
- bind-utils
|
- bind-utils
|
||||||
- bzip2
|
- bzip2
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
__base_packages:
|
base_packages_package_set:
|
||||||
- bc
|
- bc
|
||||||
- bind-utils
|
- bind-utils
|
||||||
- bzip2
|
- bzip2
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
__base_packages:
|
base_packages_package_set:
|
||||||
- bc
|
- bc
|
||||||
- bind-utils
|
- bind-utils
|
||||||
- bzip2
|
- bzip2
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
__base_packages:
|
base_packages_package_set:
|
||||||
- bc
|
- bc
|
||||||
- bind9utils
|
- bind9utils
|
||||||
- bzip2
|
- bzip2
|
||||||
|
@ -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:
|
base_packages_package_set:
|
||||||
- bc
|
- bc
|
||||||
- bzip2
|
- bzip2
|
||||||
- file
|
- file
|
@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
# vars file for base_packages
|
|
@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
- name: Deploy .bashrc
|
- name: Deploy .bashrc
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src : files/bashrc
|
src : files/bashrc
|
||||||
dest : /root/.bashrc
|
dest : /root/.bashrc
|
||||||
mode : 0640
|
mode : "0640"
|
||||||
|
|
||||||
|
|
||||||
...
|
...
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
localhost
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: localhost
|
|
||||||
remote_user: root
|
|
||||||
roles:
|
|
||||||
- bashrc
|
|
@ -1,2 +0,0 @@
|
|||||||
localhost
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: localhost
|
|
||||||
remote_user: root
|
|
||||||
roles:
|
|
||||||
- default_services
|
|
@ -1,15 +1,15 @@
|
|||||||
---
|
---
|
||||||
__project_author : Chris Hammer
|
etc_hosts_project_author : Chris Hammer
|
||||||
__project_email : chris@thezengarden.net
|
etc_hosts_project_email : chris@thezengarden.net
|
||||||
__project_repo : https://github.com/jchristianh-ansible-collections/baseos
|
etc_hosts_project_repo : https://github.com/jchristianh-ansible-collections/baseos
|
||||||
|
|
||||||
|
|
||||||
__template_header : The Zen Garden
|
etc_hosts_template_header : The Zen Garden
|
||||||
|
|
||||||
|
|
||||||
__etc_hosts_file : /etc/hosts
|
etc_hosts_etc_hosts_file : /etc/hosts
|
||||||
__etc_hosts_version : 1.0.0
|
etc_hosts_etc_hosts_version : 1.0.1
|
||||||
__etc_hosts_revision : 22314
|
etc_hosts_etc_hosts_revision : 231216
|
||||||
|
|
||||||
|
|
||||||
...
|
...
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
---
|
---
|
||||||
- name: Set etc_hosts_file if running in Docker
|
- name: Set etc_hosts_etc_hosts_file if running in Docker
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
__etc_hosts_file: "{{ __etc_hosts_file }}.docker"
|
etc_hosts_etc_hosts_file: "{{ etc_hosts_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_file }}
|
- name: Deploy {{ etc_hosts_etc_hosts_file }}
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: templates/etc_hosts.j2
|
src: templates/etc_hosts.j2
|
||||||
dest: "{{ __etc_hosts_file }}"
|
dest: "{{ etc_hosts_etc_hosts_file }}"
|
||||||
mode: 0644
|
mode: "0644"
|
||||||
|
|
||||||
|
|
||||||
...
|
...
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
###############################################
|
###############################################
|
||||||
# {{ __template_header }}
|
# {{ etc_hosts_template_header }}
|
||||||
###############################################
|
###############################################
|
||||||
#
|
#
|
||||||
# Configuration : {{ __etc_hosts_file }}
|
# Configuration : {{ etc_hosts_etc_hosts_file }}
|
||||||
# Template Version : {{ __etc_hosts_version}}-{{ __etc_hosts_revision }}
|
# Template Version : {{ etc_hosts_etc_hosts_version }}-{{ etc_hosts_etc_hosts_revision }}
|
||||||
#
|
#
|
||||||
# {{ __project_author }} ({{ __project_email }})
|
# {{ etc_hosts_project_author }} ({{ etc_hosts_project_email }})
|
||||||
###############################################
|
###############################################
|
||||||
|
|
||||||
|
|
||||||
@ -20,10 +20,10 @@
|
|||||||
{{ 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 custom_hosts is defined and custom_hosts != '' %}
|
{% if etc_hosts_custom_hosts is defined and etc_hosts_custom_hosts != '' %}
|
||||||
# CUSTOM HOSTS:
|
# CUSTOM HOSTS:
|
||||||
#############################################
|
#############################################
|
||||||
{% for item in custom_hosts %}
|
{% for item in etc_hosts_custom_hosts %}
|
||||||
{{ item }}
|
{{ item }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
localhost
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: localhost
|
|
||||||
remote_user: root
|
|
||||||
roles:
|
|
||||||
- etc_hosts
|
|
@ -1,46 +1,46 @@
|
|||||||
---
|
---
|
||||||
- name: restart_syslog_centos_7
|
- name: Restart_syslog_centos_7
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name : rsyslog
|
name : rsyslog
|
||||||
state : restarted
|
state : restarted
|
||||||
|
|
||||||
- name: restart_syslog_centos_8
|
- name: Restart_syslog_centos_8
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name : syslog
|
name : syslog
|
||||||
state : restarted
|
state : restarted
|
||||||
|
|
||||||
- name: restart_syslog_centos_9
|
- name: Restart_syslog_centos_9
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name : rsyslog
|
name : rsyslog
|
||||||
state : restarted
|
state : restarted
|
||||||
|
|
||||||
- name: restart_syslog_redhat_8
|
- name: Restart_syslog_redhat_8
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name : rsyslog
|
name : rsyslog
|
||||||
state : restarted
|
state : restarted
|
||||||
|
|
||||||
- name: restart_syslog_redhat_9
|
- name: Restart_syslog_redhat_9
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name : rsyslog
|
name : rsyslog
|
||||||
state : restarted
|
state : restarted
|
||||||
|
|
||||||
- name: restart_syslog_debian_11
|
- name: Restart_syslog_debian_11
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name : rsyslog
|
name : rsyslog
|
||||||
state : restarted
|
state : restarted
|
||||||
|
|
||||||
- name: restart_syslog_debian_12
|
- name: Restart_syslog_debian_12
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name : rsyslog
|
name : rsyslog
|
||||||
state : restarted
|
state : restarted
|
||||||
|
|
||||||
- name: restart_syslog_fedora_35
|
- name: Restart_syslog_fedora_35
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name : rsyslog
|
name : rsyslog
|
||||||
state : restarted
|
state : restarted
|
||||||
|
|
||||||
- name: restart_syslog_fedora_38
|
- name: Restart_syslog_fedora_38
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name : rsyslog
|
name : rsyslog
|
||||||
state : started
|
state : started
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
- name: Set hostname for host
|
- name: Set hostname for host
|
||||||
hostname:
|
ansible.builtin.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 }}"
|
||||||
|
|
||||||
|
|
||||||
...
|
...
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
localhost
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: localhost
|
|
||||||
remote_user: root
|
|
||||||
roles:
|
|
||||||
- hostname
|
|
@ -1,16 +1,5 @@
|
|||||||
---
|
---
|
||||||
__project_author : Chris Hammer
|
motd_motd_file : /etc/motd
|
||||||
__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
|
||||||
set_fact:
|
ansible.builtin.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
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name : perl
|
name : perl
|
||||||
state : present
|
state : present
|
||||||
|
|
||||||
|
|
||||||
- name: Get system uptime from script
|
- name: Get system uptime from script
|
||||||
script:
|
ansible.builtin.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
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src : templates/motd.j2
|
src : templates/motd.j2
|
||||||
dest : "{{ __motd_file }}"
|
dest : "{{ motd_motd_file }}"
|
||||||
mode : 0644
|
mode : "0644"
|
||||||
changed_when : false
|
changed_when : false
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
localhost
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: localhost
|
|
||||||
remote_user: root
|
|
||||||
roles:
|
|
||||||
- motd
|
|
@ -1,2 +0,0 @@
|
|||||||
localhost
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: localhost
|
|
||||||
remote_user: root
|
|
||||||
roles:
|
|
||||||
- node_status
|
|
@ -1,20 +1,19 @@
|
|||||||
---
|
---
|
||||||
__project_author : Chris Hammer
|
resolv_conf_project_author : Chris Hammer
|
||||||
__project_email : chris@thezengarden.net
|
resolv_conf_project_email : chris@thezengarden.net
|
||||||
__project_repo : https://github.com/jchristianh-ansible-collections/baseos
|
resolv_conf_project_repo : https://github.com/jchristianh-ansible-collections/baseos
|
||||||
|
|
||||||
|
|
||||||
__template_header : The Zen Garden
|
resolv_conf_template_header : The Zen Garden
|
||||||
|
|
||||||
|
|
||||||
__resolv_conf_file : /etc/resolv.conf
|
resolv_conf_resolv_conf_file : /etc/resolv.conf
|
||||||
__resolv_conf_file_docker : /etc/resolv.conf.docker
|
resolv_conf_resolv_conf_version : 1.0.1
|
||||||
__resolv_conf_version : 1.0.1
|
resolv_conf_resolv_conf_revision : 221007
|
||||||
__resolv_conf_revision : 221007
|
|
||||||
|
|
||||||
|
|
||||||
__search_domain : thezengarden.net
|
resolv_conf_search_domain : thezengarden.net
|
||||||
__nameservers :
|
resolv_conf_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 Docker
|
- name: Set resolv_conf_file if running in container
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
__resolv_conf_file: "{{ __resolv_conf_file_docker }}"
|
resolv_conf_resolv_conf_file: "{{ resolv_conf_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_file }}
|
- name: Deploy {{ resolv_conf_resolv_conf_file }}
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: templates/resolv_conf.j2
|
src: templates/resolv_conf.j2
|
||||||
dest: "{{ __resolv_conf_file }}"
|
dest: "{{ resolv_conf_resolv_conf_file }}"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
# {{ __template_header }}
|
# {{ resolv_conf_template_header }}
|
||||||
###############################################
|
###############################################
|
||||||
#
|
#
|
||||||
# Configuration : {{ __resolv_conf_file }}
|
# Configuration : {{ resolv_conf_resolv_conf_file }}
|
||||||
# Template Version : {{ __resolv_conf_version}}-{{ __resolv_conf_revision }}
|
# Template Version : {{ resolv_conf_resolv_conf_version }}-{{ resolv_conf_resolv_conf_revision }}
|
||||||
#
|
#
|
||||||
# {{ __project_author }} ({{ __project_email }})
|
# {{ resolv_conf_project_author }} ({{ resolv_conf_project_email }})
|
||||||
###############################################
|
###############################################
|
||||||
|
|
||||||
|
|
||||||
search {{ __search_domain }}
|
search {{ resolv_conf_search_domain }}
|
||||||
{% for item in __nameservers %}
|
{% for item in resolv_conf_nameservers %}
|
||||||
nameserver {{ item }}
|
nameserver {{ item }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
localhost
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: localhost
|
|
||||||
remote_user: root
|
|
||||||
roles:
|
|
||||||
- resolv_conf
|
|
@ -1,23 +1,23 @@
|
|||||||
---
|
---
|
||||||
__project_author : Chris Hammer
|
snmpd_conf_project_author : Chris Hammer
|
||||||
__project_email : chris@thezengarden.net
|
snmpd_conf_project_email : chris@thezengarden.net
|
||||||
__project_repo : https://github.com/jchristianh-ansible-collections/baseos
|
snmpd_conf_project_repo : https://github.com/jchristianh-ansible-collections/baseos
|
||||||
|
|
||||||
|
|
||||||
__template_header : The Zen Garden
|
snmpd_conf_template_header : The Zen Garden
|
||||||
|
|
||||||
|
|
||||||
__snmpd_conf_file : /etc/snmp/snmpd.conf
|
snmpd_conf_snmpd_conf_file : /etc/snmp/snmpd.conf
|
||||||
__snmpd_conf_version : 1.0.1
|
snmpd_conf_snmpd_conf_version : 1.0.1
|
||||||
__snmpd_conf_revision : 231210
|
snmpd_conf_snmpd_conf_revision : 231210
|
||||||
|
|
||||||
|
|
||||||
__snmp_pkg : net-snmp
|
snmpd_conf_snmp_pkg : net-snmp
|
||||||
|
|
||||||
|
|
||||||
__snmpd_location : 'Newport News, VA'
|
snmpd_conf_snmpd_location : 'Newport News, VA'
|
||||||
__snmpd_contact_name : 'Chris Hammer'
|
snmpd_conf_snmpd_contact_name : 'Chris Hammer'
|
||||||
__snmpd_contact_email : '<chris@thezengarden.net>'
|
snmpd_conf_snmpd_contact_email : '<chris@thezengarden.net>'
|
||||||
|
|
||||||
|
|
||||||
...
|
...
|
||||||
|
@ -1,40 +1,35 @@
|
|||||||
---
|
---
|
||||||
- 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
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: "{{ __snmp_pkg }}"
|
name: "{{ snmpd_conf_snmp_pkg }}"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Ensure /etc/snmp directory is present
|
- name: Ensure /etc/snmp directory is present
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: /etc/snmp
|
path: /etc/snmp
|
||||||
state: directory
|
state: directory
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
- name: Deploy snmpd.conf
|
- name: Deploy snmpd.conf
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: templates/snmpd_conf.j2
|
src: templates/snmpd_conf.j2
|
||||||
dest: "{{ __snmpd_conf_file }}"
|
dest: "{{ snmpd_conf_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
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
msg: "Unable to deploy SNMP to {{ inventory_hostname }}."
|
msg: "Unable to deploy SNMP to {{ inventory_hostname }}."
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
###############################################
|
###############################################
|
||||||
# {{ __template_header }}
|
# {{ snmpd_conf_template_header }}
|
||||||
###############################################
|
###############################################
|
||||||
#
|
#
|
||||||
# Configuration : {{ __snmpd_conf_file }}
|
# Configuration : {{ snmpd_conf_snmpd_conf_file }}
|
||||||
# Template Version : {{ __snmpd_conf_version}}-{{ __snmpd_conf_revision }}
|
# Template Version : {{ snmpd_conf_snmpd_conf_version }}-{{ snmpd_conf_snmpd_conf_revision }}
|
||||||
#
|
#
|
||||||
# {{ __project_author }} ({{ __project_email }})
|
# {{ snmpd_conf_project_author }} ({{ snmpd_conf_project_email }})
|
||||||
###############################################
|
###############################################
|
||||||
|
|
||||||
|
|
||||||
@ -33,6 +33,6 @@ access MyRWGroup "" any noauth exact all all none
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
# System contact information
|
# System contact information
|
||||||
#
|
#
|
||||||
syslocation {{ __snmpd_location }}
|
syslocation {{ snmpd_conf_snmpd_location }}
|
||||||
syscontact {{ __snmpd_contact_name }} {{ __snmpd_contact_email }}
|
syscontact {{ snmpd_conf_snmpd_contact_name }} {{ snmpd_conf_snmpd_contact_email }}
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
localhost
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: localhost
|
|
||||||
remote_user: root
|
|
||||||
roles:
|
|
||||||
- snmpd_conf
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
__snmp_pkg: net-snmp
|
|
||||||
|
|
||||||
|
|
||||||
...
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
__snmp_pkg: net-snmp
|
|
||||||
|
|
||||||
|
|
||||||
...
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
__snmp_pkg: net-snmp
|
|
||||||
|
|
||||||
|
|
||||||
...
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
__snmp_pkg: net-snmp
|
|
||||||
|
|
||||||
|
|
||||||
...
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
__snmp_pkg: snmpd
|
|
||||||
|
|
||||||
|
|
||||||
...
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
__snmp_pkg: snmpd
|
|
||||||
|
|
||||||
|
|
||||||
...
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
__snmp_pkg: net-snmp
|
|
||||||
|
|
||||||
|
|
||||||
...
|
|
4
roles/testing/README.md
Normal file
4
roles/testing/README.md
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Role Name
|
||||||
|
=========
|
||||||
|
|
||||||
|
A simple role to say hello to the world.
|
29
roles/testing/meta/main.yml
Normal file
29
roles/testing/meta/main.yml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
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.
|
7
roles/testing/tasks/main.yml
Normal file
7
roles/testing/tasks/main.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- 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: yes
|
update_cache: true
|
||||||
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: yes
|
update_cache: true
|
||||||
when:
|
when:
|
||||||
- (ansible_distribution|lower == 'centos' or
|
- (ansible_distribution|lower == 'centos' or
|
||||||
ansible_distribution|lower == 'fedora' or
|
ansible_distribution|lower == 'fedora' or
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
localhost
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: localhost
|
|
||||||
remote_user: root
|
|
||||||
roles:
|
|
||||||
- roles/update_all_packages
|
|
14
tests/unit-test.yml
Normal file
14
tests/unit-test.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
- 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