Migrate to new apps role
This commit is contained in:
@@ -6,11 +6,13 @@
|
||||
depth: 1
|
||||
excludes: ['tasks', 'templates', 'files', 'vars', 'defaults', 'meta', 'handlers']
|
||||
register: dotfiles_packages
|
||||
delegate_to: localhost
|
||||
|
||||
- name: Build complete file list
|
||||
ansible.builtin.set_fact:
|
||||
dotfiles_files: "{{ dotfiles_files | default([]) + lookup('community.general.filetree', item.path, wantlist=True) | selectattr('state', 'equalto', 'file') | list }}"
|
||||
loop: "{{ dotfiles_packages.files }}"
|
||||
delegate_to: localhost
|
||||
|
||||
- name: Ensure dotfile directories exist
|
||||
ansible.builtin.file:
|
||||
@@ -18,7 +20,6 @@
|
||||
state: directory
|
||||
mode: "0755"
|
||||
loop: "{{ dotfiles_files }}"
|
||||
when: item.path | dirname != ''
|
||||
|
||||
- name: Deploy dotfiles (local with symlinks)
|
||||
ansible.builtin.file:
|
||||
@@ -27,7 +28,7 @@
|
||||
state: link
|
||||
force: true
|
||||
loop: "{{ dotfiles_files | rejectattr('path', 'match', '.*\\.j2$') | list }}"
|
||||
when: ansible_connection in ['local', 'localhost']
|
||||
when: ansible_connection == 'local'
|
||||
|
||||
- name: Deploy dotfiles (remote with copy)
|
||||
ansible.builtin.copy:
|
||||
@@ -35,11 +36,11 @@
|
||||
dest: "{{ ansible_facts.env.HOME }}/{{ item.path }}"
|
||||
mode: preserve
|
||||
loop: "{{ dotfiles_files | rejectattr('path', 'match', '.*\\.j2$') | list }}"
|
||||
when: ansible_connection not in ['local', 'localhost']
|
||||
when: ansible_connection != 'local'
|
||||
|
||||
- name: Render dotfile templates
|
||||
ansible.builtin.template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ ansible_facts.env.HOME }}/{{ item.path | replace('.j2', '') }}"
|
||||
mode: preserve
|
||||
loop: "{{ dotfiles_files | selectattr('path', 'match', '.*\\.j2$') | list }}"
|
||||
loop: "{{ dotfiles_files | selectattr('path', 'match', '.*\\.j2$') | list }}"
|
||||
|
||||
Reference in New Issue
Block a user