Ansible

221 readers
1 users here now

# TODO

founded 1 year ago
MODERATORS
1
 
 

cross-posted from: https://lemmy.dbzer0.com/post/19839436

After getting fed up with TrueNAS (after it borked itself for the third time and I would have had to set it up AGAIN) I decided to learn Ansible and write a playbook to setup my homeserver that way.

I wanted to share this playbook with you in case someone might find it useful for their own setup and maybe someone has some tips on things I could improve.

This server will not be exposed to the public/internet. If I want to access a service on it from outside my home network I have Wireguard setup on my router to connect to my home network from anywhere.

Keep in mind that I'm relatively new to sysadmin stuff etc so don't be too harsh please ๐Ÿ˜…

2
 
 

Hello,

I need some help here. I've been trying to write my own Ansible playbook to setup my homeserver. The storage devices on this server are 1 NVMe SSD and 2 HDDs which I want to setup as a mirror. I want to setup all storage devices as either BTRFS or ZFS but I'm having trouble finding the correct modules to use in Ansible for this.

I have also found some roles in Ansible Galaxy but those are either not explained enough for me to use and seem overwhelming to use (especially in comparison to the terminal commands that are needed to setup the BTRFS volumes or ZFS pools). But just using the builtin command module in Ansible somehow feels wrong and not the right way to go about this.

Can someone point me in the right direction? Right now I think I will prefer using BTRFS.

3
 
 

Has anyone had success with using Ansible to manage Windows?

4
5
 
 

cross-posted from: https://lemmy.ml/post/4593804

Originally discussed on Matrix.


TLDR; Ansible handlers are added to the global namespace.


Suppose you've got a role which defines a handler MyHandler:

- name: MyHandler
  ...
  listen: "some-topic"

Each time you import/include your role, a new reference to MyHandler is added to the global namespace.

As a result, when you notify your handler via the topics it listens to (ie notify: "some-topic"), all the references to MyHandler will be executed by Ansible.

If that's not what you want, you should notify the handler by name (ie notify: MyHandler) in which case Ansible will stop searching for other references as soon as it finds the first occurrence of MyHandler. That means MyHandler will be executed only once.

6
 
 

We use AAP to deploy roles. The roles are in Git. I now have 2 roles that need to deploy the same files and templates, and of course I don't want to keep 2 versions in Git. How could I solve that?

7
 
 

Jeff Geerling in response to RedHats shenanigans is giving away his book on Ansible.

Source: https://twitter.com/geerlingguy/status/1674554543797829633

8
 
 

I've just moved all my ansible control to a new host, but when I try to run a playbook that worked on the old host, I'm getting this error:

"msg": "Failed to connect to the host via ssh: OpenSSH_9.0p1 Ubuntu-1ubuntu7.1, OpenSSL 3.0.5 5 Jul 2022\r\nCan't open user config file /home/mike/automation/ssh_config: No such file or directory",

The directory exists, it has rw-r--r-- permissions, if I run ssh -F it works fine, but if I manually run the sshpass command it gets the same error, any ideas what might be causing this?