From 140381b5a6b997e9e302f57b91ca433fc9efa83b Mon Sep 17 00:00:00 2001 From: L3D Date: Sun, 19 Sep 2021 03:26:26 +0200 Subject: [PATCH] split config to more subtasks --- tasks/main.yml | 55 ++++-------------------------------------------- tasks/ranger.yml | 30 ++++++++++++++++++++++++++ tasks/vimrc.yml | 23 ++++++++++++++++++++ vars/main.yml | 2 +- 4 files changed, 58 insertions(+), 52 deletions(-) create mode 100644 tasks/ranger.yml create mode 100644 tasks/vimrc.yml diff --git a/tasks/main.yml b/tasks/main.yml index d84c45b..68af83e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -13,55 +13,8 @@ ansible.builtin.include_tasks: bashrc.yml when: dotfiles__modify_bashrc | bool -- name: Copy vimrc configuration to root - become: true - ansible.builtin.copy: - src: 'templates/vimrc' - dest: '/root/.vimrc' - owner: root - group: root - mode: 'u=rw,g=r,o=' +- name: deploy vimrc + ansible.builtin.include_tasks: vimrc.yml -- name: Copy vimrc configuration to non admin users - become: true - ansible.builtin.copy: - src: 'templates/vimrc' - dest: '/home/{{ item }}/.vimrc' - owner: '{{ item }}' - group: '{{ item }}' - mode: 'u=rw,g=r,o=' - with_items: "{{ accounts }}" - when: - - accounts is defined - - accounts != ['root'] - - accounts != 'root' - -- name: create .config/ranger/ directory - become: true - ansible.builtin.file: - path: "/home/{{ item }}/.config/ranger" - state: directory - owner: "{{ item }}" - group: "{{ item }}" - recurse: true - with_items: "{{ accounts }}" - when: - - dotfiles__ranger_hidden_files | bool - - accounts is defined - - accounts != ['root'] - - accounts != 'root' - -- name: create .config/ranger/rc.conf file - become: true - ansible.builtin.template: - src: templates/ranger_rc.conf.j2 - dest: "/home/{{ item }}/.config/ranger/rc.conf" - owner: "{{ item }}" - group: "{{ item }}" - mode: '0644' - with_items: "{{ accounts }}" - when: - - dotfiles__ranger_hidden_files | bool - - accounts is defined - - accounts != ['root'] - - accounts != 'root' +- name: deploy ranger config + ansible.builtin.include_tasks: ranger.yml diff --git a/tasks/ranger.yml b/tasks/ranger.yml new file mode 100644 index 0000000..4316c2f --- /dev/null +++ b/tasks/ranger.yml @@ -0,0 +1,30 @@ +--- +- name: create .config/ranger/ directory + become: true + ansible.builtin.file: + path: "/home/{{ item }}/.config/ranger" + state: directory + owner: "{{ item }}" + group: "{{ item }}" + recurse: true + with_items: "{{ accounts }}" + when: + - dotfiles__ranger_hidden_files | bool + - accounts is defined + - accounts != ['root'] + - accounts != 'root' + +- name: create .config/ranger/rc.conf file + become: true + ansible.builtin.template: + src: templates/ranger_rc.conf.j2 + dest: "/home/{{ item }}/.config/ranger/rc.conf" + owner: "{{ item }}" + group: "{{ item }}" + mode: '0644' + with_items: "{{ accounts }}" + when: + - dotfiles__ranger_hidden_files | bool + - accounts is defined + - accounts != ['root'] + - accounts != 'root' diff --git a/tasks/vimrc.yml b/tasks/vimrc.yml new file mode 100644 index 0000000..0aac5da --- /dev/null +++ b/tasks/vimrc.yml @@ -0,0 +1,23 @@ +--- +- name: Copy vimrc configuration to root + become: true + ansible.builtin.copy: + src: 'templates/vimrc' + dest: '/root/.vimrc' + owner: root + group: root + mode: 'u=rw,g=r,o=' + +- name: Copy vimrc configuration to non admin users + become: true + ansible.builtin.copy: + src: 'templates/vimrc' + dest: '/home/{{ item }}/.vimrc' + owner: '{{ item }}' + group: '{{ item }}' + mode: 'u=rw,g=r,o=' + with_items: "{{ accounts }}" + when: + - accounts is defined + - accounts != ['root'] + - accounts != 'root' diff --git a/vars/main.yml b/vars/main.yml index a792371..f1627f5 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,3 +1,3 @@ --- -playbook_version_number: 2072 # should be increased integer +playbook_version_number: 2073 # should be increased integer playbook_version_path: 'role_dotfiles_chaos-bodensee_github.version'