From 824d3178c00694c7e907080f16d586d4c12ca413 Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Thu, 10 Oct 2019 19:45:35 +0100 Subject: [PATCH] Make playbooks compatible with FreeBSD --- roles/distro/tasks/main.yml | 1 + roles/distro/tasks/ssh.yml | 8 ++++---- roles/home/tasks/emacs.yml | 3 +++ roles/home/tasks/mate.yml | 4 +++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/roles/distro/tasks/main.yml b/roles/distro/tasks/main.yml index ad0f878..915e83f 100644 --- a/roles/distro/tasks/main.yml +++ b/roles/distro/tasks/main.yml @@ -4,4 +4,5 @@ - include: freebsd.yml when: ansible_distribution == 'FreeBSD' - include: modules.yml + when: ansible_system == 'Linux' - include: ssh.yml diff --git a/roles/distro/tasks/ssh.yml b/roles/distro/tasks/ssh.yml index 85b9093..5c0e194 100644 --- a/roles/distro/tasks/ssh.yml +++ b/roles/distro/tasks/ssh.yml @@ -8,13 +8,13 @@ register: changed_ssh_config - name: Enable SSH become: true - systemd: - name: ssh.service + service: + name: ssh enabled: yes state: started - name: Restart SSH become: true - systemd: - name: ssh.service + service: + name: ssh state: restarted when: changed_ssh_config.changed == true diff --git a/roles/home/tasks/emacs.yml b/roles/home/tasks/emacs.yml index 67b2720..5d4cfd3 100644 --- a/roles/home/tasks/emacs.yml +++ b/roles/home/tasks/emacs.yml @@ -10,12 +10,14 @@ recurse: yes depth: 3 register: emacs_service_files + when: ansible_system == 'Linux' - name: Create Emacs user service copy: src: '{{ item.path }}' dest: "{{ ansible_env.HOME }}/.config/systemd/user/emacs.service" remote_src: yes loop: '{{ emacs_service_files.files }}' + when: ansible_system == 'Linux' - name: Start Emacs user service systemd: name: emacs.service @@ -23,6 +25,7 @@ daemon_reload: yes enabled: yes state: started + when: ansible_system == 'Linux' - name: Create Emacs client launcher copy: src: "{{ ansible_env.HOME }}/.emacs.d/emacs-client.desktop" diff --git a/roles/home/tasks/mate.yml b/roles/home/tasks/mate.yml index b91aafe..12992b2 100644 --- a/roles/home/tasks/mate.yml +++ b/roles/home/tasks/mate.yml @@ -3,7 +3,9 @@ become: true copy: src: mate-acp.layout - dest: /usr/share/mate-panel/layouts/acp.layout + dest: "{{ prefix }}/share/mate-panel/layouts/acp.layout" + vars: + prefix: "{{ '/usr/local' if ansible_distribution == 'FreeBSD' else '/usr' }}" - name: Set default panel layout dconf: key: /org/mate/panel/general/default-layout