diff options
author | binary <me@rgoncalves.se> | 2021-02-27 10:30:33 +0100 |
---|---|---|
committer | binary <me@rgoncalves.se> | 2021-02-27 10:30:33 +0100 |
commit | 5acdc00aaf6c65c1353cc02a59f33e0d6ba9a281 (patch) | |
tree | 8bb7737b3efd6055dbf098105858c43c7453fbd6 | |
parent | d776d9820aeeb2fb84a4a47ce5eacf3a40823591 (diff) | |
download | infrastructure-5acdc00aaf6c65c1353cc02a59f33e0d6ba9a281.tar.gz |
Break workstation role in sub-roles
-rw-r--r-- | roles/_workstation/packages/tasks/main.yml | 49 | ||||
-rw-r--r-- | roles/_workstation/packages/vars/main.yml (renamed from roles/workstation/vars/main.yml) | 2 | ||||
-rw-r--r-- | roles/_workstation/sysconf/tasks/_archlinux.yml | 13 | ||||
-rw-r--r-- | roles/_workstation/sysconf/tasks/_openbsd.yml (renamed from roles/workstation/tasks/_openbsd.yml) | 28 | ||||
-rw-r--r-- | roles/_workstation/sysconf/tasks/main.yml (renamed from roles/workstation/tasks/main.yml) | 6 | ||||
-rw-r--r-- | roles/_workstation/sysconf/templates/etc-X11-xorg.conf.d-intel.conf (renamed from roles/workstation/templates/etc-X11-xorg.conf.d-intel.conf) | 0 | ||||
l--------- | roles/_workstation/sysconf/templates/etc-apm-hibernate (renamed from roles/workstation/templates/etc-apm-hibernate) | 0 | ||||
-rwxr-xr-x | roles/_workstation/sysconf/templates/etc-apm-suspend (renamed from roles/workstation/templates/etc-apm-suspend) | 0 | ||||
-rw-r--r-- | roles/workstation/tasks/_archlinux.yml | 49 |
9 files changed, 69 insertions, 78 deletions
diff --git a/roles/_workstation/packages/tasks/main.yml b/roles/_workstation/packages/tasks/main.yml new file mode 100644 index 0000000..798eafa --- /dev/null +++ b/roles/_workstation/packages/tasks/main.yml @@ -0,0 +1,49 @@ + +# workstation ~~ roles/_workstation/packages/tasks/main.yml +# install packages for all distributions + +--- + +- name: install packages for Archlinux + shell: | + pacman --noconfirm --needed -Sy {{ item | join(" ") }} + loop: + - "{{ pkgs_common }}" + - "{{ pkgs_archlinux }}" + no_log: true + register: out + ignore_errors: true + when: ansible_distribution == "Archlinux" + +- name: install packages for OpenBSD + shell: pkg_add -z {{ item | join(" ") }} + loop: + - "{{ pkgs_common }}" + - "{{ pkgs_openbsd }}" + no_log: true + register: out + ignore_errors: true + when: ansible_distribution == "OpenBSD" + +- name: packages installation output + debug: + msg: | + {% for item in out.results %} + - {{ item.cmd }} + {% for type in ["stdout_lines", "stderr_lines"] if item[type] %} + -- {{ type }} + {% for line in item[type] %} + --- {{ line }} + {% endfor %} + {% endfor %} + {% endfor %} + when: out is defined + +- name: show installation informations + debug: + msg: | + {% if out is defined %} + Installed all packages for system : {{ ansible_distribution }} + {% else %} + No installation methode for system : {{ ansible_distribution }}. Please patch and commit. + {% endif %} diff --git a/roles/workstation/vars/main.yml b/roles/_workstation/packages/vars/main.yml index 5a7329c..a94de67 100644 --- a/roles/workstation/vars/main.yml +++ b/roles/_workstation/packages/vars/main.yml @@ -1,5 +1,5 @@ -# roles/workstation/vars/main.yml +# roles/_workstation/packages/vars/main.yml # --- diff --git a/roles/_workstation/sysconf/tasks/_archlinux.yml b/roles/_workstation/sysconf/tasks/_archlinux.yml new file mode 100644 index 0000000..07dbe41 --- /dev/null +++ b/roles/_workstation/sysconf/tasks/_archlinux.yml @@ -0,0 +1,13 @@ + +# workstation ~~ roles/_workstation/sysconf/tasks/_archlinux.yml +# init archlinux based workstation + +--- + +- name: ensure Xorg subdirectory for configuration exists + file: + path: /etc/X11/xorg.conf.d + owner: root + mode: 0644 + state: directory + diff --git a/roles/workstation/tasks/_openbsd.yml b/roles/_workstation/sysconf/tasks/_openbsd.yml index 0811ba2..504e751 100644 --- a/roles/workstation/tasks/_openbsd.yml +++ b/roles/_workstation/sysconf/tasks/_openbsd.yml @@ -4,28 +4,6 @@ --- -- name: install packages - shell: pkg_add -z {{ item | join(" ") }} - loop: - - "{{ pkgs_common }}" - - "{{ pkgs_openbsd }}" - register: out - tags: pkgs - -- name: packages installation output - debug: - msg: | - {% for item in out.results %} - - {{ item.cmd }} - {% for type in ["stdout_lines", "stderr_lines"] if item[type] %} - -- {{ type }} - {% for line in item[type] %} - --- {{ line }} - {% endfor %} - {% endfor %} - {% endfor %} - when: out is defined - - name: ensure wsconsctl config file exists file: path: /etc/wsconsctl.conf @@ -91,9 +69,3 @@ kern.maxvnodes=262144 kern.somaxconn=2048 marker: "# process - {mark} managed by Ansible" - -- name: start and enable pcscd service - service: - name: pcscd - state: started - enabled: true diff --git a/roles/workstation/tasks/main.yml b/roles/_workstation/sysconf/tasks/main.yml index 6b8d28f..2a6f4a4 100644 --- a/roles/workstation/tasks/main.yml +++ b/roles/_workstation/sysconf/tasks/main.yml @@ -31,6 +31,12 @@ mode: 0644 create: true +- name: start and enable pcscd service + service: + name: pcscd + state: started + enabled: true + - name: check sudo binary path shell: which sudo register: sudo diff --git a/roles/workstation/templates/etc-X11-xorg.conf.d-intel.conf b/roles/_workstation/sysconf/templates/etc-X11-xorg.conf.d-intel.conf index 5d73c65..5d73c65 100644 --- a/roles/workstation/templates/etc-X11-xorg.conf.d-intel.conf +++ b/roles/_workstation/sysconf/templates/etc-X11-xorg.conf.d-intel.conf diff --git a/roles/workstation/templates/etc-apm-hibernate b/roles/_workstation/sysconf/templates/etc-apm-hibernate index a07e961..a07e961 120000 --- a/roles/workstation/templates/etc-apm-hibernate +++ b/roles/_workstation/sysconf/templates/etc-apm-hibernate diff --git a/roles/workstation/templates/etc-apm-suspend b/roles/_workstation/sysconf/templates/etc-apm-suspend index 9d36537..9d36537 100755 --- a/roles/workstation/templates/etc-apm-suspend +++ b/roles/_workstation/sysconf/templates/etc-apm-suspend diff --git a/roles/workstation/tasks/_archlinux.yml b/roles/workstation/tasks/_archlinux.yml deleted file mode 100644 index 06110df..0000000 --- a/roles/workstation/tasks/_archlinux.yml +++ /dev/null @@ -1,49 +0,0 @@ - -# workstation ~~ roles/workstation/tasks/_archlinux.yml -# init archlinux based workstation - ---- - -- name: refresh packages list - shell: pacman -Sy - tags: pkgs - -- name: install packages - shell: | - pacman --noconfirm --needed -S {{ item | join(" ") }} - loop: - - "{{ pkgs_common }}" - - "{{ pkgs_archlinux }}" - register: out - tags: pkgs - -- name: packages installation output - debug: - msg: | - {% for item in out.results %} - - {{ item.cmd }} - {% for type in ["stdout_lines", "stderr_lines"] if item[type] %} - -- {{ type }} - {% for line in item[type] %} - --- {{ line }} - {% endfor %} - {% endfor %} - {% endfor %} - when: out is defined - -- name: check doas installation - stat: path=/usr/bin/doas - register: doas - -- name: ensure Xorg subdirectory for configuration exists - file: - path: /etc/X11/xorg.conf.d - owner: root - mode: 0644 - state: directory - -- name: start and enable pcscd service - service: - name: pcscd - state: started - enabled: true |