Changeset - 95993c623d68
[Not reviewed]
0 1 0
x - 20 months ago 2023-08-29 18:44:35
xbr@c3l.lu
feat: initial_server, replace colorful PS1 w/ color+feat for root bashrc
1 file changed with 5 insertions and 15 deletions:
0 comments (0 inline, 0 general)
initial_server_setup/initial_setup.yml
Show inline comments
 
@@ -120,42 +120,32 @@
 
        groups:
 
          - sudo
 
        append: true
 
        shell: /bin/bash
 
        state: present
 
      loop: "{{ users_system }}"
 
      tags: users
 
    - name: Change shell for root to bash
 
      ansible.builtin.user:
 
        name: "root"
 
        shell: /bin/bash
 
      tags: users
 
    - name: Add colorful PS1 in default bashrc
 
    - name: Add color etc. into root bashrc
 
      ansible.builtin.blockinfile:
 
        path: /etc/bash.bashrc
 
        state: absent
 
        marker: "# {mark} ANSIBLE MANAGED BLOCK / Colorful PS1"
 
        block: |
 
          case "$TERM" in
 
              xterm-color|*-256color) color_prompt=yes;;
 
          esac
 

	
 
          if [ "$color_prompt" = yes ]; then
 
              PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
 
          else
 
              PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
 
          fi
 
          unset color_prompt force_color_prompt
 
        marker: "# {mark} ANSIBLE MANAGED BLOCK / Enhanced root bashrc"
 
        block: "{{ lookup('ansible.builtin.file', '{{ server_config_dir }}/bashrc_root_config') }}"
 
        path: /root/.bashrc
 
      tags: users
 

	
 

	
 
    - name: Add SSH key for users from vars
 
      ansible.posix.authorized_key:
 
        user: "{{ item.username }}"
 
        state: present
 
        key: "{{ lookup('file', item.key_path) }}"
 
      tags: users
 
      loop: "{{ users_member | union(users_system) }}"
 

	
 
    - name: Allow for password-less sudo
 
      community.general.sudoers:
 
        name: passwordless-sudo
 
        group: sudo
0 comments (0 inline, 0 general)