From 9b140a7a1bcf85177a31fe58c611f60e4d3bbead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Thu, 1 Mar 2018 11:09:08 +0100 Subject: [PATCH] Disable files management by Proxmox only one time Also add some lists var to be able to disable the wanted files. --- CHANGELOG.md | 5 +++++ README.md | 6 +++--- defaults/main.yml | 4 +++- tasks/main.yml | 18 +++++++++++------- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c8c4fb..413a1ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## v1.0.3 + +### Fixes +* Ensure to disable management of files by Proxmox only one time. + ## v1.0.2 ### Enhancements diff --git a/README.md b/README.md index 8207455..79e4263 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Manage some basics configuration for IPR's servers. * **basics__hosts_localhost_content** : Content of the localhost (127.0.0.1) line [default : `localhost.localdomain localhost`]. * **basics__hosts_ipv4_manage** : If the ipv4 address line should be managed [default : `false`]. * **basics__hosts_ipv4_content** : Content of the ipv4 address line [default : `{{ ansible_hostname }}.{{ basics__domain }} {{ ansible_hostname }}`]. -* **basics__proxmox_disable_hosts** : Disable the management of **/etc/hosts** file by Proxmox for LXC containers [default : `True`]. +* **basics__proxmox_*disable** : Allow to disable the management of some files by Proxmox for LXC containers [default : `[]`]. ## Example Playbook @@ -54,8 +54,7 @@ Ensure to have the correct fqdn and hostname in /etc/hosts : - You can choose to define the permanent ip (ipv4) line content. - All other lines that contains hostname without this permanent ip address will be removed. -For LXC containers, also ensure to disable the management of /etc/hosts by Proxmox : -- Touch a /etc/.pve-ignore.hosts file. +For LXC containers, you also have the possibility to disable the management of some files (/etc/hosts,…) by Proxmox. See [Proxmox wiki about LXC][wiki proxmox lxc]. ## Development @@ -80,3 +79,4 @@ Jérémy Gardais [basics github]: https://github.com/ipr-cnrs/basics [wtfpl website]: http://www.wtfpl.net/about/ [ipr website]: https://ipr.univ-rennes1.fr/ +[wiki proxmox lxc]: https://pve.proxmox.com/wiki/Linux_Container#_guest_operating_system_configuration diff --git a/defaults/main.yml b/defaults/main.yml index eeb576f..b1695dd 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -11,4 +11,6 @@ basics__hosts_ipv4_manage: false basics__hosts_ipv4_content: "{{ ansible_hostname }}.{{ basics__domain }} {{ ansible_hostname }}" # Proxmox -basics__proxmox_disable_hosts: True +basics__proxmox_disable: [] +basics__proxmox_group_disable: [] +basics__proxmox_host_disable: [] diff --git a/tasks/main.yml b/tasks/main.yml index ddce8dd..9080b15 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,4 +1,6 @@ --- +# .. vim: foldmarker=[[[,]]]:foldmethod=marker +# # tasks file for basics ## Modify /etc/hosts {{{ @@ -34,12 +36,14 @@ ## }}} -## Proxmox {{{ - -- name: Disable modification of /etc/hosts by Proxmox - file: - path: /etc/.pve-ignore.hosts - state: '{{ "touch" if basics__proxmox_disable_hosts else "absent" }}' +# 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 }}' when: ansible_virtualization_type == "lxc" -## }}}