Skip to content
Snippets Groups Projects
fejao's avatar
fejao authored
a0281cc0
History

oh_my_bash role

This ansible-role for installing oh-my-bash at the c3infodesk systems.

Requirements

  • To have ansible installed at your system.

Configuration

You need to set some configuration for this to work

  • ansible.cfg

    You have to edit the ansible.cfg file to your needs for accessing your target.

    • remote_user

      You need to set the remote_user configuration for accessing the target host.

      Example: remote_user

  • HOST_VARS

    In order to access your target host, you need to create/edit your inventories/host_vars/<YOUR_HOST_NAME>.yml

    • ansible_become_pass

      You need to set the sudo password from the user setted on remote_user for installing packages and etc. at the target.

      Example: ansible_become_pass

  • HOSTS

    You need to provide a group in which your target belongs to with the same name setted for inventories/host_vars/<YOUR_HOST_NAME>.yml.

    There you can add/edit the target address/IP.

    Example: hosts

Role Variables

Here are the variables setted:

  • From: inventories/host_vars/<TARGET_NAME>

    No variable setted at this file

  • From: inventories/group_vars/<TARGET_GROUP>

    No variable setted at this file

  • From: roles/clone-repositories/defaults/main.yml

    Don't change the values at this file, if you need to change them, change it at the inventories/host_vars/<TARGET_NAME> file

    • oh_my_bash_dependencies_list: DEFAULT=["bash-completion","curl","git","vim"]
    • oh_my_bash_dependencies_state: DEFAULT=present
    • oh_my_bash_debug: DEAFULT=false
    • oh_my_bash_download_url: DEFAULT="https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh"
    • oh_my_bash_download_dest: DEAFULT="/tmp/install_ohmybash.sh"
    • oh_my_bash_installed_path: DEAFULT="~/.oh-my-bash"
    • oh_my_bash_change_theme: DEAFULT=true
    • oh_my_bash_theme_name: DEAFULT="pzq"

Dependencies

This role have no dependency from any another role.

Example Playbook

  • Using the provided example

    For using the example playbook playbooks/examples/example_06_oh_my_bash.yml file you only need to:

    And run the command:

    ansible-playbook -i inventories/hosts playbooks/examples/example_06_oh_my_bash.yml
  • Setting your own example

    After setting your variables at inventories/host_vars/<HOST_NAME>, you can add this role to your playbook as a regular role.

    Here is an example using the <HOST_NAME> as test_servers

    - hosts:
        - test_servers
      roles:
        - roles/c3infodesk-deployment-role-oh-my-bash

    And call the playbook as:

    ansible-playbook -i <INVENTORY> <PLAYBOOK_NAME>.yml

Testing

You can test this locally using DIND (docker in docker) at your own computer using ansible molecule

  • Testing requirements

    You need docker installed at your system and the ansible molecule.

    You might have to set DIND at your system, for linux, you can create the file /etc/docker/daemon.json

    And add the content and restart docker.

    {
      "exec-opts": ["native.cgroupdriver=systemd"],
      "features": {
        "buildkit": true
      },
      "experimental": true,
      "cgroup-parent": "docker.slice"
    }
  • Using molecule

    Just go to the root of the role roles/dependencies and run the command:

    molecule test

License

MIT / BSD

Author Information

https://chaos.social/@fejao