3 changed files with 130 additions and 0 deletions
@ -0,0 +1,74 @@ |
|||||
|
--- |
||||
|
- name: Setup project directory with host_vars for three hosts |
||||
|
hosts: localhost |
||||
|
gather_facts: no |
||||
|
tasks: |
||||
|
- name: Create project directories |
||||
|
file: |
||||
|
path: "{{ item }}" |
||||
|
state: directory |
||||
|
mode: '0755' |
||||
|
with_items: |
||||
|
- "project/host_vars/host1" |
||||
|
- "project/host_vars/host2" |
||||
|
- "project/host_vars/host3" |
||||
|
|
||||
|
- name: Define host_vars for each host |
||||
|
copy: |
||||
|
dest: "project/host_vars/{{ item.host }}/vars.yml" |
||||
|
content: | |
||||
|
interface_name: "Wired connection 1" |
||||
|
static_ip: "{{ item.static_ip }}" |
||||
|
netmask: "255.255.255.0" |
||||
|
gateway: 172.20.1.251 |
||||
|
dns_servers: |
||||
|
- 172.20.1.251 |
||||
|
- 172.20.1.10 |
||||
|
- 172.20.1.11 |
||||
|
- 8.8.8.8 |
||||
|
new_hostname: "ansible-test02" |
||||
|
timezone: "Europe/Berlin" |
||||
|
required_pkgs: |
||||
|
- ufw |
||||
|
- fail2ban |
||||
|
- net-tools |
||||
|
- p7zip-full |
||||
|
- pigz |
||||
|
- htop |
||||
|
- iotop |
||||
|
- bash-completion |
||||
|
- rsync |
||||
|
- sudo |
||||
|
- nano |
||||
|
- vim |
||||
|
- screen |
||||
|
- curl |
||||
|
- gnupg2 |
||||
|
- apache2-utils |
||||
|
- mariadb-client |
||||
|
- git |
||||
|
- sshpass |
||||
|
ssh_ips: |
||||
|
- "195.192.223.212" # Ratingen |
||||
|
- "87.128.173.178" # Essen |
||||
|
- "94.79.143.149" # Dirk |
||||
|
tcp_ports: |
||||
|
- "22" |
||||
|
- "6789" |
||||
|
- "8080" |
||||
|
- "8443" |
||||
|
- "8843" |
||||
|
- "8880" |
||||
|
udp_ports: |
||||
|
- "3478" |
||||
|
ssh_pub_key: "<pub-key-from-client>" |
||||
|
admin_users: |
||||
|
- name: admin-johannes |
||||
|
- name: admin-daniel |
||||
|
- name: admin-dirk |
||||
|
- name: admin-martin |
||||
|
groups_to_add: "sudo,docker" |
||||
|
loop: |
||||
|
- { host: "host1", static_ip: "172.20.1.32" } |
||||
|
- { host: "host2", static_ip: "172.20.1.33" } |
||||
|
- { host: "host3", static_ip: "172.20.1.34" } |
||||
@ -0,0 +1,48 @@ |
|||||
|
--- |
||||
|
############ - Ansible Semaphore |
||||
|
volumes: |
||||
|
semaphore-mysql: |
||||
|
driver: local |
||||
|
services: |
||||
|
mysql: |
||||
|
image: mysql:8.0 |
||||
|
hostname: mysql |
||||
|
volumes: |
||||
|
- ./semaphore-mysql:/var/lib/mysql |
||||
|
environment: |
||||
|
- MYSQL_RANDOM_ROOT_PASSWORD=yes |
||||
|
- MYSQL_DATABASE=semaphore |
||||
|
- MYSQL_USER=semaphore |
||||
|
- MYSQL_PASSWORD=0semaphore # change! |
||||
|
restart: unless-stopped |
||||
|
semaphore: |
||||
|
container_name: ansiblesemaphore |
||||
|
# image: ghcr.io/andygeorge/semaphore-pip-ansible:latest |
||||
|
# image: semaphoreui/semaphore:latest |
||||
|
# build: . |
||||
|
image: new-semaphore |
||||
|
user: "${UID}:${GID}" |
||||
|
ports: |
||||
|
- 3000:3000 |
||||
|
environment: |
||||
|
- SEMAPHORE_DB_USER=semaphore |
||||
|
- SEMAPHORE_DB_PASS=0semaphore # change! |
||||
|
- SEMAPHORE_DB_HOST=mysql |
||||
|
- SEMAPHORE_DB_PORT=3306 |
||||
|
- SEMAPHORE_DB_DIALECT=mysql |
||||
|
- SEMAPHORE_DB=semaphore |
||||
|
- SEMAPHORE_PLAYBOOK_PATH=/tmp/semaphore/ |
||||
|
- SEMAPHORE_ADMIN_PASSWORD=hawkmoon # change! |
||||
|
- SEMAPHORE_ADMIN_NAME=admin |
||||
|
- SEMAPHORE_ADMIN_EMAIL=admin@localhost |
||||
|
- SEMAPHORE_ADMIN=admin |
||||
|
- SEMAPHORE_ACCESS_KEY_ENCRYPTION=ojRTz3NtFjZdqxkSuWPVbpUpqeEMNsu8qiEgQZ4+in0= # add to your access key encryption ! |
||||
|
- ANSIBLE_HOST_KEY_CHECKING=false # (optional) change to true if you want to enable host key checking |
||||
|
volumes: |
||||
|
- ./inventory/:/inventory:ro |
||||
|
- ./authorized-keys/:/authorized-keys:ro |
||||
|
- ./config/:/etc/semaphore:rw |
||||
|
restart: unless-stopped |
||||
|
depends_on: |
||||
|
- mysql |
||||
|
|
||||
@ -0,0 +1,8 @@ |
|||||
|
# Anpassung für die zusätzlich zu installierenden libs |
||||
|
FROM semaphoreui/semaphore:latest |
||||
|
|
||||
|
USER root |
||||
|
RUN apk add --no-cache python3 py3-pip |
||||
|
RUN pip install pywinrm jmespath netaddr passlib requests matrix_client |
||||
|
|
||||
|
USER semaphore |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue