How to checkout a git repository via GIT using Ansible module git.

How to checkout git repository via SSH?

I’m going to show you a live demo with some simple Ansible code.
I’m Luca Berton and welcome to today’s episode of Ansible Pilot

Ansible checkout git repository

Today we’re talking about Ansible module git.
The full name is ansible.builtin.git which means is part of the collection of modules “builtin” with ansible and shipped with it.
This module is pretty stable and out for years.
The purpose is to Deploy software (or files) from git checkouts in our managed hosts.

Parameters and Return Values

The parameter list is pretty wide but I’ll summarize the most useful.

  • repo path
  • dest string
  • update boolean
  • key_file path — SSH private…

Let’s troubleshoot together the Ansible fatal error “Syntax Error while loading YAML” to find the offending lines in our playbook code, the root cause, fix a missing quote, and verify the resolution is working.

Today we’re going to talk about Ansible troubleshooting and specifically about Syntax Errors.

I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

demo

The best way of talking about Ansible troubleshooting is to jump in a live demo to show you practically the syntax error and how to solve it!

  • report.txt
test report.txt
  • syntax_error.yml
---
- name: win_copy module demo
hosts: all
become: false
gather_facts: false
vars:
source: "report.txt"
destination: "Desktop/report.txt"
tasks:
- name: copy report.txt
ansible.windows.win_copy:
src: "{{ source }}"
dest: "{{ destination }}

output:

$ ansible-playbook -i win/inventory troubleshooting/syntax_error.ymlERROR! We were unable to read either…

How to copy report.txt file to Windows remote hosts using Ansible module win_copy.

How to copy files to Windows remote hosts?

I’m going to show you a live demo with some simple Ansible code.
I’m Luca Berton and welcome to today’s episode of Ansible Pilot

Ansible copy files to Windows remote hosts

Today we’re talking about Ansible module win_copy.
The full name is `ansible.windows.win_copy` which means is part of the collection of modules “ansible.windows” targeted windows remote hosts.
This module is pretty stable and out for years.
The purpose is to copy files from the local machine to remote locations.
Because win_copy runs over WinRM, it is not a very efficient transfer mechanism. If you plan to send large files consider hosting them on a web service and using `ansible.windows.win_get_url` instead.
Please…


How to download a tarball, verify the checksum, assign some permission with Ansible

How to download a file with Ansible?

I’m going to show you a live demo and some simple Ansible code.

I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

Ansible download a file

Today we’re talking about the Ansible module get_url.

The full name is ansible.builtin.get_url, which means that is part of the collection of modules “builtin” with ansible and shipped with it, part of `ansible-core`.

It’s a module pretty stable and out for years.

It works in a different variety of operating systems.

It downloads files from HTTP, HTTPS, or FTP to node

For Windows targets, use the `ansible.windows.win_get_url` …


How to reboot remote hosts with Ansible specifying the notification message to logged users, the delay seconds, and the verification command. Live demo and fun included.

How to reboot remote hosts with Ansible?

I’m going to show you a live demo with some simple Ansible code.

I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

Ansible reboot remote hosts

Today we’re talking about the Ansible module reboot.

The full name is ansible.builtin.reboot which means is part of the collection of modules “builtin” with ansible and shipped with `ansible-core`.

This module is pretty stable and out for years and supports a large variety of operating systems.

The purpose is to reboot a remote machine, wait for it to go down, come back up, and respond to commands.

For…


A real-life example about how the “deleteme” file and the “deleteme” directory with Ansible. Tested in a target Linux machine as well for idempotency of the Ansible Playbook.

How to Delete files or directory with Ansible?

I’m going to show you a live demo and some simple Ansible code.

I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

Ansible delete file/directory

Today we’re talking about the Ansible module file.
The full name is `ansible.builtin.file`, which means that is part of the collection of modules “builtin” with ansible and shipped with it.
It’s a module pretty stable and out for years.
It works in a different variety of operating systems.
It manages files and file properties.
For Windows targets, use the `ansible.windows.win_file` module instead.

Main Parameters

  • path string (dest, name) —…

How to Install Windows software with Ansible? Today I’m going to reveal a secret to installing software in a Windows-managed host using Chocolatey Package Manager.

How to Install Windows software with Ansible?

Today I’m going to reveal a secret to installing the software in a Windows-managed host using Chocolatey Package Manager.

I’m Luca Berton and welcome to today’s episode of Ansible Pilot

Ansible module win_chocolatey

Chocolatey is the package manager for windows, it has the largest online registry of Windows packages.

At the moment it contains nearly 9000 Community Maintained Packages.

Today we’re talking about Ansible module win_chocolatey to automate the software installation process.

The full name is chocolatey.chocolatey.win_chocolatey, which means that is part of the collection distributed by “chocolatey”.

It manages packages in Windows using chocolatey…


When you try to change permission to file your Ansible Playbook might end up with “chgrp failed” error. Let’s investigate together why this error happens and how to solve it!

Today we’re going to talk about Ansible troubleshooting, specifically about chgrp failed error.

I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

demo

The best way of talking about Ansible troubleshooting is to jump in a live demo to show you practically the chgrp failed error and how to solve it!

  • verify_permission.sh
# groups devops
devops : wheel
# useradd -a -G users devops
# groups devops
devops : wheel users
# id devops
uid=1001(devops) gid=10(wheel) groups=10(wheel),100(users)

Recap

Now you know better how to troubleshoot the Ansible chgrp failed error. …


How to change file or directory permission with Ansible? I’m going to show you a live demo and some simple Ansible code to change chmod and group of a test.txt file.

How to change file or directory permission with Ansible?

I’m going to show you a live demo and some simple Ansible code.

I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

Ansible change file/directory permission

Today we’re talking about the Ansible module file.

The full name is ansible.builtin.file, which means that is part of the collection of modules “builtin” with ansible and shipped with it.

It’s a module pretty stable and out for years.

It works in a different variety of operating systems.

It manages files and file properties.

For Windows targets, use the `ansible.windows.win_file` module instead.

Main Parameters

  • path string (dest, name)…

The best way of talking about Ansible troubleshooting is to jump in a live demo to show you practically the failure downloading error and how to solve it!

Today we’re going to talk about Ansible troubleshooting, specifically about failure downloading.

I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

demo

The best way of talking about Ansible troubleshooting is to jump in a live demo to show you practically the failure downloading and how to solve it!

  • failuredownloading_error.yml
---
- name: unarchive module demo
hosts: all
become: false
vars:
myurl: "https://github.com/lucab85/ansible-pilot/archive/refs/master.zip"
tasks:
- name: extract archive
ansible.builtin.unarchive:
src: "{{ myurl }}"
dest: "/home/devops/"
remote_src: true
validate_certs: true
  • failuredownloading_fix.yml
---
- name: unarchive module demo
hosts: all
become: false
vars:
myurl: "https://github.com/lucab85/ansible-pilot/archive/refs/heads/master.zip"

Ansible Pilot

I help creative Automation DevOps, Cloud Engineer, System Administrator, and IT Professional to succeed with Ansible Technology to automate more things everyday

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store