Compare commits

...

10 Commits

Author SHA1 Message Date
66078bf3ad update galaxy.yml; update origin 2023-12-09 00:23:09 -05:00
76ad471242 update each meta/main.yml 2023-12-08 13:35:14 -05:00
aeb53c59f7 bump galaxy version 2023-12-08 09:20:15 -05:00
500aa7e03f remove no longer needed role 2023-12-08 09:19:56 -05:00
7db2e3df75 lots of cleanup; removal of some roles we are not actually going to rewrite or use 2023-12-08 01:53:17 -05:00
Chris Hammer
ea0c0435c4 this adds a bunch of roles. who knows the state lol...
we'll get it fixed!
2023-12-08 01:30:44 -05:00
Chris Hammer
7e758ca4f3 its been a while since i've worked on this
and it seems there were many changes left
uncommitted. i have no idea what state this is in
but we will refactor or start over from this point.
2023-12-08 00:56:58 -05:00
Chris Hammer
d4aac73442 galaxy version bump 2022-04-05 11:08:33 -04:00
Chris Hammer
6367a921c2
Merge pull request #1 from jchristianh-ansible-collections/add_snmpd_conf_role
add initial snmpd_conf role
2022-04-04 16:56:10 -04:00
Chris Hammer
8c9191b808 add initial snmpd_conf role 2022-04-04 16:51:30 -04:00
77 changed files with 701 additions and 313 deletions

7
.gitignore vendored
View File

@ -1,7 +0,0 @@
roles/*
!roles/.keep
!roles/etc_hosts
!roles/base_packages
!roles/resolv_conf
!roles/update_all_packages
!roles/motd

View File

@ -1,34 +0,0 @@
[defaults]
inventory = /etc/ansible/zen_inventory.yml
roles_path = /etc/ansible/roles
collections_path = /etc/ansible/collections
remote_tmp = /tmp/.ansible-${USER}/tmp
gathering = smart
gather_timeout = 30
fact_path = /etc/ansible/facts
fact_caching = jsonfile
fact_caching_connection = facts.d
fact_caching_timeout = 300
retry_files_enabled = False
forks = 40
timeout = 30
host_key_checking = False
display_skipped_hosts = False
bin_ansible_callbacks = True
callback_whitelist = ansible.posix.profile_tasks, ansible.posix.timer
deprecation_warnings = False
command_warnings = False
[ssh_connection]
pipelining = True
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o PreferredAuthentications=publickey
[galaxy]
server_list = pah
[galaxy_server.pah]
url=https://hub.thezengarden.net/api/galaxy/content/inbound-jchristianh/
token=1a9e01d61c2528a3661f1a6ceea07dafeca63198

View File

@ -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.4 version: 1.0.9
# 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
@ -43,16 +43,16 @@ tags: []
dependencies: {} dependencies: {}
# The URL of the originating SCM repository # The URL of the originating SCM repository
repository: https://github.com/jchristianh-ansible-collections/baseos repository: https://gitea.thezengarden.net/ansible_collections/ansible-collection-baseos
# The URL to any online docs # The URL to any online docs
documentation: https://github.com/jchristianh-ansible-collections/baseos documentation: https://gitea.thezengarden.net/ansible_collections/ansible-collection-baseos
# The URL to the homepage of the collection/project # The URL to the homepage of the collection/project
homepage: https://github.com/jchristianh-ansible-collections/baseos homepage: https://gitea.thezengarden.net/ansible_collections/ansible-collection-baseos
# The URL to the collection issue tracker # The URL to the collection issue tracker
issues: https://github.com/jchristianh-ansible-collections/baseosissues issues: https://gitea.thezengarden.net/ansible_collections/ansible-collection-baseos
# A list of file glob-like patterns used to filter any files or directories that should not be included in the build # A list of file glob-like patterns used to filter any files or directories that should not be included in the build
# artifact. A pattern is matched from the relative path of the file or directory of the collection directory. This # artifact. A pattern is matched from the relative path of the file or directory of the collection directory. This

View File

@ -1,2 +1,2 @@
--- ---
requires_ansible: ">=2.10" requires_ansible: ">=2.14"

View File

@ -1,31 +0,0 @@
# Collections Plugins Directory
This directory can be used to ship various plugins inside an Ansible collection. Each plugin is placed in a folder that
is named after the type of plugin it is in. It can also include the `module_utils` and `modules` directory that
would contain module utils and modules respectively.
Here is an example directory of the majority of plugins currently supported by Ansible:
```
└── plugins
├── action
├── become
├── cache
├── callback
├── cliconf
├── connection
├── filter
├── httpapi
├── inventory
├── lookup
├── module_utils
├── modules
├── netconf
├── shell
├── strategy
├── terminal
├── test
└── vars
```
A full list of plugin types can be found at [Working With Plugins](https://docs.ansible.com/ansible-core/2.12/plugins/plugins.html).

View File

@ -1,2 +0,0 @@
---
# handlers file for base_packages

View File

@ -1,43 +1,20 @@
galaxy_info: galaxy_info:
author: your name author: Chris Hammer
description: your role description description: Installs a defined set of packages on each inventory host.
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the license: GPL-2.0-or-later
# 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: min_ansible_version: "2.14"
# - 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 platforms:
- name: Fedora
versions:
- all
# If this a Container Enabled role, provide the minimum Ansible Container version. - name: EL
# min_ansible_container_version: versions:
- "8"
# - "9"
# 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: [] galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes # List tags for your role here, one per line. A tag is a keyword that describes

View File

@ -3,7 +3,8 @@
block: block:
- name: Include distribution specific variables - name: Include distribution specific variables
include_vars: include_vars:
file: "{{ ansible_distribution | regex_replace('\\s+', '_') | 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
@ -11,6 +12,14 @@
file: __default_packages.yml file: __default_packages.yml
- name: Install EPEL for CentOS hosts - Required for some of our packages
package:
name : epel-release
state : present
when:
- ansible_distribution | lower == 'centos'
- name: Install package set - name: Install package set
package: package:
name : "{{ __base_packages }}" name : "{{ __base_packages }}"

View File

@ -9,7 +9,6 @@ __base_packages:
- ftp - ftp
- git - git
- htop - htop
- ipa-client
- iperf - iperf
- iptraf - iptraf
- jwhois - jwhois

View File

@ -10,7 +10,6 @@ __base_packages:
- ftp - ftp
- git - git
- htop - htop
- ipa-client
- iperf3 - iperf3
- iptraf - iptraf
- lsof - lsof

View File

@ -9,7 +9,6 @@ __base_packages:
- ftp - ftp
- git - git
- htop - htop
- ipa-client
- iperf3 - iperf3
- iptraf - iptraf
- lsof - lsof

View File

@ -1,22 +0,0 @@
---
__base_packages:
- bc
- bzip2
- file
- ftp
- git
- iptraf
- mlocate
- lsof
- rsync
- sudo
- tar
- tcpdump
- telnet
- traceroute
- tree
- unzip
- wget
- whois
- zip

38
roles/bashrc/README.md Normal file
View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
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
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,4 @@
export PS1='\[\033[38;5;081m\]\u\[\033[38;5;245m\]@\[\033[38;5;206m\]\H \[\033[38;5;245m\]\w\[\033[38;5;206m\]$ \[\e[0m\]'
alias ansible-playbook="time /usr/bin/ansible-playbook"
alias tm="clear;tail -F /var/log/messages"

View File

@ -0,0 +1,29 @@
galaxy_info:
author: Chris Hammer
description: Deploys a standard .bashrc file for the root user for each inventory host.
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.

View File

@ -0,0 +1,9 @@
---
- name: Deploy .bashrc
copy:
src : files/bashrc
dest : /root/.bashrc
mode : 0640
...

View File

@ -0,0 +1,2 @@
localhost

View File

@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- bashrc

View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
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
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,2 @@
---
# defaults file for default_services

View File

@ -0,0 +1,29 @@
galaxy_info:
author: Chris Hammer
description: Defines the state (enabled/started) of a defined set of services for each inventory host.
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.

View File

@ -0,0 +1,2 @@
---
# tasks file for default_services

View File

@ -0,0 +1,2 @@
localhost

View File

@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- default_services

View File

@ -8,7 +8,6 @@ __template_header : The Zen Garden
__etc_hosts_file : /etc/hosts __etc_hosts_file : /etc/hosts
__etc_hosts_file_docker : /etc/hosts.docker
__etc_hosts_version : 1.0.0 __etc_hosts_version : 1.0.0
__etc_hosts_revision : 22314 __etc_hosts_revision : 22314

View File

@ -1,43 +1,22 @@
galaxy_info: galaxy_info:
author: your name author: Chris Hammer
description: your role description description: |
company: your company (optional) "Deploys a standardized /etc/hosts file for each inventory host. Includes \
support for custom host entries."
# If the issue tracker for your role is not on github, uncomment the license: GPL-2.0-or-later
# 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: min_ansible_version: "2.14"
# - 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 platforms:
- name: Fedora
versions:
- all
# If this a Container Enabled role, provide the minimum Ansible Container version. - name: EL
# min_ansible_container_version: versions:
- "8"
# - "9"
# 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: [] galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes # List tags for your role here, one per line. A tag is a keyword that describes

View File

@ -1,7 +1,7 @@
--- ---
- name: Set etc_hosts_file if running in Docker - name: Set etc_hosts_file if running in Docker
set_fact: set_fact:
etc_hosts_file: "{{ __etc_hosts_file_docker }}" etc_hosts_file: "{{ __etc_hosts_file }}.docker"
when: when:
- ansible_virtualization_type == "docker" - ansible_virtualization_type == "docker"

View File

@ -1,2 +0,0 @@
---
# vars file for etc_hosts

38
roles/hostname/README.md Normal file
View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
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
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,43 @@
---
- name: restart_syslog_centos_7
service:
name : rsyslog
state : restarted
- name: restart_syslog_centos_8
service:
name : syslog
state : restarted
- name: restart_syslog_centos_9
service:
name : rsyslog
state : restarted
- name: restart_syslog_redhat_8
service:
name : rsyslog
state : restarted
- name: restart_syslog_redhat_9
service:
name : rsyslog
state : restarted
- name: restart_syslog_debian_11
service:
name : rsyslog
state : restarted
- name: restart_syslog_fedora_35
service:
name : rsyslog
state : restarted
- name: restart_syslog_fedora_38
service:
name : rsyslog
state : started
...

View File

@ -0,0 +1,29 @@
galaxy_info:
author: Chris Hammer
description: Sets the system hostname to inventory hostname for target host
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.

View File

@ -0,0 +1,9 @@
---
- name: Set hostname for host
hostname:
name: "{{ inventory_hostname }}"
notify:
- "restart_syslog_{{ ansible_distribution | lower }}_{{ ansible_distribution_major_version }}"
...

View File

@ -0,0 +1,2 @@
localhost

View File

@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- hostname

View File

View File

@ -1,2 +0,0 @@
---
# handlers file for motd

View File

@ -1,43 +1,20 @@
galaxy_info: galaxy_info:
author: your name author: Chris Hammer
description: your role description description: Deploys a custom /etc/motd on each inventory host
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the license: GPL-2.0-or-later
# 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: min_ansible_version: "2.14"
# - 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 platforms:
- name: Fedora
versions:
- all
# If this a Container Enabled role, provide the minimum Ansible Container version. - name: EL
# min_ansible_container_version: versions:
- "8"
# - "9"
# 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: [] galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes # List tags for your role here, one per line. A tag is a keyword that describes

View File

@ -1,21 +1,29 @@
--- ---
- name: Set host IP address or set a default - name: Set host IP address or set a default
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: Get system uptime - Script - name: Install Perl if needed
script: "scripts/get_uptime.pl {{ ansible_uptime_seconds }}" package:
register: node_uptime name : perl
changed_when: false state : present
- name: Get system uptime from script
script:
cmd : "scripts/get_uptime.pl {{ ansible_uptime_seconds }}"
register : node_uptime
changed_when : false
- name: Update MOTD - name: Update MOTD
template: template:
src: templates/motd.j2 src : templates/motd.j2
dest: "{{ __motd_file }}" dest : "{{ __motd_file }}"
mode: 0644 mode : 0644
changed_when: false changed_when : false
... ...

View File

@ -1,2 +0,0 @@
---
# vars file for motd

View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
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
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,2 @@
---
# defaults file for node_status

View File

@ -0,0 +1,2 @@
---
# handlers file for node_status

View File

@ -0,0 +1,29 @@
galaxy_info:
author: Chris Hammer
description: We do nothing for now.
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.

View File

@ -0,0 +1,2 @@
---
# tasks file for node_status

View File

@ -0,0 +1,2 @@
localhost

View File

@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- node_status

View File

@ -0,0 +1,2 @@
---
# vars file for node_status

View File

@ -9,14 +9,14 @@ __template_header : The Zen Garden
__resolv_conf_file : /etc/resolv.conf __resolv_conf_file : /etc/resolv.conf
__resolv_conf_file_docker : /etc/resolv.conf.docker __resolv_conf_file_docker : /etc/resolv.conf.docker
__resolv_conf_version : 1.0.0 __resolv_conf_version : 1.0.1
__resolv_conf_revision : 22315 __resolv_conf_revision : 221007
__search_domain : thezengarden.net __search_domain : thezengarden.net
__nameservers : __nameservers :
- 10.10.10.55 - 10.10.10.55
- 10.1.1.210 - 10.1.1.15
... ...

View File

@ -1,2 +0,0 @@
---
# handlers file for resolv_conf

View File

@ -1,43 +1,20 @@
galaxy_info: galaxy_info:
author: your name author: Chris Hammer
description: your role description description: Deploys a standard /etc/resolv.conf on each inventory host.
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the license: GPL-2.0-or-later
# 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: min_ansible_version: "2.14"
# - 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 platforms:
- name: Fedora
versions:
- all
# If this a Container Enabled role, provide the minimum Ansible Container version. - name: EL
# min_ansible_container_version: versions:
- "8"
# - "9"
# 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: [] galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes # List tags for your role here, one per line. A tag is a keyword that describes

View File

@ -1,4 +1,3 @@
###############################################
# {{ __template_header }} # {{ __template_header }}
############################################### ###############################################
# #

View File

@ -1,2 +0,0 @@
---
# vars file for resolv_conf

View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
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
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,23 @@
---
__project_author : Chris Hammer
__project_email : chris@thezengarden.net
__project_repo : https://github.com/jchristianh-ansible-collections/baseos
__template_header : The Zen Garden
__snmpd_conf_file : /etc/snmp/snmpd.conf
__snmpd_conf_version : 1.0.0
__snmpd_conf_revision : 22404
__snmp_pkg : net-snmp
__snmpd_location : 'Newport News, VA'
__snmpd_contact_name : 'Chris Hammer'
__snmpd_contact_email : '<chris@thezengarden.net>'
...

View File

@ -0,0 +1,6 @@
---
- name: restart snmpd
service:
name : snmpd
state: restarted
when: ansible_virtualization_type != "docker"

View File

@ -0,0 +1,29 @@
galaxy_info:
author: Chris Hammer
description: Deploy SNMPd with a standard configuration on each inventory host.
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.

View File

@ -0,0 +1,41 @@
---
- 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
block:
- name: Install SNMP
package:
name: "{{ __snmp_pkg }}"
state: present
- name: Ensure /etc/snmp directory is present
file:
path: /etc/snmp
state: directory
- name: Deploy snmpd.conf
template:
src: templates/snmpd_conf.j2
dest: "{{ __snmpd_conf_file }}"
mode: 0644
notify: restart snmpd
rescue:
- name: Unable to deploy SNMP
debug:
msg: "Unable to deploy SNMP to {{ inventory_hostname }}."
...

View File

@ -0,0 +1,38 @@
###############################################
# {{ __template_header }}
###############################################
#
# Configuration : {{ __snmpd_conf_file }}
# Template Version : {{ __snmpd_conf_version}}-{{ __snmpd_conf_revision }}
#
# {{ __project_author }} ({{ __project_email }})
###############################################
com2sec readonly default public
group MyROSystem v1 paranoid
group MyROSystem v2c paranoid
group MyROSystem usm paranoid
group MyROGroup v1 readonly
group MyROGroup v2c readonly
group MyROGroup usm readonly
group MyRWGroup v1 readwrite
group MyRWGroup v2c readwrite
group MyRWGroup usm readwrite
view all included .1 80
view system included .iso.org.dod.internet.mgmt.mib-2.system
# context sec.model sec.level match read write notif
access MyROSystem "" any noauth exact system none none
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none
###############################################################################
# System contact information
#
syslocation {{ __snmpd_location }}
syscontact {{ __snmpd_contact_name }} {{ __snmpd_contact_email }}
# -----------------------------------------------------------------------------

View File

@ -0,0 +1,2 @@
localhost

View File

@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- snmpd_conf

View File

@ -0,0 +1,5 @@
---
__snmp_pkg: net-snmp
...

View File

@ -0,0 +1,5 @@
---
__snmp_pkg: net-snmp
...

View File

@ -0,0 +1,5 @@
---
__snmp_pkg: net-snmp
...

View File

@ -0,0 +1,5 @@
---
__snmp_pkg: net-snmp
...

View File

@ -0,0 +1,5 @@
---
__snmp_pkg: snmpd
...

View File

@ -1,2 +0,0 @@
---
# defaults file for roles/update_all_packages

View File

@ -1,2 +0,0 @@
---
# handlers file for roles/update_all_packages

View File

@ -1,43 +1,20 @@
galaxy_info: galaxy_info:
author: your name author: Chris Hammer
description: your role description description: Updates all packages on each inventory host to their latest versions.
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the license: GPL-2.0-or-later
# 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: min_ansible_version: "2.14"
# - 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 platforms:
- name: Fedora
versions:
- all
# If this a Container Enabled role, provide the minimum Ansible Container version. - name: EL
# min_ansible_container_version: versions:
- "8"
# - "9"
# 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: [] galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes # List tags for your role here, one per line. A tag is a keyword that describes

View File

@ -1,5 +1,26 @@
--- ---
- name: Update all packages on host - name: Update package cache for Debian hosts
apt:
update_cache: yes
when:
- ansible_distribution|lower == 'debian'
tags:
- skip_ansible_lint
- name: Update package cache for RHEL/CentOS/Fedora hosts
dnf:
update_cache: yes
when:
- (ansible_distribution|lower == 'centos' or
ansible_distribution|lower == 'fedora' or
ansible_distribution|lower == 'redhat')
- ansible_distribution_major_version|int >= 8
tags:
- skip_ansible_lint
- name: Update all host packages
package: name=* state=latest package: name=* state=latest
tags: tags:
- skip_ansible_lint - skip_ansible_lint

View File

@ -1,2 +0,0 @@
---
# vars file for roles/update_all_packages