📜  make role ansible - Shell-Bash (1)

📅  最后修改于: 2023-12-03 14:44:07.798000             🧑  作者: Mango

Ansible Role: Shell-Bash

Introduction

The Shell-Bash role is an Ansible role that installs and configures the Bash shell on target systems. This role is suitable for programmers who use Bash extensively and want to have a standardized Bash environment across multiple systems.

Features
  • Installs the latest version of Bash shell
  • Configures Bash options, aliases, and environment variables
  • Allows customization of Bash settings using role variables
Role Variables

The following variables can be customized in the playbook to modify the behavior of the Shell-Bash role:

  • bash_version: Specifies the version of Bash to install (default: latest)
  • bash_options: A dictionary of Bash options to set in the .bashrc file (default: {})
  • bash_aliases: A dictionary of Bash aliases to set in the .bashrc file (default: {})
  • bash_environment: A dictionary of environment variables to set in the .bashrc file (default: {})
Usage
  1. Create an Ansible playbook and include the Shell-Bash role:
- name: Configure Bash shell
  hosts: servers
  become: true
  roles:
    - role: Shell-Bash
  1. Customize the role variables in the playbook (optional):
- name: Configure Bash shell
  hosts: servers
  become: true
  roles:
    - role: Shell-Bash
      bash_version: '5.0'
      bash_options:
        - name: 'histfilesize'
          value: '10000'
        - name: 'histappend'
          value: 'yes'
      bash_aliases:
        - name: 'ls'
          value: 'ls --color=auto'
        - name: 'll'
          value: 'ls -l'
      bash_environment:
        - name: 'PATH'
          value: '/usr/local/bin:/usr/bin:/bin'
Example

To install the latest version of Bash shell with default configurations, simply run the playbook:

ansible-playbook playbook.yml

To customize the Bash options, aliases, and environment variables, edit the playbook and modify the role variables accordingly.

License

This Ansible role is licensed under the MIT License.