Added host templates + new firewall rules
This commit is contained in:
2
templates/hosts-init.inv.j2
Normal file
2
templates/hosts-init.inv.j2
Normal file
@@ -0,0 +1,2 @@
|
||||
{{ ansible_nodename }} ansible_host={{ ansible_default_ipv4.address }} ansible_port=2230 ansible_user=tanguy
|
||||
roger-skyline-1 ansible_host=192.168.99.2 ansible_port=2230 ansible_user=tanguy
|
37
templates/init.yml.j2
Normal file
37
templates/init.yml.j2
Normal file
@@ -0,0 +1,37 @@
|
||||
- name: "Initialise network config, packages & user tanguy"
|
||||
hosts: {{ ansible_nodename }}
|
||||
become: yes
|
||||
become_user: root
|
||||
become_method: su
|
||||
tasks:
|
||||
- name: "Set up networking"
|
||||
copy:
|
||||
src: "files/interfaces"
|
||||
dest: "/etc/network/"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
- name: "Upload ssh config"
|
||||
copy:
|
||||
src: "files/sshd_config"
|
||||
dest: "/etc/ssh/"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
- name: "Install sudo"
|
||||
apt:
|
||||
name: ['sudo']
|
||||
update_cache: "yes"
|
||||
state: "present"
|
||||
- name: "Add tanguy to sudoers"
|
||||
user:
|
||||
name: "tanguy"
|
||||
groups: "sudo"
|
||||
append: yes
|
||||
- name: "Upload public key for tanguy"
|
||||
authorized_key:
|
||||
user: "tanguy"
|
||||
state: "present"
|
||||
key: "{{ lookup('file', '/Users/tmaze/.ssh/id_rsa.pub') }}"
|
||||
- name: "Restart networking service"
|
||||
service:
|
||||
name: "networking"
|
||||
state: "restarted"
|
Reference in New Issue
Block a user