220904
This commit is contained in:
commit
4ef45d1aac
71
tasks/main.yml
Normal file
71
tasks/main.yml
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
---
|
||||||
|
- name: "add ansible user"
|
||||||
|
remote_user: root
|
||||||
|
ignore_unreachable: yes
|
||||||
|
user:
|
||||||
|
name: ansible
|
||||||
|
system: yes
|
||||||
|
home: /var/local/ansible
|
||||||
|
comment: 'ansible management'
|
||||||
|
password: '!'
|
||||||
|
shell: '/bin/bash'
|
||||||
|
|
||||||
|
- name: "authorized_keys for ansible user"
|
||||||
|
remote_user: root
|
||||||
|
ignore_unreachable: yes
|
||||||
|
authorized_key:
|
||||||
|
user: ansible
|
||||||
|
key: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDWZi5nTI6zo3+cgGx5l163pEQXJ3aUyerqbHfQl9p8aB2bbe+vQl+Uc2Vrv8fvytAZizjPIIYdW5RqFAXrbNP+OpyFAONNZpX0omB8HLoHzOnmWpaCjMZp9XAdvWPknWFWWkwR5G5rbP5+dKeREzl4cAvW4GauEjaK4kUJF3K2HumVF6U3bzyDwnI+7h0zEbHddSOwAP1Opzla+WSdF+ZsiMdcVZE/mFxzd8sv1ZoO36sVZ1vItEAcols4qEAfwW8Gk/UjXI1XFRD1UrksAUxAc4ypu5oBVWtjMa429ZrCRbH2iU+TPbuUSXHJQMgTqsUgHrS9XkuS3EdbPA/aDMD1jhoYz2zyfAoCGdEBOuATlaoCOpOeSc9XIsasdVNwvtX2LCTlQe+LLOQzKiLaHEr/QmnLs8es8b68wtDlFIA2QAXYIfs8l+gBv3t3BIw7VPbMe8nb6hbTHFObDlVCyvXO2/6ZkOfRMgswFsQnGAqciowPxsjVer+I5hEBCMHgb6pxcUECxcxsc9P/w/z9LxGts9Ozyq55jzWMwvnFdarkzpMfWtt3QX7XG5B8OD4ghuMkX60GgvT7v1E7yTI/JtwXrsAc6jl1Qo4+TDdEYuBXe/LqyQzQ7GD1OoGRHIKCWyAQ9JiHcbUYX9p+vafXf0l1jelSg3O+cU+q+oZdGP178w== root@kavics'
|
||||||
|
|
||||||
|
- name: "sudo for ansible user"
|
||||||
|
remote_user: root
|
||||||
|
ignore_unreachable: yes
|
||||||
|
lineinfile:
|
||||||
|
path: /etc/sudoers
|
||||||
|
line: "ansible ALL=(ALL) NOPASSWD: ALL"
|
||||||
|
|
||||||
|
# as ansible user from here
|
||||||
|
|
||||||
|
- name: delayed facts gathering
|
||||||
|
setup:
|
||||||
|
|
||||||
|
- name: empty /etc/resolv.conf to avoid own hostname resolve errors
|
||||||
|
copy:
|
||||||
|
content: ""
|
||||||
|
dest: /etc/resolv.conf
|
||||||
|
tags: dns
|
||||||
|
|
||||||
|
- name: set hostname
|
||||||
|
command: "hostname {{ hostname }}"
|
||||||
|
|
||||||
|
- name: new /etc/hostname
|
||||||
|
copy:
|
||||||
|
dest: /etc/hostname
|
||||||
|
content: "{{ hostname }}\n"
|
||||||
|
|
||||||
|
- name: new /etc/network/interfaces
|
||||||
|
template:
|
||||||
|
src: interfaces.t
|
||||||
|
dest: /etc/network/interfaces
|
||||||
|
|
||||||
|
- name: new /etc/hosts
|
||||||
|
template:
|
||||||
|
src: hosts.t
|
||||||
|
dest: /etc/hosts
|
||||||
|
tags: dns
|
||||||
|
|
||||||
|
- name: new /etc/resolv.conf
|
||||||
|
template:
|
||||||
|
src: resolv.conf.t
|
||||||
|
dest: /etc/resolv.conf
|
||||||
|
tags: dns
|
||||||
|
|
||||||
|
- name: remove ssh host keys
|
||||||
|
shell: "rm /etc/ssh/ssh_host*key*"
|
||||||
|
|
||||||
|
- name: create new ssh host keys
|
||||||
|
command: "dpkg-reconfigure openssh-server"
|
||||||
|
|
||||||
|
#- name: postfix hostname ???? - nem kell, ezutan installaljuk csak
|
||||||
|
|
||||||
|
# vim: set tabstop=2 shiftwidth=2 expandtab smarttab:
|
||||||
2
templates/hosts.t
Normal file
2
templates/hosts.t
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
127.0.0.1 localhost
|
||||||
|
{{ ip }} {{ hostname }}.{{ domain }} {{ hostname }}
|
||||||
13
templates/interfaces.t
Normal file
13
templates/interfaces.t
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# This file describes the network interfaces available on your system
|
||||||
|
# and how to activate them. For more information, see interfaces(5).
|
||||||
|
|
||||||
|
source /etc/network/interfaces.d/*
|
||||||
|
|
||||||
|
auto lo
|
||||||
|
iface lo inet loopback
|
||||||
|
|
||||||
|
allow-hotplug eth0
|
||||||
|
iface eth0 inet static
|
||||||
|
address {{ ip }}
|
||||||
|
netmask {{ netmask }}
|
||||||
|
gateway {{ gw }}
|
||||||
5
templates/resolv.conf.t
Normal file
5
templates/resolv.conf.t
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
search {{ domain }}
|
||||||
|
{% set nameservers = dns.split('+') %}
|
||||||
|
{% for a in nameservers %}
|
||||||
|
nameserver {{ a }}
|
||||||
|
{% endfor %}
|
||||||
Loading…
x
Reference in New Issue
Block a user