From e32cf881255e828c43fb10f6b06131c997d5e946 Mon Sep 17 00:00:00 2001 From: L3D Date: Thu, 15 Nov 2018 15:12:44 +0100 Subject: [PATCH] Add rhel support --- tasks/main.yml | 18 +++++++++++++++--- tasks/setup-Debian.yml | 3 +-- tasks/setup-RedHat.yml | 6 ++++++ 3 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 tasks/setup-RedHat.yml diff --git a/tasks/main.yml b/tasks/main.yml index 699d4aa..2009131 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -2,11 +2,22 @@ # register variables - import_tasks: variables.yml -# ensure i3 packages are installed. +# ensure i3 packages are installed [Debian]. - include_tasks: setup-Debian.yml when: ansible_os_family == 'Debian' +# ensure i3 packages are installed [RHEL]. +- include_tasks: setup-RedHat.yml + when: ansible_os_family == 'Fedora' or ansible_os_family == 'RedHat' + # create i3 config file +- name: Creates directory + file: + path: '~/.config/i3' + state: directory + mode: 0750 + owner: "{{ ansible_user }}" + - name: create i3 config folder file: path: ~/.config/i3/ @@ -16,7 +27,6 @@ - name: register i3 config file action: stat path="~/.config/i3/config" register: "config_file" - - name: backup i3 config file block: @@ -26,10 +36,12 @@ dest: ~/.config/i3/config.bak remote_src: true when: config_file.stat.exists + - name: create i3 config file template: src: config.j2 - dest: ~/.config/i3/config + dest: "/home/{{ ansible_user }}/.config/i3/config" + - name: check i3 config file command: i3 -C register: check_config_response diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index 2143ebf..f25a6ce 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -1,7 +1,6 @@ --- - name: ensure i3 packages are installed. apt: - name: "{{ item }}" + name: "{{ i3_packages }}" state: "present" - with_items: "{{ i3_packages }}" become: true diff --git a/tasks/setup-RedHat.yml b/tasks/setup-RedHat.yml new file mode 100644 index 0000000..eec8226 --- /dev/null +++ b/tasks/setup-RedHat.yml @@ -0,0 +1,6 @@ +--- +- name: ensure i3 packages are installed. + dnf: + name: "{{ i3_packages }}" + state: "latest" + become: true