a simple ansible script to pull updates from git{hub/lab}
I needed to pull some updates from a script saved in gitlab and deploy it on 36 servers! Well, ansible came to my rescue and below, is the simple script i created to help me with the task.
The script pulls updates from a private repo in gitlab. It will prompt the user for gitlab credentials once then proceed to deploy.
Hope it helps someone!
---
- hosts: my-servers
  remote_user: ubuntu
  become: yes
  become_method: sudo
  vars_prompt: 
  - name: "githubuser" 
    prompt: "Enter your github username" 
    private: no 
  - name: "githubpassword" 
    prompt: "Enter your github password" 
    private: yes
  tasks:
  - name: Pull updates from gitlab
    git: 
      repo: "https://{{ githubuser | urlencode }}:{{ githubpassword | urlencode }}@gitlab.com/gitlabuser/scripts.git"
      dest: /home/ubuntu/scripts
      update: yes
      version: main 
            Tagged:
            
        
                     
                             
                            
Comments
My dude asks for GitHub username and password to login into GitLab.com
use user access token, do not the password
Fuck this 24/7 internet spew of trivia and celebrity bullshit.
hehe. year, needed to change that. it was initally used for github but i changed the endpoint to gitlab. that should be changed.
true. its more secure. will try update this script when i get some time