2018-01-11 15:33:54 +01:00
|
|
|
---
|
2018-03-01 11:09:08 +01:00
|
|
|
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
|
|
|
|
#
|
2018-01-11 15:33:54 +01:00
|
|
|
# tasks file for basics
|
|
|
|
|
2018-02-26 16:19:49 +01:00
|
|
|
## Modify /etc/hosts {{{
|
2018-01-12 15:54:47 +01:00
|
|
|
|
2018-01-12 17:12:11 +01:00
|
|
|
- name: Config host - Set 127.0.0.1 line in hosts file
|
2018-01-11 15:33:54 +01:00
|
|
|
lineinfile:
|
|
|
|
dest: /etc/hosts
|
|
|
|
state: present
|
|
|
|
regexp: "^{{ ansible_lo.ipv4.address }}"
|
|
|
|
line: "{{ ansible_lo.ipv4.address }} {{ basics__hosts_localhost_content }}"
|
|
|
|
backup: yes
|
|
|
|
when: (basics__hosts_localhost_manage and
|
|
|
|
ansible_lo.ipv4.address is defined)
|
|
|
|
|
2018-01-12 17:12:11 +01:00
|
|
|
- name: Config host - Set ipv4 line in hosts file
|
2018-01-11 15:33:54 +01:00
|
|
|
lineinfile:
|
|
|
|
dest: /etc/hosts
|
|
|
|
state: present
|
|
|
|
regexp: "^{{ ansible_default_ipv4.address }}"
|
|
|
|
line: "{{ ansible_default_ipv4.address }} {{ basics__hosts_ipv4_content }}"
|
|
|
|
backup: yes
|
|
|
|
when: (basics__hosts_ipv4_manage and
|
|
|
|
ansible_default_ipv4.address is defined)
|
2018-01-12 15:54:47 +01:00
|
|
|
|
2018-01-12 17:12:11 +01:00
|
|
|
- name: Config host - Purge other lines with hostname
|
2018-01-12 15:54:47 +01:00
|
|
|
lineinfile:
|
|
|
|
dest: /etc/hosts
|
|
|
|
state: absent
|
|
|
|
regexp: '^(?!({{ ansible_default_ipv4.address }})).*{{ ansible_hostname }}'
|
|
|
|
backup: yes
|
2018-01-12 17:12:11 +01:00
|
|
|
when: (basics__hosts_ipv4_manage and
|
|
|
|
ansible_default_ipv4.address is defined)
|
2018-01-12 15:54:47 +01:00
|
|
|
|
|
|
|
## }}}
|
2018-02-26 16:19:49 +01:00
|
|
|
|
2018-03-01 11:09:08 +01:00
|
|
|
# Proxmox [[[1
|
|
|
|
- name: Disable modification of files by Proxmox
|
|
|
|
copy:
|
|
|
|
content: ""
|
|
|
|
dest: '{{ (item.path | dirname) + "/.pve-ignore." + (item.path | basename) }}'
|
|
|
|
with_flattened:
|
|
|
|
- '{{ basics__proxmox_disable }}'
|
|
|
|
- '{{ basics__proxmox_group_disable }}'
|
|
|
|
- '{{ basics__proxmox_host_disable }}'
|
2018-02-26 16:19:49 +01:00
|
|
|
when: ansible_virtualization_type == "lxc"
|
|
|
|
|
2018-05-15 10:21:21 +02:00
|
|
|
# Resolvconf [[[1
|
|
|
|
- name: Ensure Resolvconf required packages are in there desired state
|
|
|
|
package:
|
|
|
|
name: '{{ item }}'
|
|
|
|
state: 'present'
|
|
|
|
install_recommends: False
|
|
|
|
with_flattened:
|
|
|
|
- '{{ basics__resolvconf_packages }}'
|
|
|
|
when: basics__resolvconf_enabled|bool
|
|
|
|
|
2018-05-15 11:08:08 +02:00
|
|
|
- name: Configure Resolvconf with domains
|
|
|
|
template:
|
|
|
|
src: '../templates/etc/resolvconf/resolv.conf.d/base.j2'
|
|
|
|
dest: '/etc/resolvconf/resolv.conf.d/base'
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: '0644'
|
|
|
|
when: basics__resolvconf_enabled|bool
|
2018-05-15 11:15:39 +02:00
|
|
|
notify: ['restart resolvconf service']
|