Added host templates + new firewall rules
This commit is contained in:
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