Skip to content
Snippets Groups Projects

clone-repositories

This ansible-role for dealing with cloning the repositories necessary for deploying the system used from c3infodesk.

Requirements

  • To have ansible installed at your system.
  • Set your remote_user configuration at the ansible.cfg file.
  • Set your inventories/host_vars/<TARGET_NAME> file.

Role Variables

Here are the variables setted:

  • From: inventories/host_vars/<TARGET_NAME>

    Here are the variables that you should be changing for your own deployment.

    • c3infodesk_printer_repo_new_branch_name: DEFAULT="test_branch"
      • The branch name that it will be checked-out for avoiding updating the main branch
  • From: inventories/group_vars/<TARGET_GROUP>

    • c3infodesk_printer_folder: DEFAULT="Coding/c3infodesk-printer"
      • The folder where to clone the repositories
  • From: roles/clone-repositories/defaults/main.yml

    • c3infodesk_printer_repo_clone: DEFAULT=true
      • If it should or not clone the repository.
    • c3infodesk_printer_repo_url: DEFAULT="https://git.cccv.de/fejao/c3infodesk-printer.git"
      • The repository to be cloned.
    • c3infodesk_printer_repo_new_branch_name: DEFAULT="new_branch_name"
      • The branch name to be set after cloning the repository.

Dependencies

The role dependencies are:

Example Playbook

  • Using the provided example

    For using the playbook playbook_example_03_clone_repositories.yml file you only nned to:

    • Change the user at the ansible.cfg file at the field remote_user for acessing your target.
    • Update the file inventories/host_vars/example_server.yml and change the value for ansible_become_pass from the remote_user
    • Update the inventories/hosts file and change the example_server with the IP address from your target.

    And run the command:

ansible-playbook -i inventories/hosts playbook_example_03_clone_repositories.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:
    - clone_repositories

And call the playbook as:

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

License

MIT / BSD

Author Information

fejao logo https://chaos.social/@fejao