82 lines
1.9 KiB
YAML
82 lines
1.9 KiB
YAML
|
---
|
||
|
- hosts: "{{ variable_host | default('lab15_standard') }}"
|
||
|
gather_facts: no
|
||
|
become: yes
|
||
|
connection: local
|
||
|
tasks:
|
||
|
- debug:
|
||
|
msg: "{{ ansible_ssh_host }} {{ inventory_hostname}}"
|
||
|
|
||
|
# HOSTNAME
|
||
|
- name: Set /etc/hostname
|
||
|
ansible.builtin.hostname:
|
||
|
name: "{{ inventory_hostname }}"
|
||
|
|
||
|
- name: add a list of hosts to /etc/hosts
|
||
|
become: yes
|
||
|
lineinfile:
|
||
|
dest: /etc/hosts
|
||
|
regexp: "^{{ item['ip'] }}.*$"
|
||
|
line: "{{ item['ip'] }}\t\t{{ item['names'] | join(' ') }}"
|
||
|
state: present
|
||
|
with_items:
|
||
|
- ip: 127.0.0.1
|
||
|
names:
|
||
|
- localhost
|
||
|
- ip: 127.0.1.1
|
||
|
names:
|
||
|
- '{{ inventory_hostname }}'
|
||
|
|
||
|
- ip: 156.17.9.28
|
||
|
names:
|
||
|
- whitney.kcir.pwr.edu.pl
|
||
|
- whitney
|
||
|
|
||
|
|
||
|
- name: Set ROS_IP
|
||
|
community.general.ini_file:
|
||
|
path: /etc/environment
|
||
|
section: null
|
||
|
|
||
|
option: ROS_IP
|
||
|
value: "{{ansible_ssh_host}}"
|
||
|
backup: yes
|
||
|
no_extra_spaces: yes
|
||
|
|
||
|
- name: Disable autoupdate
|
||
|
debconf:
|
||
|
name: unattended-upgrades
|
||
|
question: unattended-upgrades/enable_auto_updates
|
||
|
value: 'false'
|
||
|
vtype: select
|
||
|
|
||
|
- name: Disable errors report
|
||
|
ini_file:
|
||
|
path: /etc/default/apport
|
||
|
section: null
|
||
|
option: enabled
|
||
|
value: '0'
|
||
|
backup: yes
|
||
|
no_extra_spaces: yes
|
||
|
|
||
|
- name: Create folder /etc/systemd/system/systemd-logind.service.d/
|
||
|
file:
|
||
|
path: /etc/systemd/system/systemd-logind.service.d/
|
||
|
state: directory
|
||
|
|
||
|
- name: Create file /etc/systemd/system/systemd-logind.service.d/override.conf
|
||
|
copy:
|
||
|
dest: /etc/systemd/system/systemd-logind.service.d/override.conf
|
||
|
content: |
|
||
|
[Service]
|
||
|
RestrictAddressFamilies=AF_INET
|
||
|
IPAddressAllow=156.17.9.28
|
||
|
|
||
|
|
||
|
|
||
|
- name: lab user password
|
||
|
user:
|
||
|
name: lab
|
||
|
password: "{{ 'Gandalf15' | password_hash('sha512') }}"
|
||
|
|
||
|
|