From 6ed28366124713afb588ad96b7040fbe0841a32d Mon Sep 17 00:00:00 2001 From: Matthieu Saulnier Date: Sun, 23 Dec 2018 22:58:15 +0100 Subject: Update ini_file module syntax --- roles/common/tasks/dnf.yml | 59 +++++++++++++++++++++++------------------- roles/common/tasks/logo.yml | 34 ++++++++++++++---------- roles/common/tasks/repos.yml | 36 ++++++++++++++------------ roles/common/tasks/systemd.yml | 9 ++++--- roles/common/tasks/yum.yml | 50 +++++++++++++++++++++-------------- 5 files changed, 107 insertions(+), 81 deletions(-) diff --git a/roles/common/tasks/dnf.yml b/roles/common/tasks/dnf.yml index bccd363..0bd979b 100644 --- a/roles/common/tasks/dnf.yml +++ b/roles/common/tasks/dnf.yml @@ -1,36 +1,41 @@ - name: Affichage historique - ini_file: dest=/etc/dnf/dnf.conf - section=main - option=history_list_view - value=cmds - when: ansible_distribution == "Fedora" and ansible_distribution_version|int >= 22 + ini_file: + path: /etc/dnf/dnf.conf + section: main + option: history_list_view + value: cmds + when: ansible_pkg_mgr == "dnf" - name: Clean requirements on remove - ini_file: dest=/etc/dnf/dnf.conf - section=main - option=clean_requirements_on_remove - value=true - when: ansible_distribution == "Fedora" and ansible_distribution_version|int >= 22 + ini_file: + path: /etc/dnf/dnf.conf + section: main + option: clean_requirements_on_remove + value: "true" + when: ansible_pkg_mgr == "dnf" - name: Désactivation delta rpm - ini_file: dest=/etc/dnf/dnf.conf - section=main - option=deltarpm - value=false - when: ansible_distribution_version|int >= 22 + ini_file: + path: /etc/dnf/dnf.conf + section: main + option: deltarpm + value: "false" + when: ansible_pkg_mgr == "dnf" - name: Nombre mini de noyaux installés - ini_file: dest=/etc/dnf/dnf.conf - section=main - option=installonly_limit - value={{ minkernel }} - when: ansible_distribution == "Fedora" and ansible_distribution_version|int >= 22 - and ansible_virtualization_role is defined and ansible_virtualization_role == "guest" + ini_file: + path: /etc/dnf/dnf.conf + section: main + option: installonly_limit + value: "{{ minkernel }}" + when: ansible_virtualization_role is defined and ansible_virtualization_role == "guest" + and ansible_pkg_mgr == "dnf" - name: Nombre maxi de noyaux installés - ini_file: dest=/etc/dnf/dnf.conf - section=main - option=installonly_limit - value={{ maxkernel }} - when: ansible_distribution == "Fedora" and ansible_distribution_version|int >= 22 - and ansible_virtualization_role == "NA" or ansible_virtualization_role == "host" + ini_file: + path: /etc/dnf/dnf.conf + section: main + option: installonly_limit + value: "{{ maxkernel }}" + when: ansible_virtualization_role == "NA" or ansible_virtualization_role == "host" + and ansible_pkg_mgr == "dnf" diff --git a/roles/common/tasks/logo.yml b/roles/common/tasks/logo.yml index 98c6a98..c6de332 100644 --- a/roles/common/tasks/logo.yml +++ b/roles/common/tasks/logo.yml @@ -1,13 +1,17 @@ - name: Retrait linux_logo en Exclude (yum) - ini_file: dest=/etc/yum.conf - section=main - option=exclude + ini_file: + path: /etc/yum.conf + section: main + option: exclude + state: absent when: ansible_pkg_mgr == "yum" - name: Retrait linux_logo en Exclude (dnf) - ini_file: dest=/etc/dnf/dnf.conf - section=main - option=exclude + ini_file: + path: /etc/dnf/dnf.conf + section: main + option: exclude + state: absent when: ansible_pkg_mgr == "dnf" - name: Installation linux_logo Fedora x86_64 @@ -25,15 +29,17 @@ and ansible_architecture == "armv7l" - name: Ajout linux_logo en Exclude (yum) - ini_file: dest=/etc/yum.conf - section=main - option=exclude - value=linux_logo + ini_file: + path: /etc/yum.conf + section: main + option: exclude + value: linux_logo when: ansible_pkg_mgr == "yum" - name: Ajout linux_logo en Exclude (dnf) - ini_file: dest=/etc/dnf/dnf.conf - section=main - option=exclude - value=linux_logo + ini_file: + path: /etc/dnf/dnf.conf + section: main + option: exclude + value: linux_logo when: ansible_pkg_mgr == "dnf" diff --git a/roles/common/tasks/repos.yml b/roles/common/tasks/repos.yml index 15a1ae1..650edec 100644 --- a/roles/common/tasks/repos.yml +++ b/roles/common/tasks/repos.yml @@ -21,20 +21,22 @@ tags: localmirror - name: Désactivation du dépôt Updates - ini_file: dest=/etc/yum.repos.d/fedora-updates.repo - section=updates - option=enabled - value=0 + ini_file: + path: /etc/yum.repos.d/fedora-updates.repo + section: updates + option: enabled + value: "0" when: ansible_distribution_version|int >= mirrorlimitdown and ansible_architecture == "x86_64" and ansible_distribution_release != "Rawhide" and mirrorenable == "1" or mirrorhiddenenable == "1" tags: localmirror - name: Activation du dépôt Updates - ini_file: dest=/etc/yum.repos.d/fedora-updates.repo - section=updates - option=enabled - value=1 + ini_file: + path: /etc/yum.repos.d/fedora-updates.repo + section: updates + option: enabled + value: "1" when: ansible_distribution_version|int >= mirrorlimitdown and ansible_architecture == "x86_64" and ansible_distribution_release != "Rawhide" and mirrorenable == "0" and mirrorhiddenenable == "0" @@ -65,20 +67,22 @@ tags: localmirror - name: Désactivation du dépôt Fedora - ini_file: dest=/etc/yum.repos.d/fedora.repo - section=fedora - option=enabled - value=0 + ini_file: + path: /etc/yum.repos.d/fedora.repo + section: fedora + option: enabled + value: "0" when: ansible_distribution_version|int >= mirrorlimitdown and ansible_architecture == "x86_64" and ansible_distribution_release != "Rawhide" and mirrorenable == "1" or mirrorhiddenenable == "1" tags: localmirror - name: Activation du dépôt Fedora - ini_file: dest=/etc/yum.repos.d/fedora.repo - section=fedora - option=enabled - value=1 + ini_file: + path: /etc/yum.repos.d/fedora.repo + section: fedora + option: enabled + value: "1" when: ansible_distribution_version|int >= mirrorlimitdown and ansible_architecture == "x86_64" and ansible_distribution_release != "Rawhide" and mirrorenable == "0" and mirrorhiddenenable == "0" diff --git a/roles/common/tasks/systemd.yml b/roles/common/tasks/systemd.yml index d5c3def..4209355 100644 --- a/roles/common/tasks/systemd.yml +++ b/roles/common/tasks/systemd.yml @@ -1,6 +1,7 @@ - name: Configuration systemd écran rabattu - ini_file: dest=/etc/systemd/logind.conf - section=Login - option=HandleLidSwitch - value=ignore + ini_file: + path: /etc/systemd/logind.conf + section: Login + option: HandleLidSwitch + value: ignore notify: reload systemd diff --git a/roles/common/tasks/yum.yml b/roles/common/tasks/yum.yml index 1ed8a95..e79466f 100644 --- a/roles/common/tasks/yum.yml +++ b/roles/common/tasks/yum.yml @@ -1,31 +1,41 @@ - name: Affichage historique - ini_file: dest=/etc/yum.conf - section=main - option=history_list_view - value=cmds + ini_file: + path: /etc/yum.conf + section: main + option: history_list_view + value: cmds + when: ansible_pkg_mgr == "yum" - name: Clean requirements on remove - ini_file: dest=/etc/yum.conf - section=main - option=clean_requirements_on_remove - value=1 + ini_file: + path: /etc/yum.conf + section: main + option: clean_requirements_on_remove + value: "1" + when: ansible_pkg_mgr == "yum" - name: Désactivation delta rpm - ini_file: dest=/etc/yum.conf - section=main - option=deltarpm - value=0 + ini_file: + path: /etc/yum.conf + section: main + option: deltarpm + value: "0" + when: ansible_pkg_mgr == "yum" - name: Nombre mini de noyaux installés - ini_file: dest=/etc/yum.conf - section=main - option=installonly_limit - value={{ minkernel }} + ini_file: + path: /etc/yum.conf + section: main + option: installonly_limit + value: "{{ minkernel }}" when: ansible_virtualization_role is defined and ansible_virtualization_role == "guest" + and ansible_pkg_mgr == "yum" - name: Nombre maxi de noyaux installés - ini_file: dest=/etc/yum.conf - section=main - option=installonly_limit - value={{ maxkernel }} + ini_file: + path: /etc/yum.conf + section: main + option: installonly_limit + value: "{{ maxkernel }}" when: ansible_virtualization_role == "NA" or ansible_virtualization_role == "host" + and ansible_pkg_mgr == "yum" -- cgit