Well, first push
This commit is contained in:
@@ -1,3 +1,2 @@
|
|||||||
# ansile_uni_deploy
|
# Ansible_Universal_Deploy
|
||||||
|
|
||||||
Just for me. Set all right.
|
Just for me. Set all right.
|
||||||
16
playbook.yml
Normal file
16
playbook.yml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
- name: And now all running
|
||||||
|
hosts: localhost
|
||||||
|
vars:
|
||||||
|
user: warezjoe
|
||||||
|
host: desktop # desktop rpi ntb
|
||||||
|
roles:
|
||||||
|
- role: linux_config_init # run with sudo alone
|
||||||
|
#- role: import_ssh_key # without sudo
|
||||||
|
#- role: tools_for_command_line
|
||||||
|
#- role: service_start
|
||||||
|
#- role: gui_app_init
|
||||||
|
#- role: ansible-role-docker
|
||||||
|
# docker_users: "{{ user }}"
|
||||||
|
|
||||||
|
|
||||||
4
roles/ansible-role-docker/.ansible-lint
Normal file
4
roles/ansible-role-docker/.ansible-lint
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
skip_list:
|
||||||
|
- 'yaml'
|
||||||
|
- 'risky-shell-pipe'
|
||||||
|
- 'role-name'
|
||||||
11
roles/ansible-role-docker/.yamllint
Normal file
11
roles/ansible-role-docker/.yamllint
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
extends: default
|
||||||
|
|
||||||
|
rules:
|
||||||
|
line-length:
|
||||||
|
max: 200
|
||||||
|
level: warning
|
||||||
|
|
||||||
|
ignore: |
|
||||||
|
.github/stale.yml
|
||||||
|
.travis.yml
|
||||||
20
roles/ansible-role-docker/LICENSE
Normal file
20
roles/ansible-role-docker/LICENSE
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
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.
|
||||||
128
roles/ansible-role-docker/README.md
Normal file
128
roles/ansible-role-docker/README.md
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
# 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/).
|
||||||
49
roles/ansible-role-docker/defaults/main.yml
Normal file
49
roles/ansible-role-docker/defaults/main.yml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
---
|
||||||
|
# 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: {}
|
||||||
7
roles/ansible-role-docker/handlers/main.yml
Normal file
7
roles/ansible-role-docker/handlers/main.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- name: restart docker
|
||||||
|
service:
|
||||||
|
name: docker
|
||||||
|
state: "{{ docker_restart_handler_state }}"
|
||||||
|
ignore_errors: "{{ ansible_check_mode }}"
|
||||||
|
when: docker_service_manage | bool
|
||||||
41
roles/ansible-role-docker/meta/main.yml
Normal file
41
roles/ansible-role-docker/meta/main.yml
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
---
|
||||||
|
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
|
||||||
24
roles/ansible-role-docker/molecule/default/converge.yml
Normal file
24
roles/ansible-role-docker/molecule/default/converge.yml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
- 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
|
||||||
19
roles/ansible-role-docker/molecule/default/molecule.yml
Normal file
19
roles/ansible-role-docker/molecule/default/molecule.yml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
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}
|
||||||
31
roles/ansible-role-docker/tasks/docker-compose.yml
Normal file
31
roles/ansible-role-docker/tasks/docker-compose.yml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
- 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', '')), '<'))
|
||||||
10
roles/ansible-role-docker/tasks/docker-users.yml
Normal file
10
roles/ansible-role-docker/tasks/docker-users.yml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
- 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
|
||||||
98
roles/ansible-role-docker/tasks/main.yml
Normal file
98
roles/ansible-role-docker/tasks/main.yml
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
---
|
||||||
|
- 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
|
||||||
50
roles/ansible-role-docker/tasks/setup-Debian.yml
Normal file
50
roles/ansible-role-docker/tasks/setup-Debian.yml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
---
|
||||||
|
- 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
|
||||||
52
roles/ansible-role-docker/tasks/setup-RedHat.yml
Normal file
52
roles/ansible-role-docker/tasks/setup-RedHat.yml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
---
|
||||||
|
- 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
|
||||||
2
roles/ansible-role-docker/vars/Alpine.yml
Executable file
2
roles/ansible-role-docker/vars/Alpine.yml
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
docker_packages: "docker"
|
||||||
2
roles/ansible-role-docker/vars/Archlinux.yml
Normal file
2
roles/ansible-role-docker/vars/Archlinux.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
docker_packages: "docker"
|
||||||
2
roles/ansible-role-docker/vars/main.yml
Executable file
2
roles/ansible-role-docker/vars/main.yml
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# Empty file
|
||||||
29
roles/gui_app_init/.travis.yml
Normal file
29
roles/gui_app_init/.travis.yml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
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/
|
||||||
38
roles/gui_app_init/README.md
Normal file
38
roles/gui_app_init/README.md
Normal 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
roles/gui_app_init/defaults/main.yml
Normal file
2
roles/gui_app_init/defaults/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# defaults file for gui_app_init
|
||||||
2
roles/gui_app_init/handlers/main.yml
Normal file
2
roles/gui_app_init/handlers/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# handlers file for gui_app_init
|
||||||
52
roles/gui_app_init/meta/main.yml
Normal file
52
roles/gui_app_init/meta/main.yml
Normal 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.
|
||||||
9
roles/gui_app_init/tasks/add_steam_repo.yml
Normal file
9
roles/gui_app_init/tasks/add_steam_repo.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
- name: Add repository for steam
|
||||||
|
become: true
|
||||||
|
ansible.builtin.dnf:
|
||||||
|
name:
|
||||||
|
- fedora-workstation-repositories
|
||||||
|
state: present
|
||||||
|
when: ansible_os_family == "RedHat"
|
||||||
|
|
||||||
9
roles/gui_app_init/tasks/add_vscode_repo.yml
Normal file
9
roles/gui_app_init/tasks/add_vscode_repo.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
- name: Add repository for vscode
|
||||||
|
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"
|
||||||
19
roles/gui_app_init/tasks/administration.yml
Normal file
19
roles/gui_app_init/tasks/administration.yml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- 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
|
||||||
|
|
||||||
|
- name: Setting Terminator
|
||||||
|
ansible.builtin.include_tasks: "{{ item }}"
|
||||||
|
loop:
|
||||||
|
- font_set.yml
|
||||||
|
- terminator_cofig_copy.yml
|
||||||
16
roles/gui_app_init/tasks/font_set.yml
Normal file
16
roles/gui_app_init/tasks/font_set.yml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
- name: ensure fonts directory
|
||||||
|
file:
|
||||||
|
path: "/home/{{ user }}/.local/share/fonts"
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Hack exists
|
||||||
|
shell: "ls /home/{{ user }}/.local/share/fonts/Hack*Nerd*Font*Complete*"
|
||||||
|
register: hack_exists
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
|
- name: Download Hack
|
||||||
|
when: hack_exists is failed
|
||||||
|
ansible.builtin.unarchive:
|
||||||
|
src: https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/Hack.zip
|
||||||
|
dest: "/home/{{ user }}/.local/share/fonts"
|
||||||
|
remote_src: yes
|
||||||
15
roles/gui_app_init/tasks/games.yml
Normal file
15
roles/gui_app_init/tasks/games.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
- 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
|
||||||
23
roles/gui_app_init/tasks/install_discord.yml
Normal file
23
roles/gui_app_init/tasks/install_discord.yml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
- 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 }}"
|
||||||
|
|
||||||
|
- name: Add repo Discord repo for 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"
|
||||||
7
roles/gui_app_init/tasks/install_steam.yml
Normal file
7
roles/gui_app_init/tasks/install_steam.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- name: Steam install fedora
|
||||||
|
become: true
|
||||||
|
ansible.builtin.dnf:
|
||||||
|
name: steam
|
||||||
|
enablerepo: rpmfusion-nonfree-steam
|
||||||
|
when: ansible_os_family == "RedHat"
|
||||||
7
roles/gui_app_init/tasks/main.yml
Normal file
7
roles/gui_app_init/tasks/main.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
# tasks file for gui_app_init
|
||||||
|
- name: Administration
|
||||||
|
ansible.builtin.include_tasks: "{{ item }}"
|
||||||
|
loop:
|
||||||
|
- administration.yml
|
||||||
|
- games.yml
|
||||||
8
roles/gui_app_init/tasks/terminator_cofig_copy.yml
Normal file
8
roles/gui_app_init/tasks/terminator_cofig_copy.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
- name: copy Terminator config
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: config
|
||||||
|
dest: /home/{{ user }}/.local/terminator
|
||||||
|
owner: "{{ user }}"
|
||||||
|
group: "{{ user }}"
|
||||||
|
mode: '0644'
|
||||||
16
roles/gui_app_init/templates/config
Normal file
16
roles/gui_app_init/templates/config
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
[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]
|
||||||
2
roles/gui_app_init/tests/inventory
Normal file
2
roles/gui_app_init/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
||||||
5
roles/gui_app_init/tests/test.yml
Normal file
5
roles/gui_app_init/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- gui_app_init
|
||||||
2
roles/gui_app_init/vars/main.yml
Normal file
2
roles/gui_app_init/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# vars file for gui_app_init
|
||||||
29
roles/import_ssh_key/.travis.yml
Normal file
29
roles/import_ssh_key/.travis.yml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
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/
|
||||||
2
roles/import_ssh_key/defaults/main.yml
Normal file
2
roles/import_ssh_key/defaults/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# defaults file for import_ssh_key
|
||||||
2
roles/import_ssh_key/handlers/main.yml
Normal file
2
roles/import_ssh_key/handlers/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# handlers file for import_ssh_key
|
||||||
17
roles/import_ssh_key/tasks/main.yml
Normal file
17
roles/import_ssh_key/tasks/main.yml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
- name: Dowload
|
||||||
|
ansible.builtin.uri:
|
||||||
|
url: https://github.com/MatousVondrejka.keys
|
||||||
|
method: GET
|
||||||
|
return_content: true
|
||||||
|
register: ssh_key
|
||||||
|
|
||||||
|
- name: Setting
|
||||||
|
ansible.builtin.blockinfile:
|
||||||
|
state: present
|
||||||
|
insertafter: EOF
|
||||||
|
path: ~/.ssh/authorized_keys
|
||||||
|
mode: '0664'
|
||||||
|
create: true
|
||||||
|
block: |
|
||||||
|
{{ ssh_key.content }}
|
||||||
2
roles/import_ssh_key/tests/inventory
Normal file
2
roles/import_ssh_key/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
||||||
5
roles/import_ssh_key/tests/test.yml
Normal file
5
roles/import_ssh_key/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- import_ssh_key
|
||||||
2
roles/import_ssh_key/vars/main.yml
Normal file
2
roles/import_ssh_key/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# vars file for import_ssh_key
|
||||||
29
roles/linux_config_init/.travis.yml
Normal file
29
roles/linux_config_init/.travis.yml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
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/
|
||||||
2
roles/linux_config_init/defaults/main.yml
Normal file
2
roles/linux_config_init/defaults/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# defaults file for linux_config_tinker
|
||||||
2
roles/linux_config_init/handlers/main.yml
Normal file
2
roles/linux_config_init/handlers/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# handlers file for linux_config_tinker
|
||||||
3
roles/linux_config_init/tasks/hostname_set.yml
Normal file
3
roles/linux_config_init/tasks/hostname_set.yml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
- name: Set a hostname
|
||||||
|
ansible.builtin.hostname:
|
||||||
|
name: "{{ host }}"
|
||||||
12
roles/linux_config_init/tasks/main.yml
Normal file
12
roles/linux_config_init/tasks/main.yml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
# tasks file for linux_config_init
|
||||||
|
- name: System settings in /etc
|
||||||
|
ansible.builtin.include_tasks: "{{ item }}"
|
||||||
|
loop:
|
||||||
|
- static_dns.yml
|
||||||
|
- sudoer_no_passwd.yml
|
||||||
|
- hostname_set.yml
|
||||||
|
|
||||||
|
- name: Set Pernament IP
|
||||||
|
ansible.builtin.include_tasks: set_perma_ip.yml
|
||||||
|
when: host != 'ntb'
|
||||||
23
roles/linux_config_init/tasks/set_perma_ip.yml
Normal file
23
roles/linux_config_init/tasks/set_perma_ip.yml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
- name: Fedora version fetch
|
||||||
|
shell: |
|
||||||
|
nmcli c | grep ethernet | awk -F '\\s\\s' '{print $1}'
|
||||||
|
register: prefedora_ver
|
||||||
|
|
||||||
|
- name: Delete all old ethernet connections for desktop exept below configured
|
||||||
|
community.general.nmcli:
|
||||||
|
conn_name: '*'
|
||||||
|
state: absent
|
||||||
|
when: host == 'desktop'
|
||||||
|
|
||||||
|
- name: Add an Ethernet connection with static IP configuration for desktop
|
||||||
|
community.general.nmcli:
|
||||||
|
conn_name: deksktop-local
|
||||||
|
ifname: enp7s0
|
||||||
|
type: ethernet
|
||||||
|
ip4: 192.168.5.99/24
|
||||||
|
gw4: 192.168.5.1
|
||||||
|
dns4: 8.8.8.8
|
||||||
|
state: present
|
||||||
|
autoconnect: true
|
||||||
|
when: host == 'desktop'
|
||||||
14
roles/linux_config_init/tasks/static_dns.yml
Normal file
14
roles/linux_config_init/tasks/static_dns.yml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
- name: DNS
|
||||||
|
become: true
|
||||||
|
ansible.builtin.blockinfile:
|
||||||
|
state: present
|
||||||
|
insertafter: EOF
|
||||||
|
path: /etc/hosts
|
||||||
|
mode: '0644'
|
||||||
|
create: true
|
||||||
|
block: |
|
||||||
|
10.0.0.4 pi-vpn
|
||||||
|
10.0.0.2 desktop-vpn
|
||||||
|
192.168.5.99 desktop-local
|
||||||
|
38.242.153.122 vps
|
||||||
8
roles/linux_config_init/tasks/sudoer_no_passwd.yml
Normal file
8
roles/linux_config_init/tasks/sudoer_no_passwd.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
- name: No password for sudo
|
||||||
|
become: true
|
||||||
|
community.general.sudoers:
|
||||||
|
nopassword: true
|
||||||
|
commands: ALL
|
||||||
|
user: "{{ user }}"
|
||||||
|
name: No password for sudo
|
||||||
2
roles/linux_config_init/tests/inventory
Normal file
2
roles/linux_config_init/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
||||||
5
roles/linux_config_init/tests/test.yml
Normal file
5
roles/linux_config_init/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- linux_config_tinker
|
||||||
2
roles/linux_config_init/vars/main.yml
Normal file
2
roles/linux_config_init/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# vars file for linux_config_tinker
|
||||||
38
roles/service_start/README.md
Normal file
38
roles/service_start/README.md
Normal 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
roles/service_start/defaults/main.yml
Normal file
2
roles/service_start/defaults/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# defaults file for service_start
|
||||||
2
roles/service_start/handlers/main.yml
Normal file
2
roles/service_start/handlers/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# handlers file for service_start
|
||||||
52
roles/service_start/meta/main.yml
Normal file
52
roles/service_start/meta/main.yml
Normal 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.
|
||||||
4
roles/service_start/tasks/main.yml
Normal file
4
roles/service_start/tasks/main.yml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
# tasks file for service_start
|
||||||
|
- name: SSH server
|
||||||
|
ansible.builtin.include_tasks: ssh_server.yml
|
||||||
18
roles/service_start/tasks/ssh_server.yml
Normal file
18
roles/service_start/tasks/ssh_server.yml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
- name: replace line
|
||||||
|
become: true
|
||||||
|
lineinfile:
|
||||||
|
path: /etc/ssh/sshd_config
|
||||||
|
regexp: '^(.*)#PasswordAuthentication yes(.*)$'
|
||||||
|
line: 'PasswordAuthentication no'
|
||||||
|
backrefs: yes
|
||||||
|
|
||||||
|
|
||||||
|
- name: Start and enable sshd
|
||||||
|
become: true
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: sshd
|
||||||
|
state: started
|
||||||
|
enabled: true
|
||||||
|
when: host != 'ntb'
|
||||||
|
|
||||||
2
roles/service_start/tests/inventory
Normal file
2
roles/service_start/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
||||||
5
roles/service_start/tests/test.yml
Normal file
5
roles/service_start/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- service_start
|
||||||
2
roles/service_start/vars/main.yml
Normal file
2
roles/service_start/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# vars file for service_start
|
||||||
29
roles/tools_for_command_line/.travis.yml
Normal file
29
roles/tools_for_command_line/.travis.yml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
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/
|
||||||
2
roles/tools_for_command_line/defaults/main.yml
Normal file
2
roles/tools_for_command_line/defaults/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# defaults file for tools_for_command_line
|
||||||
2
roles/tools_for_command_line/handlers/main.yml
Normal file
2
roles/tools_for_command_line/handlers/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# handlers file for tools_for_command_line
|
||||||
33
roles/tools_for_command_line/tasks/administration.yml
Normal file
33
roles/tools_for_command_line/tasks/administration.yml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
- name: Administration
|
||||||
|
become: true
|
||||||
|
ansible.builtin.package:
|
||||||
|
name:
|
||||||
|
- htop
|
||||||
|
- mc
|
||||||
|
- nano
|
||||||
|
- net-tools
|
||||||
|
- git
|
||||||
|
- ncdu
|
||||||
|
- nmap
|
||||||
|
- telnet
|
||||||
|
- gpg
|
||||||
|
- openssh-server
|
||||||
|
- neofetch
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Wireguard deb
|
||||||
|
become: true
|
||||||
|
ansible.builtin.package:
|
||||||
|
name:
|
||||||
|
- wireguard
|
||||||
|
state: present
|
||||||
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
|
- name: Wireguard other
|
||||||
|
become: true
|
||||||
|
ansible.builtin.package:
|
||||||
|
name:
|
||||||
|
- wireguard-tools
|
||||||
|
state: present
|
||||||
|
when: ansible_os_family != 'Debian'
|
||||||
5
roles/tools_for_command_line/tasks/main.yml
Normal file
5
roles/tools_for_command_line/tasks/main.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
# tasks file for tools_for_command_line
|
||||||
|
- name: Critical system
|
||||||
|
ansible.builtin.include_tasks:
|
||||||
|
administration.yml
|
||||||
2
roles/tools_for_command_line/tests/inventory
Normal file
2
roles/tools_for_command_line/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
||||||
5
roles/tools_for_command_line/tests/test.yml
Normal file
5
roles/tools_for_command_line/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- tools_for_command_line
|
||||||
2
roles/tools_for_command_line/vars/main.yml
Normal file
2
roles/tools_for_command_line/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# vars file for tools_for_command_line
|
||||||
Reference in New Issue
Block a user