From e6a47118f03fc7cd3dee0d4c45875ac5c88e600a Mon Sep 17 00:00:00 2001 From: L3D Date: Fri, 13 Nov 2020 14:28:57 +0100 Subject: [PATCH] BREAKING: change variable names to dotfiles__ --- .github/galaxy.svg | 359 ++++++++++++++++++++++++++++++++++++ README.md | 63 +++++-- defaults/main.yml | 26 +-- tasks/bashrc.yml | 2 +- tasks/main.yml | 6 +- templates/bash.bashrc | 18 +- templates/bashrc | 14 +- templates/ranger_rc.conf.j2 | 2 +- 8 files changed, 441 insertions(+), 49 deletions(-) create mode 100644 .github/galaxy.svg diff --git a/.github/galaxy.svg b/.github/galaxy.svg new file mode 100644 index 0000000..8295d09 --- /dev/null +++ b/.github/galaxy.svg @@ -0,0 +1,359 @@ + + + + + + image/svg+xml + + + + + + 3D <l3d@c3woc.de> + + + + + MIT License + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + do1jlr.dotfiles + do1jlr.dotfiles + + + diff --git a/README.md b/README.md index 1ad6a93..c7fc306 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ dotfiles ========== -[![Build Status](https://travis-ci.org/chaos-bodensee/role_dotfiles.svg?branch=master)](https://travis-ci.org/chaos-bodensee/role_dotfiles) - - +[![Build Status](https://travis-ci.org/roles-ansible/ansible_role_dotfiles.svg?branch=master)](https://travis-ci.org/roles-ansible/role_dotfiles) +[![Galaxy](https://raw.githubusercontent.com/roles-ansible/ansible_role_dotfiles/master/.github/license.svg?sanitize=true)](https://galaxy.ansible.com/do1jlr/dotfiles) ### Get it directly from Ansible Galaxy ```bash @@ -31,10 +30,10 @@ submodules_versioncheck: false dotfiles__install_python_selinux: true # modify bashrc -base__modify_bashrc: true +dotfiles__modify_bashrc: true # list of aliases used in bashrc -base__aliases: +dotfiles__aliases: - { alias: "ls", command: "ls ", color: True } - { alias: "grep", command: "grep", color: True } - { alias: "ll", command: "ls -alF", color: False } @@ -48,14 +47,14 @@ base__aliases: # enable bash completion -base__bash_completion_enabled: true +dotfiles__bash_completion_enabled: true # fancy promt -base__user_promt: '\[\033[01;33m\] $(printf "\xE2\x9D\xA4") \[\033[01;32m\]\u\[\033[01;36m\]@\[\033[01;32m\]\H\[\033[01;34m\] <\A> \[\033[01;35m\] \j \[\033[01;36m\] \w \[\033[01;33m\]\n\[\033[01;33m\] $(git branch 2>/dev/null | sed -n "s/* \(.*\)/\1 /p")$\[\033[01;00m\] ' -base__root_prompt: '\[\033[01;31m\] $(printf "\xE2\x9D\xA4") \[\033[01;32m\]\u\[\033[01;36m\]@\[\033[01;32m\]\H\[\033[01;34m\] <\A> \[\033[01;35m\] \j \[\033[01;36m\] \w \[\033[01;33m\]\n\[\033[01;33m\] $(git branch 2>/dev/null | sed -n "s/* \(.*\)/\1 /p")$\[\033[01;00m\] ' +dotfiles__user_promt: '\[\033[01;33m\] $(printf "\xE2\x9D\xA4") \[\033[01;32m\]\u\[\033[01;36m\]@\[\033[01;32m\]\H\[\033[01;34m\] <\A> \[\033[01;35m\] \j \[\033[01;36m\] \w \[\033[01;33m\]\n\[\033[01;33m\] $(git branch 2>/dev/null | sed -n "s/* \(.*\)/\1 /p")$\[\033[01;00m\] ' +dotfiles__root_prompt: '\[\033[01;31m\] $(printf "\xE2\x9D\xA4") \[\033[01;32m\]\u\[\033[01;36m\]@\[\033[01;32m\]\H\[\033[01;34m\] <\A> \[\033[01;35m\] \j \[\033[01;36m\] \w \[\033[01;33m\]\n\[\033[01;33m\] $(git branch 2>/dev/null | sed -n "s/* \(.*\)/\1 /p")$\[\033[01;00m\] ' # log terminal to syslog -base__log_to_syslog: true +dotfiles__log_to_syslog: true # modify bash history history_control: 'ignoreboth' @@ -63,30 +62,64 @@ history_size: '-1' history_file_size: '-1' # optional additional entries to bashrc -base__additional_bashrc_lines: [] +dotfiles__additional_bashrc_lines: [] # - eval `foo` # - tmux new-session # optionally allow custom bashrc for root -base__allow_own_root_bashrc: false +dotfiles__allow_own_root_bashrc: false # otional custom commands -base__additional_bashrc_lines: [] +dotfiles__additional_bashrc_lines: [] # - eval `foo` # - tmux new-session # optionally allow custom bashrc for root -base__allow_own_root_bashrc: false +dotfiles__allow_own_root_bashrc: false # otional custom commands -base__custom_config: [] +dotfiles__custom_config: [] # - { user: "l3d", cmd: "eval $(keychain --eval --quiet id_ed25519)" # show hidden files in ranger -base__ranger_hidden_files: true +dotfiles__ranger_hidden_files: true accounts: - "{{ ansible_user_id }}" ``` Please have a look into ``defaults/main.yml`` for more configuration options! + + +### testing +This role is tested with [these github-action](https://github.com/search?q=topic%3Acheck-ansible+topic%3Agithub-actions+org%3Aroles-ansible&type=Repositories) tests for different versions of differen linux systems. Linting is tested via travis-ci and the [ansible-lint action](https://github.com/marketplace/actions/ansible-lint). +If you want to find out more about our tests, please have a look at the github marketplace. + +| test status | Github Marketplace | +| :--------- | :---------------- | +| [![Travis Build Status](https://travis-ci.com/roles-ansible/ansible_role_dotfiles.svg?branch=master)](https://travis-ci.com/roles-ansible/ansible_role_dotfiles) | [.travis.yml](https://github.com/roles-ansible/ansible_role_dotfiles/blob/master/.travis.yml) | +||| +| [![Ansible Lint check](https://github.com/roles-ansible/ansible_role_dotfiles/workflows/Ansible%20Lint%20check/badge.svg)](https://github.com/roles-ansible/ansible_role_dotfiles/actions?query=workflow%3A%22Ansible+Lint+check%22) | [ansible-lint action](https://github.com/marketplace/actions/ansible-lint) +| [![Ansible check debian:stable](https://github.com/roles-ansible/ansible_role_dotfiles/workflows/Ansible%20check%20debian:stable/badge.svg)](https://github.com/roles-ansible/ansible_role_dotfiles/actions?query=workflow%3A%22Ansible+check+debian%3Astable%22) | [ansible test with debian stable](https://github.com/marketplace/actions/check-ansible-debian-stable) | +| [![Ansible check debian:latest](https://github.com/roles-ansible/ansible_role_dotfiles/workflows/Ansible%20check%20debian:latest/badge.svg)](https://github.com/roles-ansible/ansible_role_dotfiles/actions?query=workflow%3A%22Ansible+check+debian%3Alatest%22) | [ansible test with debian latest](https://github.com/marketplace/actions/check-ansible-debian-latest) | +| [![Ansible check debian:sid](https://github.com/roles-ansible/ansible_role_dotfiles/workflows/Ansible%20check%20debian:sid/badge.svg)](https://github.com/roles-ansible/ansible_role_dotfiles/actions?query=workflow%3A%22Ansible+check+debian%3Asid%22) | [ansible test with debian sid](https://github.com/marketplace/actions/check-ansible-debian-sid) | +| [![Ansible check debian:buster](https://github.com/roles-ansible/ansible_role_dotfiles/workflows/Ansible%20check%20debian:buster/badge.svg)](https://github.com/roles-ansible/ansible_role_dotfiles/actions?query=workflow%3A%22Ansible+check+debian%3Abuster%22) | [ansible test with debian buster](https://github.com/marketplace/actions/check-ansible-debian-buster) | +| [![Ansible check debian:stretch](https://github.com/roles-ansible/ansible_role_dotfiles/workflows/Ansible%20check%20debian:stretch/badge.svg)](https://github.com/roles-ansible/ansible_role_dotfiles/actions?query=workflow%3A%22Ansible+check+debian%3Astretch%22) | [ansible test with debian stretch](https://github.com/marketplace/actions/check-ansible-debian-stretch) | +| | | +| [![Ansible check archlinux:latest](https://github.com/roles-ansible/ansible_role_dotfiles/workflows/Ansible%20check%20archlinux:latest/badge.svg)](https://github.com/roles-ansible/ansible_role_dotfiles/actions?query=workflow%3A%22Ansible+check+archlinux%3Alatest%22) | [ansible test with archlinux latest](https://github.com/marketplace/actions/check-ansible-archlinux-latest) | +| | | +| [![Ansible check ubuntu:latest](https://github.com/roles-ansible/ansible_role_dotfiles/workflows/Ansible%20check%20ubuntu:latest/badge.svg)](https://github.com/roles-ansible/ansible_role_dotfiles/actions?query=workflow%3A%22Ansible+check+ubuntu%3Alatest%22) | [ansible test with ubuntu latest](https://github.com/marketplace/actions/check-ansible-ubuntu-latest) | +| [![Ansible check ubuntu:bionic](https://github.com/roles-ansible/ansible_role_dotfiles/workflows/Ansible%20check%20ubuntu:bionic/badge.svg)](https://github.com/roles-ansible/ansible_role_dotfiles/actions?query=workflow%3A%22Ansible+check+ubuntu%3Abionic%22) | [ansible test with ubuntu bionic](https://github.com/marketplace/actions/check-ansible-ubuntu-bionic) | +| [![Ansible check ubuntu:eoan](https://github.com/roles-ansible/ansible_role_dotfiles/workflows/Ansible%20check%20ubuntu:eoan/badge.svg)](https://github.com/roles-ansible/ansible_role_dotfiles/actions?query=workflow%3A%22Ansible+check+ubuntu%3Aeoan%22) | [ansible test with ubuntu eoan](https://github.com/marketplace/actions/check-ansible-ubuntu-eoan) | +| [![Ansible check ubuntu:trusty](https://github.com/roles-ansible/ansible_role_dotfiles/workflows/Ansible%20check%20ubuntu:trusty/badge.svg)](https://github.com/roles-ansible/ansible_role_dotfiles/actions?query=workflow%3A%22Ansible+check+ubuntu%3Atrusty%22) | [ansible test with ubuntu trusty](https://github.com/marketplace/actions/check-ansible-ubuntu-trusty) | +| [![Ansible check ubuntu:xenial](https://github.com/roles-ansible/ansible_role_dotfiles/workflows/Ansible%20check%20ubuntu:xenial/badge.svg)](https://github.com/roles-ansible/ansible_role_dotfiles/actions?query=workflow%3A%22Ansible+check+ubuntu%3Axenial%22) | [ansible test with ubuntu xenial](https://github.com/marketplace/actions/check-ansible-ubuntu-xenial) | +| | | +| [![Ansible check fedora:latest](https://github.com/roles-ansible/ansible_role_dotfiles/workflows/Ansible%20check%20fedora:latest/badge.svg)](https://github.com/roles-ansible/ansible_role_dotfiles/actions?query=workflow%3A%22Ansible+check+fedora%3Alatest%22) | [ansible test with fedora latest](https://github.com/marketplace/actions/check-ansible-fedora-latest) | +| [![Ansible check fedora:33](https://github.com/roles-ansible/ansible_role_dotfiles/workflows/Ansible%20check%20fedora:33/badge.svg)](https://github.com/roles-ansible/ansible_role_dotfiles/actions?query=workflow%3A%22Ansible+check+fedora%3A33%22) | [ansible test with fedora 33](https://github.com/marketplace/actions/check-ansible-fedora-33) | +| [![Ansible check fedora:32](https://github.com/roles-ansible/ansible_role_dotfiles/workflows/Ansible%20check%20fedora:32/badge.svg)](https://github.com/roles-ansible/ansible_role_dotfiles/actions?query=workflow%3A%22Ansible+check+fedora%3A32%22) | [ansible test with fedora 32](https://github.com/marketplace/actions/check-ansible-fedora-32) | +| [![Ansible check fedora:31](https://github.com/roles-ansible/ansible_role_dotfiles/workflows/Ansible%20check%20fedora:31/badge.svg)](https://github.com/roles-ansible/ansible_role_dotfiles/actions?query=workflow%3A%22Ansible+check+fedora%3A31%22) | [ansible test with fedora 31](https://github.com/marketplace/actions/check-ansible-fedora-31) | +| | | +| [![Ansible check centos:latest](https://github.com/roles-ansible/ansible_role_dotfiles/workflows/Ansible%20check%20centos:latest/badge.svg)](https://github.com/roles-ansible/ansible_role_dotfiles/actions?query=workflow%3A%22Ansible+check+centos%3Alatest%22) | [ansible test with centos latest](https://github.com/marketplace/actions/check-ansible-centos-latest) | +| [![Ansible check centos:centos8](https://github.com/roles-ansible/ansible_role_dotfiles/workflows/Ansible%20check%20centos:centos8/badge.svg)](https://github.com/roles-ansible/ansible_role_dotfiles/actions?query=workflow%3A%22Ansible+check+centos%3Acentos8%22) | [ansible test with centos centos8](https://github.com/marketplace/actions/check-ansible-centos-centos8) | +| [![Ansible check centos:centos7](https://github.com/roles-ansible/ansible_role_dotfiles/workflows/Ansible%20check%20centos:centos7/badge.svg)](https://github.com/roles-ansible/ansible_role_dotfiles/actions?query=workflow%3A%22Ansible+check+centos%3Acentos7%22) | [ansible test with centos centos7](https://github.com/marketplace/actions/check-ansible-centos-centos7) | + diff --git a/defaults/main.yml b/defaults/main.yml index 1ba69a6..58cce2f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -8,10 +8,10 @@ submodules_versioncheck: false dotfiles__install_python_selinux: true # modify bashrc -base__modify_bashrc: true +dotfiles__modify_bashrc: true # list of aliases used in bashrc -base__aliases: +dotfiles__aliases: - { alias: "ls", command: "ls ", color: True } - { alias: "grep", command: "grep", color: True } - { alias: "ll", command: "ls -alF", color: False } @@ -25,35 +25,35 @@ base__aliases: # enable bash completion -base__bash_completion_enabled: true +dotfiles__bash_completion_enabled: true # fancy promt -base__user_prompt: '\[\033[01;33m\] $(printf "\xE2\x9D\xA4") \[\033[01;32m\]\u\[\033[01;36m\]@\[\033[01;32m\]\H\[\033[01;34m\] <\A> \[\033[01;35m\] \j \[\033[01;36m\] \w \[\033[01;33m\]\n\[\033[01;33m\] $(git branch 2>/dev/null | sed -n "s/* \(.*\)/\1 /p")$\[\033[01;00m\] ' -base__root_prompt: '\[\033[01;31m\] $(printf "\xE2\x9D\xA4") \[\033[01;32m\]\u\[\033[01;36m\]@\[\033[01;32m\]\H\[\033[01;34m\] <\A> \[\033[01;35m\] \j \[\033[01;36m\] \w \[\033[01;33m\]\n\[\033[01;33m\] $(git branch 2>/dev/null | sed -n "s/* \(.*\)/\1 /p")$\[\033[01;00m\] ' +dotfiles__user_prompt: '\[\033[01;33m\] $(printf "\xE2\x9D\xA4") \[\033[01;32m\]\u\[\033[01;36m\]@\[\033[01;32m\]\H\[\033[01;34m\] <\A> \[\033[01;35m\] \j \[\033[01;36m\] \w \[\033[01;33m\]\n\[\033[01;33m\] $(git branch 2>/dev/null | sed -n "s/* \(.*\)/\1 /p")$\[\033[01;00m\] ' +dotfiles__root_prompt: '\[\033[01;31m\] $(printf "\xE2\x9D\xA4") \[\033[01;32m\]\u\[\033[01;36m\]@\[\033[01;32m\]\H\[\033[01;34m\] <\A> \[\033[01;35m\] \j \[\033[01;36m\] \w \[\033[01;33m\]\n\[\033[01;33m\] $(git branch 2>/dev/null | sed -n "s/* \(.*\)/\1 /p")$\[\033[01;00m\] ' # modify bash history -base__history_control: 'ignoreboth' -base__history_size: '-1' -base__history_file_size: '-1' +dotfiles__history_control: 'ignoreboth' +dotfiles__history_size: '-1' +dotfiles__history_file_size: '-1' # optional additional entries to /etc/bash.bashrc -base__additional_bashrc_lines: [] +dotfiles__additional_bashrc_lines: [] # - eval `foo` # - tmux new-session # optional additional entries to ~/.bashrc -base__additional_user_bashrc_lines: [] +dotfiles__additional_user_bashrc_lines: [] # - eval $(keychain --eval --quiet id_ed25519) # optionally allow custom bashrc for root -base__allow_own_root_bashrc: false +dotfiles__allow_own_root_bashrc: false # otional custom commands -base__custom_config: [] +dotfiles__custom_config: [] # - { user: "l3d", cmd: "eval $(keychain --eval --quiet id_ed25519)" # show hidden files in ranger -base__ranger_hidden_files: true +dotfiles__ranger_hidden_files: true accounts: - "{{ ansible_user_id }}" diff --git a/tasks/bashrc.yml b/tasks/bashrc.yml index 42d3e8b..0fe622f 100644 --- a/tasks/bashrc.yml +++ b/tasks/bashrc.yml @@ -16,7 +16,7 @@ owner: 'root' group: 'root' mode: 'u=rw,g=r,o=' - when: not base__allow_own_root_bashrc | bool + when: not dotfiles__allow_own_root_bashrc | bool - name: Copy bashrc configuration to non admin users become: yes diff --git a/tasks/main.yml b/tasks/main.yml index bb697bc..3c5e59c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -6,7 +6,7 @@ when: dotfiles__install_python_selinux | bool - include_tasks: bashrc.yml - when: base__modify_bashrc | bool + when: dotfiles__modify_bashrc | bool - name: Copy vimrc configuration to root become: yes @@ -42,7 +42,7 @@ mode: '0644' with_items: "{{ accounts }}" when: - - base__ranger_hidden_files | bool + - dotfiles__ranger_hidden_files | bool - accounts is defined - accounts != ['root'] - accounts != 'root' @@ -57,7 +57,7 @@ mode: '0644' with_items: "{{ accounts }}" when: - - base__ranger_hidden_files | bool + - dotfiles__ranger_hidden_files | bool - accounts is defined - accounts != ['root'] - accounts != 'root' diff --git a/templates/bash.bashrc b/templates/bash.bashrc index d59199a..3c6497b 100644 --- a/templates/bash.bashrc +++ b/templates/bash.bashrc @@ -9,20 +9,20 @@ # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" -{% for alias in base__aliases %} +{% for alias in dotfiles__aliases %} {% if alias.color %} alias {{ alias.alias }}="{{ alias.command }} --color=auto" {% endif%} {% endfor %} fi -{% for alias in base__aliases %} +{% for alias in dotfiles__aliases %} {% if not alias.color %} alias {{ alias.alias }}="{{ alias.command }}" {% endif%} {% endfor %} -{%if base__bash_completion_enabled %} +{%if dotfiles__bash_completion_enabled %} if ! shopt -oq posix; then if [ -f /usr/share/bash-completion/bash_completion ]; then . /usr/share/bash-completion/bash_completion @@ -35,18 +35,18 @@ fi # fancy Prompt if [ $(id -u) -eq 0 ]; then - export PS1='{{ base__root_prompt }} ' + export PS1='{{ dotfiles__root_prompt }} ' else - export PS1='{{ base__user_prompt }} ' + export PS1='{{ dotfiles__user_prompt }} ' fi -HISTCONTROL={{ base__history_control }} +HISTCONTROL={{ dotfiles__history_control }} shopt -s histappend -HISTSIZE={{ base__history_size }} -HISTFILESIZE={{ base__history_file_size }} +HISTSIZE={{ dotfiles__history_size }} +HISTFILESIZE={{ dotfiles__history_file_size }} -{% for _row in base__additional_bashrc_lines | default() %} +{% for _row in dotfiles__additional_bashrc_lines | default() %} {{ _row }} {% endfor %} # vim:ts=4:sw=4 diff --git a/templates/bashrc b/templates/bashrc index 1368fe6..da52476 100644 --- a/templates/bashrc +++ b/templates/bashrc @@ -12,30 +12,30 @@ export PATH # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" -{% for alias in base__aliases %} +{% for alias in dotfiles__aliases %} {% if alias.color %} alias {{ alias.alias }}="{{ alias.command }} --color=auto" {% endif%} {% endfor %} fi -{% for alias in base__aliases %} +{% for alias in dotfiles__aliases %} {% if not alias.color %} alias {{ alias.alias }}="{{ alias.command }}" {% endif%} {% endfor %} # hostory controll -HISTCONTROL={{ base__history_control }} +HISTCONTROL={{ dotfiles__history_control }} shopt -s histappend -HISTSIZE={{ base__history_size }} -HISTFILESIZE={{ base__history_file_size }} +HISTSIZE={{ dotfiles__history_size }} +HISTFILESIZE={{ dotfiles__history_file_size }} -{% for _row in base__additional_user_bashrc_lines | default() %} +{% for _row in dotfiles__additional_user_bashrc_lines | default() %} {{ _row }} {% endfor %} -{% for custom in base__custom_config %} +{% for custom in dotfiles__custom_config %} {% if custom.user == item %} {{ custom.cmd }} {% endif %} diff --git a/templates/ranger_rc.conf.j2 b/templates/ranger_rc.conf.j2 index 2349d37..31a4712 100644 --- a/templates/ranger_rc.conf.j2 +++ b/templates/ranger_rc.conf.j2 @@ -1,3 +1,3 @@ # {{ ansible_managed }} # -{% if base__ranger_hidden_files | bool %}set show_hidden true{% endif %} +{% if dotfiles__ranger_hidden_files | bool %}set show_hidden true{% endif %}