klal
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled

This commit is contained in:
2026-03-24 22:18:34 +01:00
parent 68775c50da
commit e3cd8f5843
16 changed files with 236 additions and 35 deletions
+38
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).
+2
View File
@@ -0,0 +1,2 @@
---
# defaults file for puppet-agent
+2
View File
@@ -0,0 +1,2 @@
---
# handlers file for puppet-agent
+52
View File
@@ -0,0 +1,52 @@
galaxy_info:
author: your name
description: your role description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
+45
View File
@@ -0,0 +1,45 @@
- name: Install puppet agent
become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"
vars:
puppet_server: active.home.lan
block:
# - name: Ensure Puppet repo is present (Debian/Ubuntu)
# apt_repository:
# repo: "deb http://apt.puppetlabs.com {{ ansible_distribution_release }} puppet6"
# state: present
# when: ansible_os_family == "Debian"
- name: Facts
ansible.builtin.setup:
when: ansible_facts.architecture is not defined
- name: Install Puppet agent package
package:
name: puppet-agent
state: present
- name: Create Puppet configuration directory
file:
path: /etc/puppetlabs/puppet
state: directory
mode: '0755'
- name: Deploy puppet.conf
template:
src: puppet.conf.j2
dest: /etc/puppet/puppet.conf
owner: root
group: root
mode: '0644'
- name: Enable and start puppet agent
systemd:
name: puppet
enabled: true
state: started
- name: Trigger puppet agent run once1
command: /usr/bin/puppet agent -t
register: puppet_run
ignore_errors: true
- debug:
var: puppet_run.stdout_lines
@@ -0,0 +1,5 @@
[main]
server = {{ puppet_server }}
certname = {{ inventory_hostname }}
environment = production
runinterval = 10m
+2
View File
@@ -0,0 +1,2 @@
localhost
+5
View File
@@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- puppet-agent
+3
View File
@@ -0,0 +1,3 @@
---
# vars file for puppet-agent
puppet_server: active.home.lan
+40
View File
@@ -0,0 +1,40 @@
- name: Set banner
become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"
block:
- name: Install packages
ansible.builtin.apt:
name:
- figlet
- toilet
- name: Create Banner
ansible.builtin.command: |
figlet -c {{ (inventory_hostname | split('.'))[0] }} -f slant
register: logo
changed_when: "logo.rc == 0"
- name: Creating a file with content
ansible.builtin.copy:
dest: "/etc/motd"
content: |
{{ logo.stdout }}
owner: 0
group: 0
mode: "0777"
- name: Reconfigure sshd
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
regexp: "^Banner.* "
line: "#Banner /etc/banner"
- name: Reconfigure sshd
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
regexp: "^#PrintLastLog.* "
line: "PrintLastLog no"
- name: Sshd
ansible.builtin.service:
name: ssh.service
state: restarted
+3
View File
@@ -1,6 +1,9 @@
- name: SSH config Setup
become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"
block:
- name: Include vault
ansible.builtin.include_vars:
file: jaydee.yml
- name: Upload config
ansible.builtin.copy:
src: config
@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJSABeQ3x7nM3HBil1LpGYLrdz5NbXVl6l6dNMr0lnwZ jd@ryzen
+3 -3
View File
@@ -18,8 +18,8 @@
when: inventory_hostname != 'nas.home.lan'
- name: Upload key
ansible.builtin.copy:
src: id_rsa.pub
dest: /home/jd/.ssh/id_rsa.pub
src: id_ed25519_homelab.pub
dest: /home/jd/.ssh/id_ed25519_homelab.pub
mode: '0600'
owner: jd
group: jd
@@ -28,4 +28,4 @@
ansible.posix.authorized_key:
user: jd
state: present
key: "{{ lookup('file', '/home/jd/.ssh/id_rsa.pub') }}"
key: "{{ lookup('file', '/home/jd/.ssh/id_ed25519_homelab.pub') }}"