From b941dd9f330b8b49d30d47a3c4a787a39ffa3345 Mon Sep 17 00:00:00 2001 From: dbrw Date: Mon, 11 Jul 2022 16:34:50 +0700 Subject: [PATCH] add docker task --- roles/common/files/user_home/.xinitrc | 3 +++ roles/common/files/user_home/.zlogin | 6 ++++++ roles/common/tasks/docker.yml | 18 ++++++++++++++++++ roles/common/tasks/dwm.yml | 6 ++---- roles/common/tasks/main.yml | 3 +++ roles/common/tasks/virtualization.yml | 1 - roles/common/vars/main.yml | 3 +++ 7 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 roles/common/files/user_home/.zlogin create mode 100644 roles/common/tasks/docker.yml diff --git a/roles/common/files/user_home/.xinitrc b/roles/common/files/user_home/.xinitrc index 274b2e2..628db27 100644 --- a/roles/common/files/user_home/.xinitrc +++ b/roles/common/files/user_home/.xinitrc @@ -3,5 +3,8 @@ # Import environemnt to systemd user session systemctl --user import-environment DISPLAY XAUTHORITY PATH XDG_SESSION_ID +autorandr -c & +xss-lock -- /usr/local/bin/slock -m 'mantull!!' & + # Run graphical-session.target systemctl --user start --wait xorg.target diff --git a/roles/common/files/user_home/.zlogin b/roles/common/files/user_home/.zlogin new file mode 100644 index 0000000..f4514f0 --- /dev/null +++ b/roles/common/files/user_home/.zlogin @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Run X on stratup only on /dev/tty1 +if [[ "$(tty)" == "/dev/tty1" && ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then + exec startx +fi diff --git a/roles/common/tasks/docker.yml b/roles/common/tasks/docker.yml new file mode 100644 index 0000000..1c6141a --- /dev/null +++ b/roles/common/tasks/docker.yml @@ -0,0 +1,18 @@ +- name: Install docker from repo + community.general.pacman: + name: + - docker + - docker-compose + +- name: Add user {{ username }} to docker group + ansible.builtin.user: + groups: docker + append: True + user: "{{ username }}" + + +- name: Enable docker service + ansible.builtin.systemd: + name: docker + state: started + enabled: yes diff --git a/roles/common/tasks/dwm.yml b/roles/common/tasks/dwm.yml index 6592598..e166bd5 100644 --- a/roles/common/tasks/dwm.yml +++ b/roles/common/tasks/dwm.yml @@ -125,12 +125,12 @@ with_items: - .config - .local - - .ssh - .xinitrc - .gtkrc-2.0 - .Xresources - .Xresources.d - .tmux.conf + - .zlogin - name: Install TPM become_user: "{{ username }}" @@ -146,7 +146,7 @@ ansible.builtin.copy: src: user_home/.ssh dest: /home/{{ username }} - force: False + force: no mode: 'preserve' group: '{{ username }}' owner: '{{ username }}' @@ -222,5 +222,3 @@ name: xrdb enabled: true -- name: Install xlogin-git - aur: name=xlogin-git user={{ username }} dir={{ aur.dir }} diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index e02b6e2..91411a5 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -61,6 +61,9 @@ - include_tasks: virtualization.yml when: install_virtualization == True +- include_tasks: docker.yml + when: install_docker == True + # Dotfiles - include_tasks: dotfiles.yml when: pull_dotfiles == True diff --git a/roles/common/tasks/virtualization.yml b/roles/common/tasks/virtualization.yml index acc9beb..5233781 100644 --- a/roles/common/tasks/virtualization.yml +++ b/roles/common/tasks/virtualization.yml @@ -39,5 +39,4 @@ - name: Ensure virtualization network active community.libvirt.virt_net: autostart: yes - state: active name: jungle diff --git a/roles/common/vars/main.yml b/roles/common/vars/main.yml index 9053a5a..fb22bc4 100644 --- a/roles/common/vars/main.yml +++ b/roles/common/vars/main.yml @@ -58,6 +58,9 @@ install_aerc: True ## Do we want to install virt-manager and qemu kvm? install_virtualization: True +## Do we want to install docker? +install_docker: True + ## AUR vars ## =========================== use_aur: True