Ansible

216 readers
7 users here now

# TODO

founded 1 year ago
MODERATORS
1
 
 

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.

2
 
 

Has anyone had success with using Ansible to manage Windows?

3
4
 
 

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.

5
 
 

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?

6
 
 

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

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

7
 
 

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?