From b077697687f316326b7b0215a09c5479f46ad4a4 Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Tue, 22 Aug 2023 21:10:54 +0200 Subject: [PATCH] Add autofs --- localhost.yml | 1 + .../autofs/files/etc/auto.master.d/bender.autofs | 1 + roles/autofs/files/etc/autofs/auto.bender | 7 +++++++ roles/autofs/tasks/configure.yml | 16 ++++++++++++++++ roles/autofs/tasks/install.yml | 8 ++++++++ roles/autofs/tasks/main.yml | 3 +++ roles/chromium/tasks/install.yml | 1 + roles/firefox/tasks/main.yml | 3 --- roles/firefox/tasks/ppa.yml | 2 ++ roles/firefox/tasks/upstream.yml | 12 ------------ 10 files changed, 39 insertions(+), 15 deletions(-) create mode 100644 roles/autofs/files/etc/auto.master.d/bender.autofs create mode 100644 roles/autofs/files/etc/autofs/auto.bender create mode 100644 roles/autofs/tasks/configure.yml create mode 100644 roles/autofs/tasks/install.yml create mode 100644 roles/autofs/tasks/main.yml delete mode 100644 roles/firefox/tasks/upstream.yml diff --git a/localhost.yml b/localhost.yml index 51408eb..6b92631 100644 --- a/localhost.yml +++ b/localhost.yml @@ -19,5 +19,6 @@ - terraform - no-snap - flutter + - autofs vars: desktop_src_dir: "{{ ansible_user_dir }}/src/desktop" \ No newline at end of file diff --git a/roles/autofs/files/etc/auto.master.d/bender.autofs b/roles/autofs/files/etc/auto.master.d/bender.autofs new file mode 100644 index 0000000..afb0170 --- /dev/null +++ b/roles/autofs/files/etc/auto.master.d/bender.autofs @@ -0,0 +1 @@ +/media/bender /etc/autofs/auto.bender --browse diff --git a/roles/autofs/files/etc/autofs/auto.bender b/roles/autofs/files/etc/autofs/auto.bender new file mode 100644 index 0000000..dc43785 --- /dev/null +++ b/roles/autofs/files/etc/autofs/auto.bender @@ -0,0 +1,7 @@ +# +3D -fstype=cifs,rw,iocharset=utf8,uid=1000,credentials=/etc/samba/credentials,vers=3.1.1 ://bender.lan/3D +Documents -fstype=cifs,rw,iocharset=utf8,uid=1000,credentials=/etc/samba/credentials,vers=3.1.1 ://bender.lan/documents +Photos -fstype=cifs,rw,iocharset=utf8,uid=1000,credentials=/etc/samba/credentials,vers=3.1.1 ://bender.lan/photos +Software -fstype=cifs,rw,iocharset=utf8,uid=1000,credentials=/etc/samba/credentials,vers=3.1.1 ://bender.lan/software + +logn bender.lan:/mnt/MAIN/logn diff --git a/roles/autofs/tasks/configure.yml b/roles/autofs/tasks/configure.yml new file mode 100644 index 0000000..70cc66f --- /dev/null +++ b/roles/autofs/tasks/configure.yml @@ -0,0 +1,16 @@ +- name: copy bender.autofs + become: yes + copy: + src: etc/auto.master.d/bender.autofs + dest: /etc/auto.master.d/bender.autofs + +- name: create autofs directory + file: + path: /etc/autofs + state: directory + +- name: copy auto.bender + become: yes + copy: + src: etc/autofs/auto.bender + dest: /etc/autofs/auto.bender diff --git a/roles/autofs/tasks/install.yml b/roles/autofs/tasks/install.yml new file mode 100644 index 0000000..7c48b9d --- /dev/null +++ b/roles/autofs/tasks/install.yml @@ -0,0 +1,8 @@ +- name: install necessary software + become: yes + apt: + update_cache: yes + pkg: + - autofs + - cifs-utils + - nfs-common \ No newline at end of file diff --git a/roles/autofs/tasks/main.yml b/roles/autofs/tasks/main.yml new file mode 100644 index 0000000..08e18e4 --- /dev/null +++ b/roles/autofs/tasks/main.yml @@ -0,0 +1,3 @@ +- import_tasks: install.yml + +- import_tasks: configure.yml \ No newline at end of file diff --git a/roles/chromium/tasks/install.yml b/roles/chromium/tasks/install.yml index 81efe5f..58c3e2a 100644 --- a/roles/chromium/tasks/install.yml +++ b/roles/chromium/tasks/install.yml @@ -13,6 +13,7 @@ name: chromium state: absent when: + - "'snapd' in ansible_facts.packages" - "'chromium-browser' in ansible_facts.packages" - ansible_facts.packages['chromium-browser'][0].version == "1:85.0.4183.83-0ubuntu2.22.04.1" diff --git a/roles/firefox/tasks/main.yml b/roles/firefox/tasks/main.yml index 9371ddd..a71b16d 100644 --- a/roles/firefox/tasks/main.yml +++ b/roles/firefox/tasks/main.yml @@ -1,7 +1,4 @@ --- -- import_tasks: upstream.yml - when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int < 22 - - import_tasks: ppa.yml when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int >= 22 diff --git a/roles/firefox/tasks/ppa.yml b/roles/firefox/tasks/ppa.yml index f578df9..16331bf 100644 --- a/roles/firefox/tasks/ppa.yml +++ b/roles/firefox/tasks/ppa.yml @@ -9,6 +9,7 @@ name: firefox state: absent when: + - "'snapd' in ansible_facts.packages" - "'firefox' in ansible_facts.packages" - ansible_facts.packages['firefox'][0].version == "1:1snap1-0ubuntu2" @@ -17,6 +18,7 @@ name: firefox state: disabled when: + - "'snapd' in ansible_facts.packages" - "'firefox' in ansible_facts.packages" - ansible_facts.packages['firefox'][0].version == "1:1snap1-0ubuntu2" diff --git a/roles/firefox/tasks/upstream.yml b/roles/firefox/tasks/upstream.yml deleted file mode 100644 index 50876f2..0000000 --- a/roles/firefox/tasks/upstream.yml +++ /dev/null @@ -1,12 +0,0 @@ -- name: remove snap - become: yes - community.general.snap: - name: firefox - state: absent - -- name: install browser - become: yes - apt: - update_cache: yes - pkg: - - firefox \ No newline at end of file