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" -## }}}