You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.0 KiB
74 lines
2.0 KiB
---
|
|
- 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" }
|