role separation
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
ansible-playbook --ask-become-pass -i ~/.ansible/inventory playbook.yml
|
ansible-playbook --ask-vault-pass -i inventory playbook.yml
|
||||||
ansible-galaxy role init {role-to-create}
|
ansible-galaxy role init {role-to-create}
|
||||||
ansible-vault edit vault.yml
|
ansible-vault edit vault.yml
|
||||||
|
|
||||||
|
|||||||
5
fromdebiantemplate.yml
Normal file
5
fromdebiantemplate.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- name: Make Debian template uniq
|
||||||
|
hosts: debiantemplate
|
||||||
|
become: true
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ herodes-public
|
|||||||
pi-public
|
pi-public
|
||||||
|
|
||||||
[Vmbox]
|
[Vmbox]
|
||||||
|
debiantemplate
|
||||||
|
|
||||||
[all:vars]
|
[all:vars]
|
||||||
ansible_connection=ssh
|
ansible_connection=ssh
|
||||||
|
|||||||
16
proxmox.yml
16
proxmox.yml
@@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Init for proxmox
|
|
||||||
hosts: proxmox
|
|
||||||
become: true
|
|
||||||
vars:
|
|
||||||
user: warezjoe
|
|
||||||
uid: 1000
|
|
||||||
user_ssh_key_url: https://github.com/MatousVondrejka.keys
|
|
||||||
host: herodes # desktop rpi ntb
|
|
||||||
set_ip: true # false
|
|
||||||
ip: 192.168.5.6
|
|
||||||
roles:
|
|
||||||
# - role: proxmox
|
|
||||||
# - role: linux_config_init
|
|
||||||
- role: tools_for_command_line
|
|
||||||
# - role: ansible-role-security
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
skip_list:
|
|
||||||
- 'yaml'
|
|
||||||
- 'risky-shell-pipe'
|
|
||||||
- 'role-name'
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
extends: default
|
|
||||||
|
|
||||||
rules:
|
|
||||||
line-length:
|
|
||||||
max: 200
|
|
||||||
level: warning
|
|
||||||
|
|
||||||
ignore: |
|
|
||||||
.github/stale.yml
|
|
||||||
.travis.yml
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2017 Jeff Geerling
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
|
||||||
the Software without restriction, including without limitation the rights to
|
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
||||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
@@ -1,128 +0,0 @@
|
|||||||
# Ansible Role: Docker
|
|
||||||
|
|
||||||
[](https://github.com/geerlingguy/ansible-role-docker/actions?query=workflow%3ACI)
|
|
||||||
|
|
||||||
An Ansible Role that installs [Docker](https://www.docker.com) on Linux.
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
None.
|
|
||||||
|
|
||||||
## Role Variables
|
|
||||||
|
|
||||||
Available variables are listed below, along with default values (see `defaults/main.yml`):
|
|
||||||
|
|
||||||
# Edition can be one of: 'ce' (Community Edition) or 'ee' (Enterprise Edition).
|
|
||||||
docker_edition: 'ce'
|
|
||||||
docker_packages:
|
|
||||||
- "docker-{{ docker_edition }}"
|
|
||||||
- "docker-{{ docker_edition }}-cli"
|
|
||||||
- "docker-{{ docker_edition }}-rootless-extras"
|
|
||||||
docker_packages_state: present
|
|
||||||
|
|
||||||
The `docker_edition` should be either `ce` (Community Edition) or `ee` (Enterprise Edition).
|
|
||||||
You can also specify a specific version of Docker to install using the distribution-specific format:
|
|
||||||
Red Hat/CentOS: `docker-{{ docker_edition }}-<VERSION>` (Note: you have to add this to all packages);
|
|
||||||
Debian/Ubuntu: `docker-{{ docker_edition }}=<VERSION>` (Note: you have to add this to all packages).
|
|
||||||
|
|
||||||
You can control whether the package is installed, uninstalled, or at the latest version by setting `docker_package_state` to `present`, `absent`, or `latest`, respectively. Note that the Docker daemon will be automatically restarted if the Docker package is updated. This is a side effect of flushing all handlers (running any of the handlers that have been notified by this and any other role up to this point in the play).
|
|
||||||
|
|
||||||
docker_service_manage: true
|
|
||||||
docker_service_state: started
|
|
||||||
docker_service_enabled: true
|
|
||||||
docker_restart_handler_state: restarted
|
|
||||||
|
|
||||||
Variables to control the state of the `docker` service, and whether it should start on boot. If you're installing Docker inside a Docker container without systemd or sysvinit, you should set `docker_service_manage` to `false`.
|
|
||||||
|
|
||||||
docker_install_compose_plugin: false
|
|
||||||
docker_compose_package: docker-compose-plugin
|
|
||||||
docker_compose_package_state: present
|
|
||||||
|
|
||||||
Docker Compose Plugin installation options. These differ from the below in that docker-compose is installed as a docker plugin (and used with `docker compose`) instead of a standalone binary.
|
|
||||||
|
|
||||||
docker_install_compose: true
|
|
||||||
docker_compose_version: "1.26.0"
|
|
||||||
docker_compose_arch: "{{ ansible_architecture }}"
|
|
||||||
docker_compose_path: /usr/local/bin/docker-compose
|
|
||||||
|
|
||||||
Docker Compose installation options.
|
|
||||||
|
|
||||||
docker_repo_url: https://download.docker.com/linux
|
|
||||||
|
|
||||||
The main Docker repo URL, common between Debian and RHEL systems.
|
|
||||||
|
|
||||||
docker_apt_release_channel: stable
|
|
||||||
docker_apt_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}"
|
|
||||||
docker_apt_repository: "deb [arch={{ docker_apt_arch }}] {{ docker_repo_url }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}"
|
|
||||||
docker_apt_ignore_key_error: True
|
|
||||||
docker_apt_gpg_key: "{{ docker_repo_url }}/{{ ansible_distribution | lower }}/gpg"
|
|
||||||
|
|
||||||
(Used only for Debian/Ubuntu.) You can switch the channel to `nightly` if you want to use the Nightly release.
|
|
||||||
|
|
||||||
You can change `docker_apt_gpg_key` to a different url if you are behind a firewall or provide a trustworthy mirror.
|
|
||||||
Usually in combination with changing `docker_apt_repository` as well.
|
|
||||||
|
|
||||||
docker_yum_repo_url: "{{ docker_repo_url }}/{{ (ansible_distribution == 'Fedora') | ternary('fedora','centos') }}/docker-{{ docker_edition }}.repo"docker_edition }}.repo
|
|
||||||
docker_yum_repo_enable_nightly: '0'
|
|
||||||
docker_yum_repo_enable_test: '0'
|
|
||||||
docker_yum_gpg_key: "{{ docker_repo_url }}/centos/gpg"
|
|
||||||
|
|
||||||
(Used only for RedHat/CentOS.) You can enable the Nightly or Test repo by setting the respective vars to `1`.
|
|
||||||
|
|
||||||
You can change `docker_yum_gpg_key` to a different url if you are behind a firewall or provide a trustworthy mirror.
|
|
||||||
Usually in combination with changing `docker_yum_repository` as well.
|
|
||||||
|
|
||||||
docker_users:
|
|
||||||
- user1
|
|
||||||
- user2
|
|
||||||
|
|
||||||
A list of system users to be added to the `docker` group (so they can use Docker on the server).
|
|
||||||
|
|
||||||
docker_daemon_options:
|
|
||||||
storage-driver: "devicemapper"
|
|
||||||
log-opts:
|
|
||||||
max-size: "100m"
|
|
||||||
|
|
||||||
Custom `dockerd` options can be configured through this dictionary representing the json file `/etc/docker/daemon.json`.
|
|
||||||
|
|
||||||
## Use with Ansible (and `docker` Python library)
|
|
||||||
|
|
||||||
Many users of this role wish to also use Ansible to then _build_ Docker images and manage Docker containers on the server where Docker is installed. In this case, you can easily add in the `docker` Python library using the `geerlingguy.pip` role:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- hosts: all
|
|
||||||
|
|
||||||
vars:
|
|
||||||
pip_install_packages:
|
|
||||||
- name: docker
|
|
||||||
|
|
||||||
roles:
|
|
||||||
- geerlingguy.pip
|
|
||||||
- geerlingguy.docker
|
|
||||||
```
|
|
||||||
|
|
||||||
## Dependencies
|
|
||||||
|
|
||||||
None.
|
|
||||||
|
|
||||||
## Example Playbook
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- hosts: all
|
|
||||||
roles:
|
|
||||||
- geerlingguy.docker
|
|
||||||
```
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
MIT / BSD
|
|
||||||
|
|
||||||
## Sponsors
|
|
||||||
|
|
||||||
* [We Manage](https://we-manage.de): Helping start-ups and grown-ups scaling their infrastructure in a sustainable way.
|
|
||||||
|
|
||||||
The above sponsor(s) are supporting Jeff Geerling on [GitHub Sponsors](https://github.com/sponsors/geerlingguy). You can sponsor Jeff's work too, to help him continue improving these Ansible open source projects!
|
|
||||||
|
|
||||||
## Author Information
|
|
||||||
|
|
||||||
This role was created in 2017 by [Jeff Geerling](https://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
---
|
|
||||||
# Edition can be one of: 'ce' (Community Edition) or 'ee' (Enterprise Edition).
|
|
||||||
docker_edition: 'ce'
|
|
||||||
docker_packages:
|
|
||||||
- "docker-{{ docker_edition }}"
|
|
||||||
- "docker-{{ docker_edition }}-cli"
|
|
||||||
- "docker-{{ docker_edition }}-rootless-extras"
|
|
||||||
- "containerd.io"
|
|
||||||
docker_packages_state: present
|
|
||||||
|
|
||||||
# Service options.
|
|
||||||
docker_service_manage: true
|
|
||||||
docker_service_state: started
|
|
||||||
docker_service_enabled: true
|
|
||||||
docker_restart_handler_state: restarted
|
|
||||||
|
|
||||||
# Docker Compose Plugin options.
|
|
||||||
docker_install_compose_plugin: false
|
|
||||||
docker_compose_package: docker-compose-plugin
|
|
||||||
docker_compose_package_state: present
|
|
||||||
|
|
||||||
# Docker Compose options.
|
|
||||||
docker_install_compose: true
|
|
||||||
docker_compose_version: "v2.11.1"
|
|
||||||
docker_compose_arch: "{{ ansible_architecture }}"
|
|
||||||
docker_compose_url: "https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-linux-{{ docker_compose_arch }}"
|
|
||||||
docker_compose_path: /usr/local/bin/docker-compose
|
|
||||||
|
|
||||||
# Docker repo URL.
|
|
||||||
docker_repo_url: https://download.docker.com/linux
|
|
||||||
|
|
||||||
# Used only for Debian/Ubuntu. Switch 'stable' to 'nightly' if needed.
|
|
||||||
docker_apt_release_channel: stable
|
|
||||||
docker_apt_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}"
|
|
||||||
docker_apt_repository: "deb [arch={{ docker_apt_arch }}] {{ docker_repo_url }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}"
|
|
||||||
docker_apt_ignore_key_error: true
|
|
||||||
docker_apt_gpg_key: "{{ docker_repo_url }}/{{ ansible_distribution | lower }}/gpg"
|
|
||||||
|
|
||||||
# Used only for RedHat/CentOS/Fedora.
|
|
||||||
docker_yum_repo_url: "{{ docker_repo_url }}/{{ (ansible_distribution == 'Fedora') | ternary('fedora','centos') }}/docker-{{ docker_edition }}.repo"
|
|
||||||
docker_yum_repo_enable_nightly: '0'
|
|
||||||
docker_yum_repo_enable_test: '0'
|
|
||||||
docker_yum_gpg_key: "{{ docker_repo_url }}/centos/gpg"
|
|
||||||
|
|
||||||
# A list of users who will be added to the docker group.
|
|
||||||
docker_users: []
|
|
||||||
|
|
||||||
# Docker daemon options as a dict
|
|
||||||
docker_daemon_options: {}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
- name: restart docker
|
|
||||||
service:
|
|
||||||
name: docker
|
|
||||||
state: "{{ docker_restart_handler_state }}"
|
|
||||||
ignore_errors: "{{ ansible_check_mode }}"
|
|
||||||
when: docker_service_manage | bool
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
---
|
|
||||||
dependencies: []
|
|
||||||
|
|
||||||
galaxy_info:
|
|
||||||
role_name: docker
|
|
||||||
author: geerlingguy
|
|
||||||
description: Docker for Linux.
|
|
||||||
company: "Midwestern Mac, LLC"
|
|
||||||
license: "license (BSD, MIT)"
|
|
||||||
min_ansible_version: 2.4
|
|
||||||
platforms:
|
|
||||||
- name: EL
|
|
||||||
versions:
|
|
||||||
- 7
|
|
||||||
- 8
|
|
||||||
- name: Fedora
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: Debian
|
|
||||||
versions:
|
|
||||||
- buster
|
|
||||||
- bullseye
|
|
||||||
- name: Ubuntu
|
|
||||||
versions:
|
|
||||||
- bionic
|
|
||||||
- focal
|
|
||||||
- jammy
|
|
||||||
- name: Alpine
|
|
||||||
version:
|
|
||||||
- all
|
|
||||||
- name: ArchLinux
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
galaxy_tags:
|
|
||||||
- web
|
|
||||||
- system
|
|
||||||
- containers
|
|
||||||
- docker
|
|
||||||
- orchestration
|
|
||||||
- compose
|
|
||||||
- server
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Converge
|
|
||||||
hosts: all
|
|
||||||
become: true
|
|
||||||
|
|
||||||
pre_tasks:
|
|
||||||
- name: Update apt cache.
|
|
||||||
apt: update_cache=yes cache_valid_time=600
|
|
||||||
when: ansible_os_family == 'Debian'
|
|
||||||
|
|
||||||
- name: Wait for systemd to complete initialization. # noqa 303
|
|
||||||
command: systemctl is-system-running
|
|
||||||
register: systemctl_status
|
|
||||||
until: >
|
|
||||||
'running' in systemctl_status.stdout or
|
|
||||||
'degraded' in systemctl_status.stdout
|
|
||||||
retries: 30
|
|
||||||
delay: 5
|
|
||||||
when: ansible_service_mgr == 'systemd'
|
|
||||||
changed_when: false
|
|
||||||
failed_when: systemctl_status.rc > 1
|
|
||||||
|
|
||||||
roles:
|
|
||||||
- role: geerlingguy.docker
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
---
|
|
||||||
role_name_check: 1
|
|
||||||
dependency:
|
|
||||||
name: galaxy
|
|
||||||
driver:
|
|
||||||
name: docker
|
|
||||||
platforms:
|
|
||||||
- name: instance
|
|
||||||
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest"
|
|
||||||
command: ${MOLECULE_DOCKER_COMMAND:-""}
|
|
||||||
volumes:
|
|
||||||
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
|
||||||
cgroupns_mode: host
|
|
||||||
privileged: true
|
|
||||||
pre_build_image: true
|
|
||||||
provisioner:
|
|
||||||
name: ansible
|
|
||||||
playbooks:
|
|
||||||
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Check current docker-compose version.
|
|
||||||
command: "{{ docker_compose_path }} --version"
|
|
||||||
register: docker_compose_vsn
|
|
||||||
check_mode: false
|
|
||||||
changed_when: false
|
|
||||||
failed_when: false
|
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
docker_compose_current_version: "{{ docker_compose_vsn.stdout | regex_search('(\\d+(\\.\\d+)+)') }}"
|
|
||||||
when: >
|
|
||||||
docker_compose_vsn.stdout is defined
|
|
||||||
and (docker_compose_vsn.stdout | length > 0)
|
|
||||||
|
|
||||||
- name: Delete existing docker-compose version if it's different.
|
|
||||||
file:
|
|
||||||
path: "{{ docker_compose_path }}"
|
|
||||||
state: absent
|
|
||||||
when: >
|
|
||||||
docker_compose_current_version is defined
|
|
||||||
and (docker_compose_version | regex_replace('v', '')) not in docker_compose_current_version
|
|
||||||
|
|
||||||
- name: Install Docker Compose (if configured).
|
|
||||||
get_url:
|
|
||||||
url: "{{ docker_compose_url }}"
|
|
||||||
dest: "{{ docker_compose_path }}"
|
|
||||||
mode: 0755
|
|
||||||
when: >
|
|
||||||
(docker_compose_current_version is not defined)
|
|
||||||
or (docker_compose_current_version | length == 0)
|
|
||||||
or (docker_compose_current_version is version((docker_compose_version | regex_replace('v', '')), '<'))
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Ensure docker users are added to the docker group.
|
|
||||||
user:
|
|
||||||
name: "{{ item }}"
|
|
||||||
groups: docker
|
|
||||||
append: true
|
|
||||||
with_items: "{{ docker_users }}"
|
|
||||||
|
|
||||||
- name: Reset ssh connection to apply user changes.
|
|
||||||
meta: reset_connection
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Load OS-specific vars.
|
|
||||||
include_vars: "{{ lookup('first_found', params) }}"
|
|
||||||
vars:
|
|
||||||
params:
|
|
||||||
files:
|
|
||||||
- '{{ansible_distribution}}.yml'
|
|
||||||
- '{{ansible_os_family}}.yml'
|
|
||||||
- main.yml
|
|
||||||
paths:
|
|
||||||
- 'vars'
|
|
||||||
|
|
||||||
- include_tasks: setup-RedHat.yml
|
|
||||||
when: ansible_os_family == 'RedHat'
|
|
||||||
|
|
||||||
- include_tasks: setup-Debian.yml
|
|
||||||
when: ansible_os_family == 'Debian'
|
|
||||||
|
|
||||||
- name: Install Docker packages.
|
|
||||||
package:
|
|
||||||
name: "{{ docker_packages }}"
|
|
||||||
state: "{{ docker_packages_state }}"
|
|
||||||
notify: restart docker
|
|
||||||
ignore_errors: "{{ ansible_check_mode }}"
|
|
||||||
when: "ansible_version.full is version_compare('2.12', '<') or ansible_os_family not in ['RedHat', 'Debian']"
|
|
||||||
|
|
||||||
- name: Install Docker packages (with downgrade option).
|
|
||||||
package:
|
|
||||||
name: "{{ docker_packages }}"
|
|
||||||
state: "{{ docker_packages_state }}"
|
|
||||||
allow_downgrade: true
|
|
||||||
notify: restart docker
|
|
||||||
ignore_errors: "{{ ansible_check_mode }}"
|
|
||||||
when: "ansible_version.full is version_compare('2.12', '>=') and ansible_os_family in ['RedHat', 'Debian']"
|
|
||||||
|
|
||||||
- name: Install docker-compose plugin.
|
|
||||||
package:
|
|
||||||
name: "{{ docker_compose_package }}"
|
|
||||||
state: "{{ docker_compose_package_state }}"
|
|
||||||
notify: restart docker
|
|
||||||
ignore_errors: "{{ ansible_check_mode }}"
|
|
||||||
when: "docker_install_compose_plugin | bool == true and (ansible_version.full is version_compare('2.12', '<') or ansible_os_family not in ['RedHat', 'Debian'])"
|
|
||||||
|
|
||||||
- name: Install docker-compose-plugin (with downgrade option).
|
|
||||||
package:
|
|
||||||
name: "{{ docker_compose_package }}"
|
|
||||||
state: "{{ docker_compose_package_state }}"
|
|
||||||
allow_downgrade: true
|
|
||||||
notify: restart docker
|
|
||||||
ignore_errors: "{{ ansible_check_mode }}"
|
|
||||||
when: "docker_install_compose_plugin | bool == true and ansible_version.full is version_compare('2.12', '>=') and ansible_os_family in ['RedHat', 'Debian']"
|
|
||||||
|
|
||||||
- name: Ensure /etc/docker/ directory exists.
|
|
||||||
file:
|
|
||||||
path: /etc/docker
|
|
||||||
state: directory
|
|
||||||
mode: 0755
|
|
||||||
when: docker_daemon_options.keys() | length > 0
|
|
||||||
|
|
||||||
- name: Configure Docker daemon options.
|
|
||||||
copy:
|
|
||||||
content: "{{ docker_daemon_options | to_nice_json }}"
|
|
||||||
dest: /etc/docker/daemon.json
|
|
||||||
mode: 0644
|
|
||||||
when: docker_daemon_options.keys() | length > 0
|
|
||||||
notify: restart docker
|
|
||||||
|
|
||||||
- name: Ensure Docker is started and enabled at boot.
|
|
||||||
service:
|
|
||||||
name: docker
|
|
||||||
state: "{{ docker_service_state }}"
|
|
||||||
enabled: "{{ docker_service_enabled }}"
|
|
||||||
ignore_errors: "{{ ansible_check_mode }}"
|
|
||||||
when: docker_service_manage | bool
|
|
||||||
|
|
||||||
- name: Ensure handlers are notified now to avoid firewall conflicts.
|
|
||||||
meta: flush_handlers
|
|
||||||
|
|
||||||
- include_tasks: docker-compose.yml
|
|
||||||
when: docker_install_compose | bool
|
|
||||||
|
|
||||||
- name: Get docker group info using getent.
|
|
||||||
getent:
|
|
||||||
database: group
|
|
||||||
key: docker
|
|
||||||
split: ':'
|
|
||||||
when: docker_users | length > 0
|
|
||||||
|
|
||||||
- name: Check if there are any users to add to the docker group.
|
|
||||||
set_fact:
|
|
||||||
at_least_one_user_to_modify: true
|
|
||||||
when:
|
|
||||||
- docker_users | length > 0
|
|
||||||
- item not in ansible_facts.getent_group["docker"][2]
|
|
||||||
with_items: "{{ docker_users }}"
|
|
||||||
|
|
||||||
- include_tasks: docker-users.yml
|
|
||||||
when: at_least_one_user_to_modify is defined
|
|
||||||
|
|
||||||
|
|
||||||
- name: Install docker python package
|
|
||||||
ansible.builtin.pip:
|
|
||||||
name: docker
|
|
||||||
extra_args: "--break-system-packages"
|
|
||||||
|
|
||||||
- name: Install a promtail plugin
|
|
||||||
community.docker.docker_plugin:
|
|
||||||
plugin_name: grafana/loki-docker-driver:latest
|
|
||||||
state: present
|
|
||||||
alias: loki
|
|
||||||
|
|
||||||
- name: Enable a promtail plugin
|
|
||||||
community.docker.docker_plugin:
|
|
||||||
plugin_name: grafana/loki-docker-driver:latest
|
|
||||||
state: enable
|
|
||||||
alias: loki
|
|
||||||
notify: restart docker
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Ensure old versions of Docker are not installed.
|
|
||||||
package:
|
|
||||||
name:
|
|
||||||
- docker
|
|
||||||
- docker-engine
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
- name: Ensure dependencies are installed.
|
|
||||||
apt:
|
|
||||||
name:
|
|
||||||
- apt-transport-https
|
|
||||||
- ca-certificates
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Ensure additional dependencies are installed (on Ubuntu < 20.04 and any other systems).
|
|
||||||
apt:
|
|
||||||
name: gnupg2
|
|
||||||
state: present
|
|
||||||
when: ansible_distribution != 'Ubuntu' or ansible_distribution_version is version('20.04', '<')
|
|
||||||
|
|
||||||
- name: Ensure additional dependencies are installed (on Ubuntu >= 20.04).
|
|
||||||
apt:
|
|
||||||
name: gnupg
|
|
||||||
state: present
|
|
||||||
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version is version('20.04', '>=')
|
|
||||||
|
|
||||||
- name: Add Docker apt key.
|
|
||||||
ansible.builtin.get_url:
|
|
||||||
url: "{{ docker_apt_gpg_key }}"
|
|
||||||
dest: /etc/apt/trusted.gpg.d/docker.asc
|
|
||||||
mode: '0644'
|
|
||||||
force: true
|
|
||||||
register: add_repository_key
|
|
||||||
ignore_errors: "{{ docker_apt_ignore_key_error }}"
|
|
||||||
|
|
||||||
- name: Ensure curl is present (on older systems without SNI).
|
|
||||||
package: name=curl state=present
|
|
||||||
when: add_repository_key is failed
|
|
||||||
|
|
||||||
- name: Add Docker apt key (alternative for older systems without SNI).
|
|
||||||
shell: >
|
|
||||||
curl -sSL {{ docker_apt_gpg_key }} | apt-key add -
|
|
||||||
when: add_repository_key is failed
|
|
||||||
|
|
||||||
- name: Add Docker repository.
|
|
||||||
apt_repository:
|
|
||||||
repo: "{{ docker_apt_repository }}"
|
|
||||||
state: present
|
|
||||||
update_cache: true
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Ensure old versions of Docker are not installed.
|
|
||||||
package:
|
|
||||||
name:
|
|
||||||
- docker
|
|
||||||
- docker-common
|
|
||||||
- docker-engine
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
- name: Add Docker GPG key.
|
|
||||||
rpm_key:
|
|
||||||
key: "{{ docker_yum_gpg_key }}"
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Add Docker repository.
|
|
||||||
get_url:
|
|
||||||
url: "{{ docker_yum_repo_url }}"
|
|
||||||
dest: '/etc/yum.repos.d/docker-{{ docker_edition }}.repo'
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: 0644
|
|
||||||
|
|
||||||
- name: Configure Docker Nightly repo.
|
|
||||||
ini_file:
|
|
||||||
dest: '/etc/yum.repos.d/docker-{{ docker_edition }}.repo'
|
|
||||||
section: 'docker-{{ docker_edition }}-nightly'
|
|
||||||
option: enabled
|
|
||||||
value: '{{ docker_yum_repo_enable_nightly }}'
|
|
||||||
mode: 0644
|
|
||||||
no_extra_spaces: true
|
|
||||||
|
|
||||||
- name: Configure Docker Test repo.
|
|
||||||
ini_file:
|
|
||||||
dest: '/etc/yum.repos.d/docker-{{ docker_edition }}.repo'
|
|
||||||
section: 'docker-{{ docker_edition }}-test'
|
|
||||||
option: enabled
|
|
||||||
value: '{{ docker_yum_repo_enable_test }}'
|
|
||||||
mode: 0644
|
|
||||||
no_extra_spaces: true
|
|
||||||
|
|
||||||
- name: Configure containerd on RHEL 8.
|
|
||||||
block:
|
|
||||||
- name: Ensure container-selinux is installed.
|
|
||||||
package:
|
|
||||||
name: container-selinux
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Ensure containerd.io is installed.
|
|
||||||
package:
|
|
||||||
name: containerd.io
|
|
||||||
state: present
|
|
||||||
when: ansible_distribution_major_version | int == 8
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
docker_packages: "docker"
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
docker_packages: "docker"
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
# Empty file
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
skip_list:
|
|
||||||
- 'yaml'
|
|
||||||
- 'role-name'
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
extends: default
|
|
||||||
|
|
||||||
rules:
|
|
||||||
line-length:
|
|
||||||
max: 120
|
|
||||||
level: warning
|
|
||||||
|
|
||||||
ignore: |
|
|
||||||
.github/workflows/stale.yml
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2017 Jeff Geerling
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
|
||||||
the Software without restriction, including without limitation the rights to
|
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
||||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
# Ansible Role: Security (Basics)
|
|
||||||
|
|
||||||
[](https://github.com/geerlingguy/ansible-role-security/actions?query=workflow%3ACI)
|
|
||||||
|
|
||||||
**First, a major, MAJOR caveat**: the security of your servers is YOUR responsibility. If you think simply including this role and adding a firewall makes a server secure, then you're mistaken. Read up on Linux, network, and application security, and know that no matter how much you know, you can always make every part of your stack more secure.
|
|
||||||
|
|
||||||
That being said, this role performs some basic security configuration on RedHat and Debian-based linux systems. It attempts to:
|
|
||||||
|
|
||||||
- Install software to monitor bad SSH access (fail2ban)
|
|
||||||
- Configure SSH to be more secure (disabling root login, requiring key-based authentication, and allowing a custom SSH port to be set)
|
|
||||||
- Set up automatic updates (if configured to do so)
|
|
||||||
|
|
||||||
There are a few other things you may or may not want to do (which are not included in this role) to make sure your servers are more secure, like:
|
|
||||||
|
|
||||||
- Use logwatch or a centralized logging server to analyze and monitor log files
|
|
||||||
- Securely configure user accounts and SSH keys (this role assumes you're not using password authentication or logging in as root)
|
|
||||||
- Have a well-configured firewall (check out the `geerlingguy.firewall` role on Ansible Galaxy for a flexible example)
|
|
||||||
|
|
||||||
Again: Your servers' security is *your* responsibility.
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
For obvious reasons, `sudo` must be installed if you want to manage the sudoers file with this role.
|
|
||||||
|
|
||||||
On RedHat/CentOS systems, make sure you have the EPEL repository installed (you can include the `geerlingguy.repo-epel` role to get it installed).
|
|
||||||
|
|
||||||
No special requirements for Debian/Ubuntu systems.
|
|
||||||
|
|
||||||
## Role Variables
|
|
||||||
|
|
||||||
Available variables are listed below, along with default values (see `defaults/main.yml`):
|
|
||||||
|
|
||||||
security_ssh_port: 22
|
|
||||||
|
|
||||||
The port through which you'd like SSH to be accessible. The default is port 22, but if you're operating a server on the open internet, and have no firewall blocking access to port 22, you'll quickly find that thousands of login attempts per day are not uncommon. You can change the port to a nonstandard port (e.g. 2849) if you want to avoid these thousands of automated penetration attempts.
|
|
||||||
|
|
||||||
security_ssh_password_authentication: "no"
|
|
||||||
security_ssh_permit_root_login: "no"
|
|
||||||
security_ssh_usedns: "no"
|
|
||||||
security_ssh_permit_empty_password: "no"
|
|
||||||
security_ssh_challenge_response_auth: "no"
|
|
||||||
security_ssh_gss_api_authentication: "no"
|
|
||||||
security_ssh_x11_forwarding: "no"
|
|
||||||
|
|
||||||
Security settings for SSH authentication. It's best to leave these set to `"no"`, but there are times (especially during initial server configuration or when you don't have key-based authentication in place) when one or all may be safely set to `'yes'`. **NOTE: It is _very_ important that you quote the 'yes' or 'no' values. Failure to do so may lock you out of your server.**
|
|
||||||
|
|
||||||
security_ssh_allowed_users: []
|
|
||||||
# - alice
|
|
||||||
# - bob
|
|
||||||
# - charlie
|
|
||||||
|
|
||||||
A list of users allowed to connect to the host over SSH. If no user is defined in the list, the task will be skipped.
|
|
||||||
|
|
||||||
security_ssh_allowed_groups: []
|
|
||||||
# - admins
|
|
||||||
# - devs
|
|
||||||
|
|
||||||
A list of groups allowed to connect to the host over SSH. If no group is defined in the list, the task will be skipped.
|
|
||||||
|
|
||||||
security_sshd_state: started
|
|
||||||
|
|
||||||
The state of the SSH daemon. Typically this should remain `started`.
|
|
||||||
|
|
||||||
security_ssh_restart_handler_state: restarted
|
|
||||||
|
|
||||||
The state of the `restart ssh` handler. Typically this should remain `restarted`.
|
|
||||||
|
|
||||||
security_sudoers_passwordless: []
|
|
||||||
security_sudoers_passworded: []
|
|
||||||
|
|
||||||
A list of users who should be added to the sudoers file so they can run any command as root (via `sudo`) either without a password or requiring a password for each command, respectively.
|
|
||||||
|
|
||||||
security_autoupdate_enabled: true
|
|
||||||
|
|
||||||
Whether to install/enable `yum-cron` (RedHat-based systems) or `unattended-upgrades` (Debian-based systems). System restarts will not happen automatically in any case, and automatic upgrades are no excuse for sloppy patch and package management, but automatic updates can be helpful as yet another security measure.
|
|
||||||
|
|
||||||
security_autoupdate_blacklist: []
|
|
||||||
|
|
||||||
(Debian/Ubuntu only) A listing of packages that should not be automatically updated.
|
|
||||||
|
|
||||||
security_autoupdate_reboot: false
|
|
||||||
|
|
||||||
(Debian/Ubuntu only) Whether to reboot when needed during unattended upgrades.
|
|
||||||
|
|
||||||
security_autoupdate_reboot_time: "03:00"
|
|
||||||
|
|
||||||
(Debian/Ubuntu only) The time to trigger a reboot, when needed, if `security_autoupdate_reboot` is set to `true`. In 24h "hh:mm" clock format.
|
|
||||||
|
|
||||||
security_autoupdate_mail_to: ""
|
|
||||||
security_autoupdate_mail_on_error: true
|
|
||||||
|
|
||||||
(Debian/Ubuntu only) If `security_autoupdate_mail_to` is set to an non empty value, unattended upgrades will send an e-mail to that address when some error occurs. You may either set this to a full email: `ops@example.com` or to something like `root`, which will use `/etc/aliases` to route the message. If you set `security_autoupdate_mail_on_error` to `false` you'll get an email after every package install.
|
|
||||||
|
|
||||||
security_fail2ban_enabled: true
|
|
||||||
|
|
||||||
Whether to install/enable `fail2ban`. You might not want to use fail2ban if you're already using some other service for login and intrusion detection (e.g. [ConfigServer](http://configserver.com/cp/csf.html)).
|
|
||||||
|
|
||||||
security_fail2ban_custom_configuration_template: "jail.local.j2"
|
|
||||||
|
|
||||||
The name of the template file used to generate `fail2ban`'s configuration.
|
|
||||||
|
|
||||||
## Dependencies
|
|
||||||
|
|
||||||
None.
|
|
||||||
|
|
||||||
## Example Playbook
|
|
||||||
|
|
||||||
- hosts: servers
|
|
||||||
vars_files:
|
|
||||||
- vars/main.yml
|
|
||||||
roles:
|
|
||||||
- geerlingguy.security
|
|
||||||
|
|
||||||
*Inside `vars/main.yml`*:
|
|
||||||
|
|
||||||
security_sudoers_passworded:
|
|
||||||
- johndoe
|
|
||||||
- deployacct
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
MIT (Expat) / BSD
|
|
||||||
|
|
||||||
## Author Information
|
|
||||||
|
|
||||||
This role was created in 2014 by [Jeff Geerling](https://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
---
|
|
||||||
security_ssh_port: 22
|
|
||||||
security_ssh_password_authentication: "no"
|
|
||||||
security_ssh_permit_root_login: "no"
|
|
||||||
security_ssh_usedns: "no"
|
|
||||||
security_ssh_permit_empty_password: "no"
|
|
||||||
security_ssh_challenge_response_auth: "no"
|
|
||||||
security_ssh_gss_api_authentication: "no"
|
|
||||||
security_ssh_x11_forwarding: "no"
|
|
||||||
security_sshd_state: started
|
|
||||||
security_ssh_restart_handler_state: restarted
|
|
||||||
security_ssh_allowed_users: []
|
|
||||||
security_ssh_allowed_groups: []
|
|
||||||
|
|
||||||
security_sudoers_passwordless: []
|
|
||||||
security_sudoers_passworded: []
|
|
||||||
|
|
||||||
security_autoupdate_enabled: true
|
|
||||||
security_autoupdate_blacklist: []
|
|
||||||
|
|
||||||
# Autoupdate mail settings used on Debian/Ubuntu only.
|
|
||||||
security_autoupdate_reboot: "false"
|
|
||||||
security_autoupdate_reboot_time: "03:00"
|
|
||||||
security_autoupdate_mail_to: ""
|
|
||||||
security_autoupdate_mail_on_error: true
|
|
||||||
|
|
||||||
security_fail2ban_enabled: true
|
|
||||||
security_fail2ban_custom_configuration_template: "jail.local.j2"
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
- name: restart ssh
|
|
||||||
service:
|
|
||||||
name: "{{ security_sshd_name }}"
|
|
||||||
state: "{{ security_ssh_restart_handler_state }}"
|
|
||||||
|
|
||||||
- name: reload fail2ban
|
|
||||||
service:
|
|
||||||
name: fail2ban
|
|
||||||
state: reloaded
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
---
|
|
||||||
dependencies: []
|
|
||||||
|
|
||||||
galaxy_info:
|
|
||||||
role_name: security
|
|
||||||
author: geerlingguy
|
|
||||||
description: Security software installation and configuration.
|
|
||||||
company: "Midwestern Mac, LLC"
|
|
||||||
license: "license (BSD, MIT)"
|
|
||||||
min_ansible_version: 2.10
|
|
||||||
platforms:
|
|
||||||
- name: Fedora
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: Debian
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: Ubuntu
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
galaxy_tags:
|
|
||||||
- system
|
|
||||||
- security
|
|
||||||
- fail2ban
|
|
||||||
- automatic
|
|
||||||
- updates
|
|
||||||
- yum
|
|
||||||
- apt
|
|
||||||
- dnf
|
|
||||||
- hardening
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Converge
|
|
||||||
hosts: all
|
|
||||||
become: true
|
|
||||||
|
|
||||||
pre_tasks:
|
|
||||||
- name: Update apt cache.
|
|
||||||
package:
|
|
||||||
update_cache: true
|
|
||||||
cache_valid_time: 600
|
|
||||||
when: ansible_os_family == 'Debian'
|
|
||||||
|
|
||||||
- name: Ensure build dependencies are installed (RedHat).
|
|
||||||
package:
|
|
||||||
name:
|
|
||||||
- openssh-server
|
|
||||||
- openssh-clients
|
|
||||||
state: present
|
|
||||||
when: ansible_os_family == 'RedHat'
|
|
||||||
|
|
||||||
- name: Ensure build dependencies are installed (Fedora).
|
|
||||||
package:
|
|
||||||
name: procps
|
|
||||||
state: present
|
|
||||||
when: ansible_distribution == 'Fedora'
|
|
||||||
|
|
||||||
- name: Ensure build dependencies are installed (Debian).
|
|
||||||
package:
|
|
||||||
name:
|
|
||||||
- openssh-server
|
|
||||||
- openssh-client
|
|
||||||
state: present
|
|
||||||
when: ansible_os_family == 'Debian'
|
|
||||||
|
|
||||||
- name: Ensure auth.log file is present.
|
|
||||||
copy:
|
|
||||||
dest: /var/log/auth.log
|
|
||||||
content: ""
|
|
||||||
force: false
|
|
||||||
mode: 0644
|
|
||||||
when: ansible_distribution == 'Debian'
|
|
||||||
|
|
||||||
roles:
|
|
||||||
- role: geerlingguy.security
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
---
|
|
||||||
role_name_check: 1
|
|
||||||
dependency:
|
|
||||||
name: galaxy
|
|
||||||
options:
|
|
||||||
ignore-errors: true
|
|
||||||
driver:
|
|
||||||
name: docker
|
|
||||||
platforms:
|
|
||||||
- name: instance
|
|
||||||
image: "geerlingguy/docker-${MOLECULE_DISTRO:-rockylinux8}-ansible:latest"
|
|
||||||
command: ${MOLECULE_DOCKER_COMMAND:-""}
|
|
||||||
volumes:
|
|
||||||
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
|
||||||
cgroupns_mode: host
|
|
||||||
privileged: true
|
|
||||||
pre_build_image: true
|
|
||||||
provisioner:
|
|
||||||
name: ansible
|
|
||||||
playbooks:
|
|
||||||
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Install unattended upgrades package.
|
|
||||||
package:
|
|
||||||
name: unattended-upgrades
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Copy unattended-upgrades configuration files in place.
|
|
||||||
template:
|
|
||||||
src: "{{ item }}.j2"
|
|
||||||
dest: "/etc/apt/apt.conf.d/{{ item }}"
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: 0644
|
|
||||||
with_items:
|
|
||||||
- 10periodic
|
|
||||||
- 50unattended-upgrades
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Set correct automatic update utility vars (RHEL >= 8).
|
|
||||||
set_fact:
|
|
||||||
update_utility: dnf-automatic
|
|
||||||
update_service: dnf-automatic-install.timer
|
|
||||||
update_conf_path: /etc/dnf/automatic.conf
|
|
||||||
when: ansible_distribution_major_version | int >= 8
|
|
||||||
|
|
||||||
- name: Set correct automatic update utility vars (RHEL <= 7).
|
|
||||||
set_fact:
|
|
||||||
update_utility: yum-cron
|
|
||||||
update_service: yum-cron
|
|
||||||
update_conf_path: /etc/yum/yum-cron.conf
|
|
||||||
when: ansible_distribution_major_version | int <= 7
|
|
||||||
|
|
||||||
- name: Install automatic update utility.
|
|
||||||
package:
|
|
||||||
name: '{{ update_utility }}'
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Ensure automatic update utility is running and enabled on boot.
|
|
||||||
service:
|
|
||||||
name: '{{ update_service }}'
|
|
||||||
state: started
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
- name: Configure autoupdates.
|
|
||||||
lineinfile:
|
|
||||||
dest: '{{ update_conf_path }}'
|
|
||||||
regexp: '^apply_updates = .+'
|
|
||||||
line: 'apply_updates = yes'
|
|
||||||
mode: 0644
|
|
||||||
when:
|
|
||||||
- security_autoupdate_enabled
|
|
||||||
- ansible_distribution_major_version | int in [7, 8]
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Install fail2ban (RedHat).
|
|
||||||
package:
|
|
||||||
name: fail2ban
|
|
||||||
state: present
|
|
||||||
enablerepo: epel
|
|
||||||
when: ansible_os_family == 'RedHat'
|
|
||||||
|
|
||||||
- name: Install fail2ban (Debian).
|
|
||||||
package:
|
|
||||||
name: fail2ban
|
|
||||||
state: present
|
|
||||||
when: ansible_os_family == 'Debian'
|
|
||||||
|
|
||||||
- name: Copy fail2ban custom configuration file into place.
|
|
||||||
template:
|
|
||||||
src: "{{ security_fail2ban_custom_configuration_template }}"
|
|
||||||
dest: /etc/fail2ban/jail.local
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: 0644
|
|
||||||
notify:
|
|
||||||
- reload fail2ban
|
|
||||||
|
|
||||||
- name: Ensure fail2ban is running and enabled on boot.
|
|
||||||
service:
|
|
||||||
name: fail2ban
|
|
||||||
state: started
|
|
||||||
enabled: true
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Include OS-specific variables.
|
|
||||||
include_vars: "{{ ansible_os_family }}.yml"
|
|
||||||
|
|
||||||
# Fail2Ban
|
|
||||||
- include_tasks: fail2ban.yml
|
|
||||||
when: security_fail2ban_enabled | bool
|
|
||||||
|
|
||||||
# SSH
|
|
||||||
- include_tasks: ssh.yml
|
|
||||||
|
|
||||||
# Autoupdate
|
|
||||||
- include_tasks: autoupdate-RedHat.yml
|
|
||||||
when:
|
|
||||||
- ansible_os_family == 'RedHat'
|
|
||||||
- security_autoupdate_enabled | bool
|
|
||||||
|
|
||||||
- include_tasks: autoupdate-Debian.yml
|
|
||||||
when:
|
|
||||||
- ansible_os_family == 'Debian'
|
|
||||||
- security_autoupdate_enabled | bool
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Ensure SSH daemon is running.
|
|
||||||
service:
|
|
||||||
name: "{{ security_sshd_name }}"
|
|
||||||
state: "{{ security_sshd_state }}"
|
|
||||||
|
|
||||||
- name: Update SSH configuration to be more secure.
|
|
||||||
lineinfile:
|
|
||||||
dest: "{{ security_ssh_config_path }}"
|
|
||||||
regexp: "{{ item.regexp }}"
|
|
||||||
line: "{{ item.line }}"
|
|
||||||
state: present
|
|
||||||
validate: 'sshd -T -f %s'
|
|
||||||
mode: 0644
|
|
||||||
with_items:
|
|
||||||
- regexp: "^PasswordAuthentication"
|
|
||||||
line: "PasswordAuthentication {{ security_ssh_password_authentication }}"
|
|
||||||
- regexp: "^PermitRootLogin"
|
|
||||||
line: "PermitRootLogin {{ security_ssh_permit_root_login }}"
|
|
||||||
- regexp: "^Port"
|
|
||||||
line: "Port {{ security_ssh_port }}"
|
|
||||||
- regexp: "^UseDNS"
|
|
||||||
line: "UseDNS {{ security_ssh_usedns }}"
|
|
||||||
- regexp: "^PermitEmptyPasswords"
|
|
||||||
line: "PermitEmptyPasswords {{ security_ssh_permit_empty_password }}"
|
|
||||||
- regexp: "^ChallengeResponseAuthentication"
|
|
||||||
line: "ChallengeResponseAuthentication {{ security_ssh_challenge_response_auth }}"
|
|
||||||
- regexp: "^GSSAPIAuthentication"
|
|
||||||
line: "GSSAPIAuthentication {{ security_ssh_gss_api_authentication }}"
|
|
||||||
- regexp: "^X11Forwarding"
|
|
||||||
line: "X11Forwarding {{ security_ssh_x11_forwarding }}"
|
|
||||||
- regexp: "^ListenAddress"
|
|
||||||
line: "ListenAddress {{ ip_admin }}"
|
|
||||||
notify: restart ssh
|
|
||||||
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
APT::Periodic::Update-Package-Lists "1";
|
|
||||||
APT::Periodic::Download-Upgradeable-Packages "1";
|
|
||||||
APT::Periodic::AutocleanInterval "7";
|
|
||||||
APT::Periodic::Unattended-Upgrade "1";
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
Unattended-Upgrade::Automatic-Reboot "{{ security_autoupdate_reboot }}";
|
|
||||||
Unattended-Upgrade::Automatic-Reboot-Time "{{ security_autoupdate_reboot_time }}";
|
|
||||||
|
|
||||||
{% if security_autoupdate_mail_to %}
|
|
||||||
Unattended-Upgrade::Mail "{{ security_autoupdate_mail_to }}";
|
|
||||||
{% if security_autoupdate_mail_on_error %}
|
|
||||||
Unattended-Upgrade::MailOnlyOnError "true";
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
Unattended-Upgrade::Allowed-Origins {
|
|
||||||
"${distro_id} ${distro_codename}-security";
|
|
||||||
// "${distro_id} ${distro_codename}-updates";
|
|
||||||
};
|
|
||||||
|
|
||||||
Unattended-Upgrade::Package-Blacklist{
|
|
||||||
{% for package in security_autoupdate_blacklist %}
|
|
||||||
"{{package}}";
|
|
||||||
{% endfor %}
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
[sshd]
|
|
||||||
enabled = true
|
|
||||||
port = {{ security_ssh_port }}
|
|
||||||
filter = sshd
|
|
||||||
backend = systemd
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
---
|
|
||||||
security_ssh_config_path: /etc/ssh/sshd_config
|
|
||||||
security_sshd_name: ssh
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
---
|
|
||||||
security_ssh_config_path: /etc/ssh/sshd_config
|
|
||||||
security_sshd_name: sshd
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
---
|
|
||||||
language: python
|
|
||||||
python: "2.7"
|
|
||||||
|
|
||||||
# Use the new container infrastructure
|
|
||||||
sudo: false
|
|
||||||
|
|
||||||
# Install ansible
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- python-pip
|
|
||||||
|
|
||||||
install:
|
|
||||||
# Install ansible
|
|
||||||
- pip install ansible
|
|
||||||
|
|
||||||
# Check ansible version
|
|
||||||
- ansible --version
|
|
||||||
|
|
||||||
# Create ansible.cfg with correct roles_path
|
|
||||||
- printf '[defaults]\nroles_path=../' >ansible.cfg
|
|
||||||
|
|
||||||
script:
|
|
||||||
# Basic role syntax check
|
|
||||||
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
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).
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
# defaults file for create_samba_user
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
# handlers file for create_samba_user
|
|
||||||
- name: smb restart
|
|
||||||
service:
|
|
||||||
name: smb
|
|
||||||
state: restarted
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
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.
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
---
|
|
||||||
# tasks file for create_samba_user
|
|
||||||
- name: Create
|
|
||||||
ansible.builtin.blockinfile:
|
|
||||||
state: present
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
insertafter: EOF
|
|
||||||
path: /etc/samba/smb.conf
|
|
||||||
mode: '0644'
|
|
||||||
block: |
|
|
||||||
[{{ samba_user }}]
|
|
||||||
comment = {{ samba_user }} samba
|
|
||||||
path = {{ samba_mountpoint }}
|
|
||||||
browseable = yes
|
|
||||||
writeable = yes
|
|
||||||
read only = no
|
|
||||||
create mask = 0644
|
|
||||||
directory mask = 0755
|
|
||||||
valid users = {{ samba_user }}
|
|
||||||
notify: smb restart
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
localhost
|
|
||||||
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: localhost
|
|
||||||
remote_user: root
|
|
||||||
roles:
|
|
||||||
- create_samba_user
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
# vars file for create_samba_user
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
---
|
|
||||||
language: python
|
|
||||||
python: "2.7"
|
|
||||||
|
|
||||||
# Use the new container infrastructure
|
|
||||||
sudo: false
|
|
||||||
|
|
||||||
# Install ansible
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- python-pip
|
|
||||||
|
|
||||||
install:
|
|
||||||
# Install ansible
|
|
||||||
- pip install ansible
|
|
||||||
|
|
||||||
# Check ansible version
|
|
||||||
- ansible --version
|
|
||||||
|
|
||||||
# Create ansible.cfg with correct roles_path
|
|
||||||
- printf '[defaults]\nroles_path=../' >ansible.cfg
|
|
||||||
|
|
||||||
script:
|
|
||||||
# Basic role syntax check
|
|
||||||
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
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).
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
---
|
|
||||||
# defaults file for create_user
|
|
||||||
primary_group: "{{ user }}"
|
|
||||||
secondary_groups: ''
|
|
||||||
password: ''
|
|
||||||
shell: "/bin/bash"
|
|
||||||
home: "/home/{{ user }}"
|
|
||||||
create_home: "{{ 'false' if (home == '/nonexistent') else 'true'}}"
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
# handlers file for create_user
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
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.
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
---
|
|
||||||
# tasks file for create_user
|
|
||||||
- name: Adding group
|
|
||||||
ansible.builtin.group:
|
|
||||||
name: "{{ primary_group }}"
|
|
||||||
gid: "{{ gid }}"
|
|
||||||
state: present
|
|
||||||
when: gid != 65534
|
|
||||||
|
|
||||||
- name: Adding user
|
|
||||||
ansible.builtin.user:
|
|
||||||
name: "{{ user }}"
|
|
||||||
group: "{{ primary_group }}"
|
|
||||||
uid: "{{ uid }}"
|
|
||||||
shell: "{{ shell }}"
|
|
||||||
groups: "{{ secondary_groups }}"
|
|
||||||
home: "{{ home }}"
|
|
||||||
password: "{{ password }}"
|
|
||||||
create_home: "{{ create_home }}"
|
|
||||||
|
|
||||||
- name: Dowload ssh key
|
|
||||||
ansible.builtin.uri:
|
|
||||||
url: "{{ user_ssh_key_url }}"
|
|
||||||
method: GET
|
|
||||||
return_content: true
|
|
||||||
register: ssh_key
|
|
||||||
when: user_ssh_key_url is defined
|
|
||||||
|
|
||||||
- name: Setting ssh key
|
|
||||||
ansible.builtin.blockinfile:
|
|
||||||
state: present
|
|
||||||
owner: "{{ user }}"
|
|
||||||
group: "{{ primary_group }}"
|
|
||||||
insertafter: EOF
|
|
||||||
path: /home/{{ user }}/.ssh/authorized_keys
|
|
||||||
mode: '0644'
|
|
||||||
create: true
|
|
||||||
block: |
|
|
||||||
{{ ssh_key.content }}
|
|
||||||
when: user_ssh_key_url is defined
|
|
||||||
|
|
||||||
- name: Set permissions to .ssh folder
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: /home/{{ user }}/.ssh
|
|
||||||
owner: "{{ user }}"
|
|
||||||
group: "{{ primary_group }}"
|
|
||||||
mode: '0711'
|
|
||||||
when: user_ssh_key_url is defined
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
localhost
|
|
||||||
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: localhost
|
|
||||||
remote_user: root
|
|
||||||
roles:
|
|
||||||
- create_user
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
# vars file for create_user
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
---
|
|
||||||
language: python
|
|
||||||
python: "2.7"
|
|
||||||
|
|
||||||
# Use the new container infrastructure
|
|
||||||
sudo: false
|
|
||||||
|
|
||||||
# Install ansible
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- python-pip
|
|
||||||
|
|
||||||
install:
|
|
||||||
# Install ansible
|
|
||||||
- pip install ansible
|
|
||||||
|
|
||||||
# Check ansible version
|
|
||||||
- ansible --version
|
|
||||||
|
|
||||||
# Create ansible.cfg with correct roles_path
|
|
||||||
- printf '[defaults]\nroles_path=../' >ansible.cfg
|
|
||||||
|
|
||||||
script:
|
|
||||||
# Basic role syntax check
|
|
||||||
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
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).
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
# defaults file for create_zfs_dataset
|
|
||||||
zfs_dataset_size: 10M
|
|
||||||
zfs_dataset_mountpoint: "/{{ zfs_pool_name }}/{{ zfs_dataset_name }}"
|
|
||||||
zfs_dataset_user: root
|
|
||||||
zfs_dataset_group: root
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
# handlers file for create_zfs_dataset
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
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.
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
# tasks file for create_zfs_dataset
|
|
||||||
- name: Create zfs dataset
|
|
||||||
community.general.zfs:
|
|
||||||
name: "{{ zfs_pool_name }}/{{ zfs_dataset_name }}"
|
|
||||||
state: present
|
|
||||||
extra_zfs_properties:
|
|
||||||
quota: "{{ zfs_dataset_size }}"
|
|
||||||
mountpoint: "{{ zfs_dataset_mountpoint }}"
|
|
||||||
|
|
||||||
- name: Dir Ownershipt to {{ user }}
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ zfs_dataset_mountpoint }}"
|
|
||||||
owner: "{{ zfs_dataset_user }}"
|
|
||||||
group: "{{ zfs_dataset_group }}"
|
|
||||||
mode: '0731'
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
localhost
|
|
||||||
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: localhost
|
|
||||||
remote_user: root
|
|
||||||
roles:
|
|
||||||
- create_zfs_dataset
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
# vars file for create_zfs_dataset
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
---
|
|
||||||
language: python
|
|
||||||
python: "2.7"
|
|
||||||
|
|
||||||
# Use the new container infrastructure
|
|
||||||
sudo: false
|
|
||||||
|
|
||||||
# Install ansible
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- python-pip
|
|
||||||
|
|
||||||
install:
|
|
||||||
# Install ansible
|
|
||||||
- pip install ansible
|
|
||||||
|
|
||||||
# Check ansible version
|
|
||||||
- ansible --version
|
|
||||||
|
|
||||||
# Create ansible.cfg with correct roles_path
|
|
||||||
- printf '[defaults]\nroles_path=../' >ansible.cfg
|
|
||||||
|
|
||||||
script:
|
|
||||||
# Basic role syntax check
|
|
||||||
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
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).
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
---
|
|
||||||
# defaults file for docker_spin_up
|
|
||||||
docker_homepath: "/{{ zfs_pool_name }}/{{ docker_name }}"
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
# handlers file for docker_spin_up
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
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.
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
---
|
|
||||||
- name: "{{ docker_name }}"
|
|
||||||
community.docker.docker_container:
|
|
||||||
name: "{{ docker_name }}"
|
|
||||||
image: ghcr.io/gethomepage/homepage:latest
|
|
||||||
ports:
|
|
||||||
- 3000:3000
|
|
||||||
volumes:
|
|
||||||
- "{{ docker_homepath }}/config:/app/config" # Make sure your local config directory exists
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
---
|
|
||||||
- name: email
|
|
||||||
community.docker.docker_container:
|
|
||||||
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
---
|
|
||||||
- name: gitea
|
|
||||||
community.docker.docker_container:
|
|
||||||
image: gitea/gitea:1.19.3
|
|
||||||
name: gitea
|
|
||||||
env:
|
|
||||||
USER_UID: "1000"
|
|
||||||
USER_GID: "1000"
|
|
||||||
GITEA__database__DB_TYPE: "mysql"
|
|
||||||
GITEA__database__HOST: "{{ mysql_host}}:3306"
|
|
||||||
GITEA__database__NAME: "{{ GITEA__database__NAME }}"
|
|
||||||
GITEA__database__USER: "{{ GITEA__database__USER }}"
|
|
||||||
GITEA__database__PASSWD: "{{ GITEA__database__PASSWD }}"
|
|
||||||
ROOT_URL: "http://pi-vpn:8082/"
|
|
||||||
restart_policy: always
|
|
||||||
networks:
|
|
||||||
- name: http
|
|
||||||
volumes:
|
|
||||||
- "{{ docker_homepath }}/gitea:/data"
|
|
||||||
- /etc/timezone:/etc/timezone:ro
|
|
||||||
- /etc/localtime:/etc/localtime:ro
|
|
||||||
ports:
|
|
||||||
# - "8082:3000"
|
|
||||||
- "222:22"
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
- name: Dir-jellyfin-config
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ docker_homepath }}/config"
|
|
||||||
owner: "{{ user }}"
|
|
||||||
group: "{{ primary_group }}"
|
|
||||||
state: directory
|
|
||||||
mode: '0711'
|
|
||||||
|
|
||||||
- name: Dir-jellyfin-cache
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ docker_homepath }}/cache"
|
|
||||||
owner: "{{ user }}"
|
|
||||||
group: "{{ primary_group }}"
|
|
||||||
state: directory
|
|
||||||
mode: '0711'
|
|
||||||
|
|
||||||
|
|
||||||
- name: jellyfin
|
|
||||||
community.docker.docker_container:
|
|
||||||
name: jellyfin
|
|
||||||
image: jellyfin/jellyfin:2024042215
|
|
||||||
user: "{{ uid }}:{{ gid }}"
|
|
||||||
volumes:
|
|
||||||
- "/bigpool/tata/Music:/Music:ro"
|
|
||||||
- "{{ docker_homepath }}/config:/config"
|
|
||||||
- "{{ docker_homepath }}/cache:/cache"
|
|
||||||
restart_policy: unless-stopped
|
|
||||||
networks:
|
|
||||||
- name: http
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
---
|
|
||||||
# tasks file for docker_spin_up
|
|
||||||
#- name: Copy composer
|
|
||||||
# template:
|
|
||||||
# src: "../templates/{{ docker_compose_file }}"
|
|
||||||
# dest: "/{{ docker_homepath }}/docker-compose.yml"
|
|
||||||
# owner: root
|
|
||||||
# group: root
|
|
||||||
# mode: '0644'
|
|
||||||
|
|
||||||
- name: Create a network
|
|
||||||
community.docker.docker_network:
|
|
||||||
name: http
|
|
||||||
|
|
||||||
- name: Spin up {{ docker_compose_file }}
|
|
||||||
ansible.builtin.include_tasks:
|
|
||||||
"{{ docker_compose_file }}"
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Dir-loki
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ docker_homepath }}/loki-data"
|
|
||||||
owner: "{{ user }}"
|
|
||||||
group: "{{ primary_group }}"
|
|
||||||
state: directory
|
|
||||||
mode: '0711'
|
|
||||||
|
|
||||||
- name: Dir-grafana
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ docker_homepath }}/grafana-data"
|
|
||||||
owner: "{{ user }}"
|
|
||||||
group: "{{ primary_group }}"
|
|
||||||
state: directory
|
|
||||||
mode: '0711'
|
|
||||||
|
|
||||||
- name: Dir-promtail
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ docker_homepath }}/promtail-data"
|
|
||||||
owner: "{{ user }}"
|
|
||||||
group: "{{ primary_group }}"
|
|
||||||
state: directory
|
|
||||||
mode: '0711'
|
|
||||||
|
|
||||||
- name: promtail config copy
|
|
||||||
template:
|
|
||||||
src: ../templates/promtail-config.yml
|
|
||||||
dest: "{{ docker_homepath }}/promtail-data/promtail-config.yml"
|
|
||||||
owner: "{{ user}}"
|
|
||||||
group: "{{ primary_group }}"
|
|
||||||
mode: '0644'
|
|
||||||
|
|
||||||
- name: loki
|
|
||||||
community.docker.docker_container:
|
|
||||||
name: loki
|
|
||||||
user: "{{ uid }}:{{ gid }}"
|
|
||||||
image: 'grafana/loki:main-2c878c8'
|
|
||||||
restart_policy: unless-stopped
|
|
||||||
#ports:
|
|
||||||
# - '3100:3100'
|
|
||||||
volumes:
|
|
||||||
- "{{ docker_homepath }}/loki-data:/loki"
|
|
||||||
- "/etc/resolv.conf:/etc/resolv.conf:ro"
|
|
||||||
- "/etc/timezone:/etc/timezone:ro"
|
|
||||||
- "/etc/localtime:/etc/localtime:ro"
|
|
||||||
networks:
|
|
||||||
- name: http
|
|
||||||
|
|
||||||
- name: grafana
|
|
||||||
community.docker.docker_container:
|
|
||||||
name: grafana
|
|
||||||
image: 'grafana/grafana:10.2.6'
|
|
||||||
user: "{{ uid }}:{{ gid }}"
|
|
||||||
restart_policy: unless-stopped
|
|
||||||
#ports:
|
|
||||||
# - '3000:3000'
|
|
||||||
volumes:
|
|
||||||
- "{{ docker_homepath }}/grafana-data:/var/lib/grafana"
|
|
||||||
- "/etc/timezone:/etc/timezone:ro"
|
|
||||||
- "/etc/localtime:/etc/localtime:ro"
|
|
||||||
networks:
|
|
||||||
- name: http
|
|
||||||
|
|
||||||
- name: promtail
|
|
||||||
community.docker.docker_container:
|
|
||||||
name: promtail
|
|
||||||
image: 'grafana/promtail:main-e2952b9'
|
|
||||||
user: "0:0"
|
|
||||||
restart_policy: unless-stopped
|
|
||||||
command: -config.file=/etc/promtail/promtail-config.yml -config.expand-env=true
|
|
||||||
#ports:
|
|
||||||
# - '3000:3000'
|
|
||||||
volumes:
|
|
||||||
- "{{ docker_homepath }}/promtail-data:/etc/promtail"
|
|
||||||
- "/var/log:/var/log:ro"
|
|
||||||
- "/run/log/journal/:/run/log/journal/:ro"
|
|
||||||
- "/etc/machine-id:/etc/machine-id:ro"
|
|
||||||
- "/etc/timezone:/etc/timezone:ro"
|
|
||||||
- "/etc/localtime:/etc/localtime:ro"
|
|
||||||
networks:
|
|
||||||
- name: http
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
---
|
|
||||||
- name: nextcloud
|
|
||||||
community.docker.docker_container:
|
|
||||||
name: nextcloud
|
|
||||||
image: nextcloud:26.0-fpm
|
|
||||||
restart_policy: always
|
|
||||||
# ports:
|
|
||||||
# - 8080:80
|
|
||||||
volumes:
|
|
||||||
- "{{ docker_homepath }}/nextcloud_nextcloud_1/_data:/var/www/html"
|
|
||||||
env:
|
|
||||||
MYSQL_PASSWORD: "{{ NEXTCLOUD_MYSQL_PASSWORD }}"
|
|
||||||
MYSQL_DATABASE: "{{ NEXTCLOUD_MYSQL_DATABASE }}"
|
|
||||||
MYSQL_USER: "{{ NEXTCLOUD_MYSQL_USER }}"
|
|
||||||
MYSQL_HOST: "{{ mysql_host }}"
|
|
||||||
PHP_MEMORY_LIMIT: 2G
|
|
||||||
PHP_UPLOAD_LIMIT: 10G
|
|
||||||
networks:
|
|
||||||
- name: http
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
- name: nginx
|
|
||||||
community.docker.docker_container:
|
|
||||||
name: nginx
|
|
||||||
image: 'jc21/nginx-proxy-manager:latest'
|
|
||||||
restart_policy: unless-stopped
|
|
||||||
ports:
|
|
||||||
- '80:80'
|
|
||||||
#- "{{ ip_admin }}:81:81"
|
|
||||||
- '443:443'
|
|
||||||
volumes:
|
|
||||||
- "{{ docker_homepath }}/data:/data"
|
|
||||||
- "{{ docker_homepath }}/letsencrypt:/etc/letsencrypt"
|
|
||||||
- "/bigpool/nextcloud/nextcloud_nextcloud_1/_data/:/var/www/html:ro"
|
|
||||||
networks:
|
|
||||||
- name: http
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
- name: pi-hole
|
|
||||||
community.docker.docker_container:
|
|
||||||
name: pi-hole
|
|
||||||
image: pihole/pihole:2024.03.2
|
|
||||||
# For DHCP it is recommended to remove these ports and instead add: network_mode: "host"
|
|
||||||
ports:
|
|
||||||
- "53:53/tcp"
|
|
||||||
- "53:53/udp"
|
|
||||||
# - "8092:80/tcp"
|
|
||||||
env:
|
|
||||||
TZ: 'Europe/Prague'
|
|
||||||
WEBPASSWORD: "{{ password }}"
|
|
||||||
# Volumes store your data between container upgrades
|
|
||||||
volumes:
|
|
||||||
- "{{ docker_homepath }}/etc-pihole:/etc/pihole"
|
|
||||||
- "{{ docker_homepath }}/etc-dnsmasq.d:/etc/dnsmasq.d"
|
|
||||||
# https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
|
|
||||||
restart_policy: unless-stopped
|
|
||||||
networks:
|
|
||||||
- name: http
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
---
|
|
||||||
- name: transmission
|
|
||||||
community.docker.docker_container:
|
|
||||||
name: transmission
|
|
||||||
image: lscr.io/linuxserver/transmission:latest
|
|
||||||
#container_name: transmission
|
|
||||||
env:
|
|
||||||
PUID: "{{ uid }}"
|
|
||||||
PGID: "{{ uid }}"
|
|
||||||
TZ: Europe/Berlin
|
|
||||||
#TRANSMISSION_WEB_HOME=/combustion-release/ #optional
|
|
||||||
USER: "{{ user }}" #optional
|
|
||||||
PASS: "{{ password }}" #optional
|
|
||||||
volumes:
|
|
||||||
# - /path/to/data:/config
|
|
||||||
- "{{ docker_homepath }}/downloads:/downloads"
|
|
||||||
- "{{ docker_homepath }}/watch:/watch"
|
|
||||||
#ports:
|
|
||||||
# - 9091:9091
|
|
||||||
# - 51413:51413
|
|
||||||
# - 51413:51413/udp
|
|
||||||
restart_policy: unless-stopped
|
|
||||||
networks:
|
|
||||||
- name: http
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
server:
|
|
||||||
http_listen_port: 9080
|
|
||||||
grpc_listen_port: 0
|
|
||||||
positions:
|
|
||||||
filename: /tmp/positions.yaml
|
|
||||||
clients:
|
|
||||||
- url: http://loki:3100/loki/api/v1/push
|
|
||||||
#- url: https://loki.internal.matous.vondrejka.cz/loki/api/v1/push
|
|
||||||
|
|
||||||
scrape_configs:
|
|
||||||
- job_name: journal
|
|
||||||
journal:
|
|
||||||
json: false
|
|
||||||
max_age: 12h
|
|
||||||
path: /var/log/journal
|
|
||||||
labels:
|
|
||||||
job: systemd-journal
|
|
||||||
relabel_configs:
|
|
||||||
- source_labels: ['__journal__systemd_unit']
|
|
||||||
target_label: 'unit'
|
|
||||||
|
|
||||||
|
|
||||||
- job_name: docker
|
|
||||||
static_configs:
|
|
||||||
- targets:
|
|
||||||
- localhost
|
|
||||||
labels:
|
|
||||||
job: containerlogs
|
|
||||||
__path__: /var/lib/docker/containers/*/*log
|
|
||||||
|
|
||||||
pipeline_stages:
|
|
||||||
- json:
|
|
||||||
expressions:
|
|
||||||
output: log
|
|
||||||
stream: stream
|
|
||||||
attrs:
|
|
||||||
- json:
|
|
||||||
expressions:
|
|
||||||
tag:
|
|
||||||
source: attrs
|
|
||||||
- regex:
|
|
||||||
expression: (?P<image_name>(?:[^|]*[^|])).(?P<container_name>(?:[^|]*[^|])).(?P<image_id>(?:[^|]*[^|])).(?P<container_id>(?:[^|]*[^|]))
|
|
||||||
source: tag
|
|
||||||
- timestamp:
|
|
||||||
format: RFC3339Nano
|
|
||||||
source: time
|
|
||||||
- labels:
|
|
||||||
tag:
|
|
||||||
stream:
|
|
||||||
image_name:
|
|
||||||
container_name:
|
|
||||||
image_id:
|
|
||||||
container_id:
|
|
||||||
- output:
|
|
||||||
source: output/*-json.log
|
|
||||||
|
|
||||||
|
|
||||||
#scrape_configs:
|
|
||||||
#- job_name: journald
|
|
||||||
# journal: {}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
localhost
|
|
||||||
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: localhost
|
|
||||||
remote_user: root
|
|
||||||
roles:
|
|
||||||
- docker_spin_up
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
# vars file for docker_spin_up
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
---
|
|
||||||
language: python
|
|
||||||
python: "2.7"
|
|
||||||
|
|
||||||
# Use the new container infrastructure
|
|
||||||
sudo: false
|
|
||||||
|
|
||||||
# Install ansible
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- python-pip
|
|
||||||
|
|
||||||
install:
|
|
||||||
# Install ansible
|
|
||||||
- pip install ansible
|
|
||||||
|
|
||||||
# Check ansible version
|
|
||||||
- ansible --version
|
|
||||||
|
|
||||||
# Create ansible.cfg with correct roles_path
|
|
||||||
- printf '[defaults]\nroles_path=../' >ansible.cfg
|
|
||||||
|
|
||||||
script:
|
|
||||||
# Basic role syntax check
|
|
||||||
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
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).
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
# defaults file for gui_app_init
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
# handlers file for gui_app_init
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
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.
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Add repository for steam
|
|
||||||
become: true
|
|
||||||
ansible.builtin.dnf:
|
|
||||||
name:
|
|
||||||
- fedora-workstation-repositories
|
|
||||||
state: present
|
|
||||||
when: ansible_os_family == "RedHat"
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Add repository for vscode for "RedHat"
|
|
||||||
become: true
|
|
||||||
ansible.builtin.yum_repository:
|
|
||||||
name: vscode
|
|
||||||
description: Adding repo for vscode
|
|
||||||
baseurl: https://packages.microsoft.com/yumrepos/vscode
|
|
||||||
gpgkey: https://packages.microsoft.com/keys/microsoft.asc
|
|
||||||
when: ansible_os_family == "RedHat"
|
|
||||||
|
|
||||||
- name: Add gpg key for vscode for "Debian"
|
|
||||||
become: true
|
|
||||||
ansible.builtin.apt_key:
|
|
||||||
url: https://packages.microsoft.com/keys/microsoft.asc
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Add repository for vscode for "Debian"
|
|
||||||
become: true
|
|
||||||
ansible.builtin.apt_repository:
|
|
||||||
repo: deb https://packages.microsoft.com/repos/code stable main
|
|
||||||
#gpgkey: https://packages.microsoft.com/keys/microsoft.asc
|
|
||||||
when: ansible_os_family == "Debian"
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: Add repos
|
|
||||||
ansible.builtin.include_tasks: add_vscode_repo.yml
|
|
||||||
|
|
||||||
- name: Administration tools install
|
|
||||||
become: true
|
|
||||||
ansible.builtin.package:
|
|
||||||
name:
|
|
||||||
- libreoffice-base
|
|
||||||
- code
|
|
||||||
- terminator
|
|
||||||
state: present
|
|
||||||
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Steam and Discord
|
|
||||||
ansible.builtin.include_tasks: "{{ item }}"
|
|
||||||
loop:
|
|
||||||
- add_steam_repo.yml
|
|
||||||
- install_steam.yml
|
|
||||||
- install_discord.yml
|
|
||||||
|
|
||||||
|
|
||||||
- name: Stuff for run games
|
|
||||||
become: true
|
|
||||||
ansible.builtin.package:
|
|
||||||
name:
|
|
||||||
- wine
|
|
||||||
state: present
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Fedora version fetch
|
|
||||||
shell: |
|
|
||||||
rpm -E %fedora
|
|
||||||
register: prefedora_ver
|
|
||||||
when: ansible_os_family == "RedHat"
|
|
||||||
|
|
||||||
- name: Set fact
|
|
||||||
set_fact:
|
|
||||||
fedora_ver: "{{ prefedora_ver.stdout }}"
|
|
||||||
when: ansible_os_family == "RedHat"
|
|
||||||
|
|
||||||
- name: Add repo Discord repo for (Rhel) Fedora
|
|
||||||
become: true
|
|
||||||
ansible.builtin.dnf:
|
|
||||||
name: 'https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-{{ fedora_ver }}.noarch.rpm'
|
|
||||||
state: present
|
|
||||||
when: ansible_os_family == "RedHat"
|
|
||||||
|
|
||||||
- name: Discord install fedora
|
|
||||||
become: true
|
|
||||||
ansible.builtin.dnf:
|
|
||||||
name: discord
|
|
||||||
when: ansible_os_family == "RedHat"
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Steam install "RedHat"
|
|
||||||
become: true
|
|
||||||
ansible.builtin.dnf:
|
|
||||||
name: steam
|
|
||||||
enablerepo: rpmfusion-nonfree-steam
|
|
||||||
when: ansible_os_family == "RedHat"
|
|
||||||
|
|
||||||
- name: Add gpg key for steam for "Debian"
|
|
||||||
become: true
|
|
||||||
ansible.builtin.apt_key:
|
|
||||||
url: http://repo.steampowered.com/steam/archive/stable/steam.gpg
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Add repository for steam for "Debian"
|
|
||||||
become: true
|
|
||||||
ansible.builtin.apt_repository:
|
|
||||||
repo: deb http://repo.steampowered.com/steam/ stable steam
|
|
||||||
when: ansible_os_family == "Debian"
|
|
||||||
|
|
||||||
- name: Install Steam "Debian"
|
|
||||||
become: true
|
|
||||||
ansible.builtin.apt:
|
|
||||||
name: steam-launcher
|
|
||||||
state: present
|
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
# tasks file for gui_app_init
|
|
||||||
- name: Administration
|
|
||||||
ansible.builtin.include_tasks: "{{ item }}"
|
|
||||||
loop:
|
|
||||||
- administration.yml
|
|
||||||
- games.yml
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
[global_config]
|
|
||||||
[keybindings]
|
|
||||||
[profiles]
|
|
||||||
[[default]]
|
|
||||||
cursor_color = "#aaaaaa"
|
|
||||||
font = Hack Nerd Font Mono 14
|
|
||||||
use_system_font = False
|
|
||||||
[layouts]
|
|
||||||
[[default]]
|
|
||||||
[[[window0]]]
|
|
||||||
type = Window
|
|
||||||
parent = ""
|
|
||||||
[[[child1]]]
|
|
||||||
type = Terminal
|
|
||||||
parent = window0
|
|
||||||
[plugins]
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
localhost
|
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user